From 2dc47254953b47a4f331239a3bfa716ffd024c1e Mon Sep 17 00:00:00 2001 From: Elivo Date: Tue, 8 Nov 2022 17:54:49 +0800 Subject: [PATCH] Apewer-6.7.1 --- Apewer/Apewer.props | 2 +- Apewer/Network/HttpClient.cs | 8 +++++++- Apewer/RuntimeUtility.cs | 13 ++++++++++--- Apewer/Source/SourceUtility.cs | 4 ++-- Apewer/Web/MiniConnection.cs | 2 +- ChangeLog.md | 8 ++++++++ 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Apewer/Apewer.props b/Apewer/Apewer.props index a52e86e..5099d3b 100644 --- a/Apewer/Apewer.props +++ b/Apewer/Apewer.props @@ -9,7 +9,7 @@ Apewer Apewer Libraries - 6.7.0 + 6.7.1 diff --git a/Apewer/Network/HttpClient.cs b/Apewer/Network/HttpClient.cs index 326b93b..4167497 100644 --- a/Apewer/Network/HttpClient.cs +++ b/Apewer/Network/HttpClient.cs @@ -25,6 +25,12 @@ namespace Apewer.Network /// 获取进度的块大小,以字节为单位,默认值:1024(1KB)。 public int Block { get => _block; set => NumberUtility.Restrict(value, 1, 1048576); } + /// 构建 的实例。 + public HttpClient() + { + RequestHeaders = new StringPairs(); + } + #region request /// 获取或设置将要请求的方法,默认为 GET。 @@ -260,7 +266,7 @@ namespace Apewer.Network var body = request.GetRequestStream(); BytesUtility.Read(stream, body, RequestProgress, Block); } - else + else if (data != null) { request.ContentLength = data.LongLength; var body = request.GetRequestStream(); diff --git a/Apewer/RuntimeUtility.cs b/Apewer/RuntimeUtility.cs index 88a1175..282f495 100644 --- a/Apewer/RuntimeUtility.cs +++ b/Apewer/RuntimeUtility.cs @@ -794,9 +794,16 @@ namespace Apewer if (action == null) return 0; var stopwatch = new Stopwatch(); stopwatch.Start(); - action.Invoke(); - stopwatch.Stop(); - return stopwatch.ElapsedMilliseconds; + try + { + action.Invoke(); + stopwatch.Stop(); + return stopwatch.ElapsedMilliseconds; + } + finally + { + stopwatch.Stop(); + } } #endregion diff --git a/Apewer/Source/SourceUtility.cs b/Apewer/Source/SourceUtility.cs index adc3816..2b4d122 100644 --- a/Apewer/Source/SourceUtility.cs +++ b/Apewer/Source/SourceUtility.cs @@ -403,7 +403,7 @@ namespace Apewer.Source if (name.IsEmpty()) continue; // 属性不可重复。 - if (!name.EndsWith("@")) name = "@" + name; + if (!name.StartsWith("@")) name = "@" + name; if (dict.ContainsKey(name)) continue; // SQL 语句中必须包含此参数。 @@ -440,7 +440,7 @@ namespace Apewer.Source if (name.IsEmpty()) continue; // 属性不可重复。 - if (!name.EndsWith("@")) name = "@" + name; + if (!name.StartsWith("@")) name = "@" + name; if (names.Contains(name)) continue; // SQL 语句中必须包含此参数。 diff --git a/Apewer/Web/MiniConnection.cs b/Apewer/Web/MiniConnection.cs index 9691622..1ec8124 100644 --- a/Apewer/Web/MiniConnection.cs +++ b/Apewer/Web/MiniConnection.cs @@ -524,7 +524,7 @@ namespace Apewer.Web } // redirect - if (location != null) lines.Add($"Location: {lines}"); + if (location != null) lines.Add($"Location: {location}"); // content-type var contentType = response.ContentType; diff --git a/ChangeLog.md b/ChangeLog.md index b3a7022..3392e22 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,14 @@  ### 最新提交 +### 6.7.1 +- 问题修正 + - 修正了 Evaluate 可能不释放计时器的问题; + - 修正了 MiniServer 的 302 响应; + - 修正了 HttpClient.RequestData 为 NULL 时的报错; + - 修正了 HttpClient.RequestHeaders 为 NULL 时的报错; + - 修正了 Query 使用字典传参时的 @ 错误。 + ### 6.7.0 - 大更新 - Result 模型已完全删除,使用 Result 的程序现在已经改为抛出异常,解决程序返回值混乱的问题;