From 566857053c55a14ca74541f6908e6c3c1d549570 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Thu, 19 Aug 2021 18:10:27 -0400 Subject: [PATCH 01/26] Add documentation to `WebHeaderCollection` --- .../src/System/Net/WebHeaderCollection.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs b/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs index 1a97af3ccfb4fc..73c53bd575e3df 100644 --- a/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs +++ b/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs @@ -79,6 +79,9 @@ private bool AllowHttpResponseHeader } } + /// + /// Gets or sets the specified header. If http request headers are not allowed, throws an exception. + /// public string? this[HttpRequestHeader header] { get @@ -98,7 +101,10 @@ public string? this[HttpRequestHeader header] this[header.GetName()] = value; } } - + + /// + /// Gets or sets the specified header. If http request headers are not allowed, throws an exception. + /// public string? this[HttpResponseHeader header] { get From 8d185878da994b98bc09c4859cfd97a7413c4ff5 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Fri, 20 Aug 2021 10:59:28 -0400 Subject: [PATCH 02/26] Add type parameter description to `HeaderEncodingSelector` --- .../src/System/Net/Http/HeaderEncodingSelector.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HeaderEncodingSelector.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HeaderEncodingSelector.cs index cb984b838cb5c3..0ec01570287526 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HeaderEncodingSelector.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HeaderEncodingSelector.cs @@ -10,6 +10,7 @@ namespace System.Net.Http /// /// Name of the header to specify the for. /// The we are enoding/decoding the headers for. + /// The type of what the encoding is for. /// to use or to use the default behavior. public delegate Encoding? HeaderEncodingSelector(string headerName, TContext context); } From 2ad943964b17be837f31b65051c8821090f3a88b Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Fri, 20 Aug 2021 11:36:16 -0400 Subject: [PATCH 03/26] Add documentation for `CreateContentReadStream` method --- .../System.Net.Http/src/System/Net/Http/HttpContent.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs index eabc0efe68e0a1..a163fe987b02c1 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs @@ -551,6 +551,11 @@ private async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStr } } + /// + /// Creates a to read the content from. + /// + /// to register in case the stream needs to be disposed. + ///The output . protected virtual Stream CreateContentReadStream(CancellationToken cancellationToken) { LoadIntoBuffer(MaxBufferSize, cancellationToken); From b845ac58f87f4d689ab9f2071566b0634372c57e Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Fri, 20 Aug 2021 11:41:29 -0400 Subject: [PATCH 04/26] Add summary to `Options` property of `HttpRequestMessage` class --- .../System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs index 33e5b2527e1d54..7672101a3d15c7 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs @@ -115,6 +115,9 @@ public Uri? RequestUri [Obsolete("HttpRequestMessage.Properties has been deprecated. Use Options instead.")] public IDictionary Properties => Options; + /// + /// Gets the options for the HTTP request. + /// public HttpRequestOptions Options => _options ??= new HttpRequestOptions(); public HttpRequestMessage() From 20da6128c846ceae688afae06e72c8090bd5ff9a Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Fri, 20 Aug 2021 11:58:07 -0400 Subject: [PATCH 05/26] Add summary for `HttpRequestOptions` class --- .../System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs index 195eb0d10fe621..1f1f1a77a17eeb 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs @@ -6,6 +6,10 @@ namespace System.Net.Http { + /// + ///It's a collection of options for an HTTP request. + ///This class cannot be inherited. + /// public sealed class HttpRequestOptions : IDictionary { private Dictionary Options { get; } = new Dictionary(); From 6c5b8c1c7659057ad269fc9615ad1a7b871fc539 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Fri, 20 Aug 2021 11:58:53 -0400 Subject: [PATCH 06/26] Add documentation for `Set` method of `HttpRequestOptions` class --- .../src/System/Net/Http/HttpRequestOptions.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs index 1f1f1a77a17eeb..f13d2a08ff1446 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs @@ -51,7 +51,13 @@ public bool TryGetValue(HttpRequestOptionsKey key, [MaybeNullWhe value = default(TValue); return false; } - + + /// + ///Sets an options for the HTTP Request. + /// + ///The key for the option. + ///The value to set the option to + ///The type of the value to set the option to. public void Set(HttpRequestOptionsKey key, TValue value) { Options[key.Key] = value; From 651ea5619650d50fc075213b72849f5f794e7a58 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Fri, 20 Aug 2021 13:27:21 -0400 Subject: [PATCH 07/26] Change wording of `Set` method summary --- .../System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs index f13d2a08ff1446..fe2ceb90869117 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs @@ -53,7 +53,7 @@ public bool TryGetValue(HttpRequestOptionsKey key, [MaybeNullWhe } /// - ///Sets an options for the HTTP Request. + ///Sets the value of a given option. /// ///The key for the option. ///The value to set the option to From a866640b322666df6b46934af4f17dd42628e84c Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Fri, 20 Aug 2021 13:31:26 -0400 Subject: [PATCH 08/26] Add documentation for `TryGetValue` method of `HttpRequestOptions` class --- .../src/System/Net/Http/HttpRequestOptions.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs index fe2ceb90869117..ffde27a00cee9c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs @@ -40,6 +40,13 @@ public sealed class HttpRequestOptions : IDictionary bool IDictionary.Remove(string key) => Options.Remove(key); bool ICollection>.Remove(KeyValuePair item) => ((IDictionary)Options).Remove(item); bool IDictionary.TryGetValue(string key, out object? value) => Options.TryGetValue(key, out value); + + /// + ///Gets the value of a given option. + /// + ///The key to get the value of. + ///When this method returns, contains the value of the option. This parameter is treated as uninitialized. + ///True, if an item is retrieved. public bool TryGetValue(HttpRequestOptionsKey key, [MaybeNullWhen(false)] out TValue value) { if (Options.TryGetValue(key.Key, out object? _value) && _value is TValue tvalue) From 239f510bb24a263304e00d2e02c092fbae88e758 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Fri, 20 Aug 2021 14:36:40 -0400 Subject: [PATCH 09/26] Fix trailing whitespaces in XML comments --- .../System.Net.Http/src/System/Net/Http/HttpContent.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs index a163fe987b02c1..7618f28d3b1e38 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs @@ -554,8 +554,8 @@ private async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStr /// /// Creates a to read the content from. /// - /// to register in case the stream needs to be disposed. - ///The output . + /// to register in case the stream needs to be disposed. + ///The output . protected virtual Stream CreateContentReadStream(CancellationToken cancellationToken) { LoadIntoBuffer(MaxBufferSize, cancellationToken); From 0bb761301877af1e34beca2ecb47025e86dc37d1 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sat, 21 Aug 2021 13:27:52 -0400 Subject: [PATCH 10/26] Remove trailing whitespaces --- .../System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs | 2 -- .../src/System/Net/WebHeaderCollection.cs | 1 - 2 files changed, 3 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs index ffde27a00cee9c..18c110c4440615 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs @@ -40,7 +40,6 @@ public sealed class HttpRequestOptions : IDictionary bool IDictionary.Remove(string key) => Options.Remove(key); bool ICollection>.Remove(KeyValuePair item) => ((IDictionary)Options).Remove(item); bool IDictionary.TryGetValue(string key, out object? value) => Options.TryGetValue(key, out value); - /// ///Gets the value of a given option. /// @@ -58,7 +57,6 @@ public bool TryGetValue(HttpRequestOptionsKey key, [MaybeNullWhe value = default(TValue); return false; } - /// ///Sets the value of a given option. /// diff --git a/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs b/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs index 73c53bd575e3df..4c51555c263592 100644 --- a/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs +++ b/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs @@ -101,7 +101,6 @@ public string? this[HttpRequestHeader header] this[header.GetName()] = value; } } - /// /// Gets or sets the specified header. If http request headers are not allowed, throws an exception. /// From 963136ae046f9830647a992eb9593dae3edd97bb Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sat, 21 Aug 2021 14:35:37 -0400 Subject: [PATCH 11/26] Add summary to `HttpRequestOptionsKey` --- .../src/System/Net/Http/HttpRequestOptionsKey.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs index f51f8ebf162fe7..e02c632a60d622 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs @@ -8,6 +8,9 @@ namespace System.Net.Http public readonly struct HttpRequestOptionsKey { public string Key { get; } + /// + ///Initializes a new instance of the struct using the supplied string key. + /// public HttpRequestOptionsKey(string key) { Key = key; From a7e7e3db76af017d8b681a098eb4e9a7056c405c Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sat, 21 Aug 2021 14:47:32 -0400 Subject: [PATCH 12/26] Add documentation `HttpRequestOptionsKey` --- .../src/System/Net/Http/HttpRequestOptionsKey.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs index e02c632a60d622..e7338bcbef076a 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs @@ -5,8 +5,15 @@ namespace System.Net.Http { + /// + ///Represents a key in the options for an HTTP request. + /// + ///The type of the value of the option. public readonly struct HttpRequestOptionsKey { + /// + ///Gets the string value of the option key. + /// public string Key { get; } /// ///Initializes a new instance of the struct using the supplied string key. From 7197240aeaa2e4ffed9dfcef6c6c032d17422c18 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sat, 21 Aug 2021 23:50:49 -0400 Subject: [PATCH 13/26] Add documentation to `NegotiateStream.WriteAsync` methods And fix some badly formed XML... --- .../src/System/Net/Http/HttpRequestOptionsKey.cs | 4 ++-- .../src/System/Net/Security/NegotiateStream.cs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs index e7338bcbef076a..be3f24ce9b78e6 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs @@ -7,13 +7,13 @@ namespace System.Net.Http { /// ///Represents a key in the options for an HTTP request. - /// + /// ///The type of the value of the option. public readonly struct HttpRequestOptionsKey { /// ///Gets the string value of the option key. - /// + /// public string Key { get; } /// ///Initializes a new instance of the struct using the supplied string key. diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs index 8ea35c6dfcb452..10ede9b3d02df8 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs @@ -460,6 +460,10 @@ public override void Write(byte[] buffer, int offset, int count) WriteAsync(new SyncReadWriteAdapter(InnerStream), new ReadOnlyMemory(buffer, offset, count)).GetAwaiter().GetResult(); } + ///The region of memory to write data from. + ///The zero-based byte offset in buffer from which to begin copying bytes to the stream. + ///The maximum number of bytes to write. + ///The token to monitor for cancellation requests. public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { ValidateBufferArguments(buffer, offset, count); @@ -473,6 +477,8 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati return WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), new ReadOnlyMemory(buffer, offset, count)); } + ///The region of memory to write data from. + ///The token to monitor for cancellation requests. public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default) { ThrowIfFailed(authSuccessCheck: true); From 246f412b3b184f4952790dee5aafa786e18408d1 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sun, 22 Aug 2021 00:40:14 -0400 Subject: [PATCH 14/26] Fix `cref` attribute --- .../Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs | 9 +++++++++ .../src/System/Net/Http/HttpRequestOptionsKey.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs index 1cd0dbdb7a645f..7ade225b43f0b6 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs @@ -18,12 +18,18 @@ public sealed class SocketsHttpHandler : HttpMessageHandler [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => false; + /// + ///Throws a exception in all cases. + /// public bool UseCookies { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// [AllowNull] public CookieContainer CookieContainer { @@ -31,6 +37,9 @@ public CookieContainer CookieContainer set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public DecompressionMethods AutomaticDecompression { get => throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs index be3f24ce9b78e6..358575ee03556f 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs @@ -16,7 +16,7 @@ public readonly struct HttpRequestOptionsKey /// public string Key { get; } /// - ///Initializes a new instance of the struct using the supplied string key. + ///Initializes a new instance of the HttpRequestOptionsKey struct using the supplied string key. /// public HttpRequestOptionsKey(string key) { From 1c747a49d048432a0624502b0cbdc346aeb95ebf Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sun, 22 Aug 2021 09:55:54 -0400 Subject: [PATCH 15/26] Add documentation to `\BrowserHttpHandler\SocketsHttpHandler.cs` --- .../BrowserHttpHandler/SocketsHttpHandler.cs | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs index 7ade225b43f0b6..7e806824c40a60 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs @@ -15,6 +15,9 @@ namespace System.Net.Http [UnsupportedOSPlatform("browser")] public sealed class SocketsHttpHandler : HttpMessageHandler { + /// + ///Gets a value that indicates whether the this Type is supported. + /// [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => false; @@ -46,72 +49,108 @@ public DecompressionMethods AutomaticDecompression set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public bool UseProxy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public IWebProxy? Proxy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public ICredentials? DefaultProxyCredentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public bool PreAuthenticate { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public ICredentials? Credentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public bool AllowAutoRedirect { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public int MaxAutomaticRedirections { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public int MaxConnectionsPerServer { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public int MaxResponseDrainSize { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public TimeSpan ResponseDrainTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public int MaxResponseHeadersLength { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// [AllowNull] public SslClientAuthenticationOptions SslOptions { @@ -119,68 +158,104 @@ public SslClientAuthenticationOptions SslOptions set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public TimeSpan PooledConnectionLifetime { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public TimeSpan PooledConnectionIdleTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public TimeSpan ConnectTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public TimeSpan Expect100ContinueTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public int InitialHttp2StreamWindowSize { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public TimeSpan KeepAlivePingDelay { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public TimeSpan KeepAlivePingTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public HttpKeepAlivePingPolicy KeepAlivePingPolicy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public IDictionary Properties => throw new PlatformNotSupportedException(); + /// + ///Throws a exception in all cases. + /// public HeaderEncodingSelector? RequestHeaderEncodingSelector { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public HeaderEncodingSelector? ResponseHeaderEncodingSelector { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// [CLSCompliant(false)] public DistributedContextPropagator? ActivityHeadersPropagator { @@ -188,21 +263,33 @@ public DistributedContextPropagator? ActivityHeadersPropagator set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// protected internal override Task SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); + /// + ///Throws a exception in all cases. + /// public bool EnableMultipleHttp2Connections { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public Func>? ConnectCallback { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } + /// + ///Throws a exception in all cases. + /// public Func>? PlaintextStreamFilter { get => throw new PlatformNotSupportedException(); From 9da47bb9f8ca9a70d99203739ae496a38cc3d054 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sun, 22 Aug 2021 12:11:26 -0400 Subject: [PATCH 16/26] Add documentation to `SocketsHttpHandler` properties --- .../BrowserHttpHandler/SocketsHttpHandler.cs | 2 +- .../SocketsHttpHandler/SocketsHttpHandler.cs | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs index 7e806824c40a60..8cab6313767450 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs @@ -17,7 +17,7 @@ public sealed class SocketsHttpHandler : HttpMessageHandler { /// ///Gets a value that indicates whether the this Type is supported. - /// + /// [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => false; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs index 68fbd071e7d64a..04771d64260032 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs @@ -43,6 +43,9 @@ private void CheckDisposedOrStarted() [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => !OperatingSystem.IsBrowser(); + /// + /// Gets or sets a value that indicates if to use cookies. + /// public bool UseCookies { get => _settings._useCookies; @@ -53,6 +56,9 @@ public bool UseCookies } } + /// + /// Gets or sets a contianer for a collection of objects. + /// [AllowNull] public CookieContainer CookieContainer { @@ -64,6 +70,9 @@ public CookieContainer CookieContainer } } + /// + /// Gets or sets a value that indicates if to automatically decompress and what decompression method to use. + /// public DecompressionMethods AutomaticDecompression { get => _settings._automaticDecompression; @@ -74,6 +83,9 @@ public DecompressionMethods AutomaticDecompression } } + /// + /// Gets or sets a value that indicates if to use a proxy. + /// public bool UseProxy { get => _settings._useProxy; @@ -84,6 +96,9 @@ public bool UseProxy } } + /// + /// Gets or sets a value that indicates the proxy to use. + /// public IWebProxy? Proxy { get => _settings._proxy; @@ -94,6 +109,9 @@ public IWebProxy? Proxy } } + /// + /// Gets or sets a value that indicates what credentials to use for the proxy. + /// public ICredentials? DefaultProxyCredentials { get => _settings._defaultProxyCredentials; @@ -104,6 +122,9 @@ public ICredentials? DefaultProxyCredentials } } + /// + /// Gets or sets a value that indicates if to automatically pre-authenticate the connection. + /// public bool PreAuthenticate { get => _settings._preAuthenticate; @@ -114,6 +135,9 @@ public bool PreAuthenticate } } + /// + /// Gets or sets a value that indicates what credentials to use for the connection. + /// public ICredentials? Credentials { get => _settings._credentials; @@ -124,6 +148,9 @@ public ICredentials? Credentials } } + /// + /// Gets or sets a value that indicates if auto-redirects by the server are allowed. + /// public bool AllowAutoRedirect { get => _settings._allowAutoRedirect; @@ -134,6 +161,9 @@ public bool AllowAutoRedirect } } + /// + /// Gets or sets a value that indicates how many auto-redirects by the server are allowed. + /// public int MaxAutomaticRedirections { get => _settings._maxAutomaticRedirections; @@ -149,6 +179,9 @@ public int MaxAutomaticRedirections } } + /// + /// Gets or sets a value that indicates the maximum ammount of connections the server can maintain. + /// public int MaxConnectionsPerServer { get => _settings._maxConnectionsPerServer; @@ -164,6 +197,9 @@ public int MaxConnectionsPerServer } } + /// + /// Gets or sets the maximum amount of data that can be drained from responses in bytes. + /// public int MaxResponseDrainSize { get => _settings._maxResponseDrainSize; @@ -179,6 +215,9 @@ public int MaxResponseDrainSize } } + /// + /// Gets or sets the timespan to wait for data to be drained from responses. + /// public TimeSpan ResponseDrainTimeout { get => _settings._maxResponseDrainTime; @@ -195,6 +234,9 @@ public TimeSpan ResponseDrainTimeout } } + /// + /// Gets or sets the maximum length of reponse headers (in kilobytes). + /// public int MaxResponseHeadersLength { get => _settings._maxResponseHeadersLength; @@ -210,6 +252,9 @@ public int MaxResponseHeadersLength } } + /// + /// Gets or sets the options for client TSL authentication. + /// [AllowNull] public SslClientAuthenticationOptions SslOptions { @@ -221,6 +266,9 @@ public SslClientAuthenticationOptions SslOptions } } + /// + /// Gets or sets how long a connection can be in the pool to be considered reusable. + /// public TimeSpan PooledConnectionLifetime { get => _settings._pooledConnectionLifetime; @@ -236,6 +284,9 @@ public TimeSpan PooledConnectionLifetime } } + /// + /// Gets or sets how long a connection can be idle in the pool to be considered reusable. + /// public TimeSpan PooledConnectionIdleTimeout { get => _settings._pooledConnectionIdleTimeout; @@ -251,6 +302,9 @@ public TimeSpan PooledConnectionIdleTimeout } } + /// + /// Gets or sets the timespan to wait before the connection establishing times out. + /// public TimeSpan ConnectTimeout { get => _settings._connectTimeout; @@ -267,6 +321,9 @@ public TimeSpan ConnectTimeout } } + /// + /// Gets or sets the time-out value for server HTTP 100 continue response. + /// public TimeSpan Expect100ContinueTimeout { get => _settings._expect100ContinueTimeout; From ec22eeb75d70a5e0bb665dc78af1a484d275ea8f Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sun, 22 Aug 2021 20:44:58 -0400 Subject: [PATCH 17/26] Better documentation for `WriteAsync` methods --- .../src/System/Net/Security/NegotiateStream.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs index 10ede9b3d02df8..b014f069e98af8 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs @@ -464,6 +464,7 @@ public override void Write(byte[] buffer, int offset, int count) ///The zero-based byte offset in buffer from which to begin copying bytes to the stream. ///The maximum number of bytes to write. ///The token to monitor for cancellation requests. + ///An empty public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { ValidateBufferArguments(buffer, offset, count); @@ -477,8 +478,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati return WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), new ReadOnlyMemory(buffer, offset, count)); } - ///The region of memory to write data from. - ///The token to monitor for cancellation requests. + ///A public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default) { ThrowIfFailed(authSuccessCheck: true); From 75973adaf3cd8f9d7b0e255e71e8d13595f2b3e5 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Tue, 24 Aug 2021 20:36:17 -0400 Subject: [PATCH 18/26] Remove duplicate documentation --- .../BrowserHttpHandler/SocketsHttpHandler.cs | 93 ------------------- .../SocketsHttpHandler/SocketsHttpHandler.cs | 60 ------------ .../System/Net/Security/NegotiateStream.cs | 4 - .../src/System/Net/WebHeaderCollection.cs | 7 +- 4 files changed, 1 insertion(+), 163 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs index 8cab6313767450..a7c26234f613a9 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs @@ -21,18 +21,12 @@ public sealed class SocketsHttpHandler : HttpMessageHandler [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => false; - /// - ///Throws a exception in all cases. - /// public bool UseCookies { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// [AllowNull] public CookieContainer CookieContainer { @@ -40,117 +34,78 @@ public CookieContainer CookieContainer set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public DecompressionMethods AutomaticDecompression { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public bool UseProxy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public IWebProxy? Proxy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public ICredentials? DefaultProxyCredentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public bool PreAuthenticate { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public ICredentials? Credentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public bool AllowAutoRedirect { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int MaxAutomaticRedirections { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int MaxConnectionsPerServer { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int MaxResponseDrainSize { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan ResponseDrainTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int MaxResponseHeadersLength { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// [AllowNull] public SslClientAuthenticationOptions SslOptions { @@ -158,104 +113,68 @@ public SslClientAuthenticationOptions SslOptions set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan PooledConnectionLifetime { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan PooledConnectionIdleTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan ConnectTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan Expect100ContinueTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int InitialHttp2StreamWindowSize { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan KeepAlivePingDelay { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan KeepAlivePingTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public HttpKeepAlivePingPolicy KeepAlivePingPolicy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public IDictionary Properties => throw new PlatformNotSupportedException(); - /// - ///Throws a exception in all cases. - /// public HeaderEncodingSelector? RequestHeaderEncodingSelector { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public HeaderEncodingSelector? ResponseHeaderEncodingSelector { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// [CLSCompliant(false)] public DistributedContextPropagator? ActivityHeadersPropagator { @@ -263,33 +182,21 @@ public DistributedContextPropagator? ActivityHeadersPropagator set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// protected internal override Task SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); - /// - ///Throws a exception in all cases. - /// public bool EnableMultipleHttp2Connections { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public Func>? ConnectCallback { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public Func>? PlaintextStreamFilter { get => throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs index 04771d64260032..8ff2662e0c124a 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs @@ -37,15 +37,9 @@ private void CheckDisposedOrStarted() } } - /// - /// Gets a value that indicates whether the handler is supported on the current platform. - /// [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => !OperatingSystem.IsBrowser(); - /// - /// Gets or sets a value that indicates if to use cookies. - /// public bool UseCookies { get => _settings._useCookies; @@ -56,9 +50,6 @@ public bool UseCookies } } - /// - /// Gets or sets a contianer for a collection of objects. - /// [AllowNull] public CookieContainer CookieContainer { @@ -70,9 +61,6 @@ public CookieContainer CookieContainer } } - /// - /// Gets or sets a value that indicates if to automatically decompress and what decompression method to use. - /// public DecompressionMethods AutomaticDecompression { get => _settings._automaticDecompression; @@ -83,9 +71,6 @@ public DecompressionMethods AutomaticDecompression } } - /// - /// Gets or sets a value that indicates if to use a proxy. - /// public bool UseProxy { get => _settings._useProxy; @@ -96,9 +81,6 @@ public bool UseProxy } } - /// - /// Gets or sets a value that indicates the proxy to use. - /// public IWebProxy? Proxy { get => _settings._proxy; @@ -109,9 +91,6 @@ public IWebProxy? Proxy } } - /// - /// Gets or sets a value that indicates what credentials to use for the proxy. - /// public ICredentials? DefaultProxyCredentials { get => _settings._defaultProxyCredentials; @@ -122,9 +101,6 @@ public ICredentials? DefaultProxyCredentials } } - /// - /// Gets or sets a value that indicates if to automatically pre-authenticate the connection. - /// public bool PreAuthenticate { get => _settings._preAuthenticate; @@ -135,9 +111,6 @@ public bool PreAuthenticate } } - /// - /// Gets or sets a value that indicates what credentials to use for the connection. - /// public ICredentials? Credentials { get => _settings._credentials; @@ -148,9 +121,6 @@ public ICredentials? Credentials } } - /// - /// Gets or sets a value that indicates if auto-redirects by the server are allowed. - /// public bool AllowAutoRedirect { get => _settings._allowAutoRedirect; @@ -161,9 +131,6 @@ public bool AllowAutoRedirect } } - /// - /// Gets or sets a value that indicates how many auto-redirects by the server are allowed. - /// public int MaxAutomaticRedirections { get => _settings._maxAutomaticRedirections; @@ -179,9 +146,6 @@ public int MaxAutomaticRedirections } } - /// - /// Gets or sets a value that indicates the maximum ammount of connections the server can maintain. - /// public int MaxConnectionsPerServer { get => _settings._maxConnectionsPerServer; @@ -197,9 +161,6 @@ public int MaxConnectionsPerServer } } - /// - /// Gets or sets the maximum amount of data that can be drained from responses in bytes. - /// public int MaxResponseDrainSize { get => _settings._maxResponseDrainSize; @@ -215,9 +176,6 @@ public int MaxResponseDrainSize } } - /// - /// Gets or sets the timespan to wait for data to be drained from responses. - /// public TimeSpan ResponseDrainTimeout { get => _settings._maxResponseDrainTime; @@ -234,9 +192,6 @@ public TimeSpan ResponseDrainTimeout } } - /// - /// Gets or sets the maximum length of reponse headers (in kilobytes). - /// public int MaxResponseHeadersLength { get => _settings._maxResponseHeadersLength; @@ -252,9 +207,6 @@ public int MaxResponseHeadersLength } } - /// - /// Gets or sets the options for client TSL authentication. - /// [AllowNull] public SslClientAuthenticationOptions SslOptions { @@ -266,9 +218,6 @@ public SslClientAuthenticationOptions SslOptions } } - /// - /// Gets or sets how long a connection can be in the pool to be considered reusable. - /// public TimeSpan PooledConnectionLifetime { get => _settings._pooledConnectionLifetime; @@ -284,9 +233,6 @@ public TimeSpan PooledConnectionLifetime } } - /// - /// Gets or sets how long a connection can be idle in the pool to be considered reusable. - /// public TimeSpan PooledConnectionIdleTimeout { get => _settings._pooledConnectionIdleTimeout; @@ -302,9 +248,6 @@ public TimeSpan PooledConnectionIdleTimeout } } - /// - /// Gets or sets the timespan to wait before the connection establishing times out. - /// public TimeSpan ConnectTimeout { get => _settings._connectTimeout; @@ -321,9 +264,6 @@ public TimeSpan ConnectTimeout } } - /// - /// Gets or sets the time-out value for server HTTP 100 continue response. - /// public TimeSpan Expect100ContinueTimeout { get => _settings._expect100ContinueTimeout; diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs index b014f069e98af8..9967e64d0d56cb 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs @@ -460,11 +460,7 @@ public override void Write(byte[] buffer, int offset, int count) WriteAsync(new SyncReadWriteAdapter(InnerStream), new ReadOnlyMemory(buffer, offset, count)).GetAwaiter().GetResult(); } - ///The region of memory to write data from. - ///The zero-based byte offset in buffer from which to begin copying bytes to the stream. - ///The maximum number of bytes to write. ///The token to monitor for cancellation requests. - ///An empty public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { ValidateBufferArguments(buffer, offset, count); diff --git a/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs b/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs index 4c51555c263592..1a97af3ccfb4fc 100644 --- a/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs +++ b/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs @@ -79,9 +79,6 @@ private bool AllowHttpResponseHeader } } - /// - /// Gets or sets the specified header. If http request headers are not allowed, throws an exception. - /// public string? this[HttpRequestHeader header] { get @@ -101,9 +98,7 @@ public string? this[HttpRequestHeader header] this[header.GetName()] = value; } } - /// - /// Gets or sets the specified header. If http request headers are not allowed, throws an exception. - /// + public string? this[HttpResponseHeader header] { get From f3a4fe9b01a15d28bcbb7ea66bb9f5d22ac242b9 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Tue, 24 Aug 2021 20:36:17 -0400 Subject: [PATCH 19/26] Remove duplicate documentation --- .../BrowserHttpHandler/SocketsHttpHandler.cs | 93 ------------------- .../SocketsHttpHandler/SocketsHttpHandler.cs | 60 ------------ .../System/Net/Security/NegotiateStream.cs | 4 - .../src/System/Net/WebHeaderCollection.cs | 7 +- 4 files changed, 1 insertion(+), 163 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs index 8cab6313767450..a7c26234f613a9 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs @@ -21,18 +21,12 @@ public sealed class SocketsHttpHandler : HttpMessageHandler [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => false; - /// - ///Throws a exception in all cases. - /// public bool UseCookies { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// [AllowNull] public CookieContainer CookieContainer { @@ -40,117 +34,78 @@ public CookieContainer CookieContainer set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public DecompressionMethods AutomaticDecompression { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public bool UseProxy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public IWebProxy? Proxy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public ICredentials? DefaultProxyCredentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public bool PreAuthenticate { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public ICredentials? Credentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public bool AllowAutoRedirect { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int MaxAutomaticRedirections { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int MaxConnectionsPerServer { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int MaxResponseDrainSize { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan ResponseDrainTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int MaxResponseHeadersLength { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// [AllowNull] public SslClientAuthenticationOptions SslOptions { @@ -158,104 +113,68 @@ public SslClientAuthenticationOptions SslOptions set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan PooledConnectionLifetime { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan PooledConnectionIdleTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan ConnectTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan Expect100ContinueTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public int InitialHttp2StreamWindowSize { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan KeepAlivePingDelay { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public TimeSpan KeepAlivePingTimeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public HttpKeepAlivePingPolicy KeepAlivePingPolicy { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public IDictionary Properties => throw new PlatformNotSupportedException(); - /// - ///Throws a exception in all cases. - /// public HeaderEncodingSelector? RequestHeaderEncodingSelector { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public HeaderEncodingSelector? ResponseHeaderEncodingSelector { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// [CLSCompliant(false)] public DistributedContextPropagator? ActivityHeadersPropagator { @@ -263,33 +182,21 @@ public DistributedContextPropagator? ActivityHeadersPropagator set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// protected internal override Task SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); - /// - ///Throws a exception in all cases. - /// public bool EnableMultipleHttp2Connections { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public Func>? ConnectCallback { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } - /// - ///Throws a exception in all cases. - /// public Func>? PlaintextStreamFilter { get => throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs index 04771d64260032..8ff2662e0c124a 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs @@ -37,15 +37,9 @@ private void CheckDisposedOrStarted() } } - /// - /// Gets a value that indicates whether the handler is supported on the current platform. - /// [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => !OperatingSystem.IsBrowser(); - /// - /// Gets or sets a value that indicates if to use cookies. - /// public bool UseCookies { get => _settings._useCookies; @@ -56,9 +50,6 @@ public bool UseCookies } } - /// - /// Gets or sets a contianer for a collection of objects. - /// [AllowNull] public CookieContainer CookieContainer { @@ -70,9 +61,6 @@ public CookieContainer CookieContainer } } - /// - /// Gets or sets a value that indicates if to automatically decompress and what decompression method to use. - /// public DecompressionMethods AutomaticDecompression { get => _settings._automaticDecompression; @@ -83,9 +71,6 @@ public DecompressionMethods AutomaticDecompression } } - /// - /// Gets or sets a value that indicates if to use a proxy. - /// public bool UseProxy { get => _settings._useProxy; @@ -96,9 +81,6 @@ public bool UseProxy } } - /// - /// Gets or sets a value that indicates the proxy to use. - /// public IWebProxy? Proxy { get => _settings._proxy; @@ -109,9 +91,6 @@ public IWebProxy? Proxy } } - /// - /// Gets or sets a value that indicates what credentials to use for the proxy. - /// public ICredentials? DefaultProxyCredentials { get => _settings._defaultProxyCredentials; @@ -122,9 +101,6 @@ public ICredentials? DefaultProxyCredentials } } - /// - /// Gets or sets a value that indicates if to automatically pre-authenticate the connection. - /// public bool PreAuthenticate { get => _settings._preAuthenticate; @@ -135,9 +111,6 @@ public bool PreAuthenticate } } - /// - /// Gets or sets a value that indicates what credentials to use for the connection. - /// public ICredentials? Credentials { get => _settings._credentials; @@ -148,9 +121,6 @@ public ICredentials? Credentials } } - /// - /// Gets or sets a value that indicates if auto-redirects by the server are allowed. - /// public bool AllowAutoRedirect { get => _settings._allowAutoRedirect; @@ -161,9 +131,6 @@ public bool AllowAutoRedirect } } - /// - /// Gets or sets a value that indicates how many auto-redirects by the server are allowed. - /// public int MaxAutomaticRedirections { get => _settings._maxAutomaticRedirections; @@ -179,9 +146,6 @@ public int MaxAutomaticRedirections } } - /// - /// Gets or sets a value that indicates the maximum ammount of connections the server can maintain. - /// public int MaxConnectionsPerServer { get => _settings._maxConnectionsPerServer; @@ -197,9 +161,6 @@ public int MaxConnectionsPerServer } } - /// - /// Gets or sets the maximum amount of data that can be drained from responses in bytes. - /// public int MaxResponseDrainSize { get => _settings._maxResponseDrainSize; @@ -215,9 +176,6 @@ public int MaxResponseDrainSize } } - /// - /// Gets or sets the timespan to wait for data to be drained from responses. - /// public TimeSpan ResponseDrainTimeout { get => _settings._maxResponseDrainTime; @@ -234,9 +192,6 @@ public TimeSpan ResponseDrainTimeout } } - /// - /// Gets or sets the maximum length of reponse headers (in kilobytes). - /// public int MaxResponseHeadersLength { get => _settings._maxResponseHeadersLength; @@ -252,9 +207,6 @@ public int MaxResponseHeadersLength } } - /// - /// Gets or sets the options for client TSL authentication. - /// [AllowNull] public SslClientAuthenticationOptions SslOptions { @@ -266,9 +218,6 @@ public SslClientAuthenticationOptions SslOptions } } - /// - /// Gets or sets how long a connection can be in the pool to be considered reusable. - /// public TimeSpan PooledConnectionLifetime { get => _settings._pooledConnectionLifetime; @@ -284,9 +233,6 @@ public TimeSpan PooledConnectionLifetime } } - /// - /// Gets or sets how long a connection can be idle in the pool to be considered reusable. - /// public TimeSpan PooledConnectionIdleTimeout { get => _settings._pooledConnectionIdleTimeout; @@ -302,9 +248,6 @@ public TimeSpan PooledConnectionIdleTimeout } } - /// - /// Gets or sets the timespan to wait before the connection establishing times out. - /// public TimeSpan ConnectTimeout { get => _settings._connectTimeout; @@ -321,9 +264,6 @@ public TimeSpan ConnectTimeout } } - /// - /// Gets or sets the time-out value for server HTTP 100 continue response. - /// public TimeSpan Expect100ContinueTimeout { get => _settings._expect100ContinueTimeout; diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs index b014f069e98af8..9967e64d0d56cb 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs @@ -460,11 +460,7 @@ public override void Write(byte[] buffer, int offset, int count) WriteAsync(new SyncReadWriteAdapter(InnerStream), new ReadOnlyMemory(buffer, offset, count)).GetAwaiter().GetResult(); } - ///The region of memory to write data from. - ///The zero-based byte offset in buffer from which to begin copying bytes to the stream. - ///The maximum number of bytes to write. ///The token to monitor for cancellation requests. - ///An empty public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { ValidateBufferArguments(buffer, offset, count); diff --git a/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs b/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs index 4c51555c263592..1a97af3ccfb4fc 100644 --- a/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs +++ b/src/libraries/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs @@ -79,9 +79,6 @@ private bool AllowHttpResponseHeader } } - /// - /// Gets or sets the specified header. If http request headers are not allowed, throws an exception. - /// public string? this[HttpRequestHeader header] { get @@ -101,9 +98,7 @@ public string? this[HttpRequestHeader header] this[header.GetName()] = value; } } - /// - /// Gets or sets the specified header. If http request headers are not allowed, throws an exception. - /// + public string? this[HttpResponseHeader header] { get From 8190cdd03f2d91169e94b43e6782d265621739d0 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Sat, 28 Aug 2021 17:36:24 +0200 Subject: [PATCH 20/26] Minor tweaks and fix test failures --- .../System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs | 3 --- .../System.Net.Http/src/System/Net/Http/HttpContent.cs | 2 +- .../System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs | 2 +- .../src/System/Net/Security/NegotiateStream.cs | 2 -- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs index a7c26234f613a9..1cd0dbdb7a645f 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/SocketsHttpHandler.cs @@ -15,9 +15,6 @@ namespace System.Net.Http [UnsupportedOSPlatform("browser")] public sealed class SocketsHttpHandler : HttpMessageHandler { - /// - ///Gets a value that indicates whether the this Type is supported. - /// [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => false; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs index 7618f28d3b1e38..bee2f72137502e 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs @@ -554,7 +554,7 @@ private async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStr /// /// Creates a to read the content from. /// - /// to register in case the stream needs to be disposed. + ///The to register in case the stream needs to be disposed. ///The output . protected virtual Stream CreateContentReadStream(CancellationToken cancellationToken) { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs index 18c110c4440615..d38ba10e12ea96 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs @@ -7,7 +7,7 @@ namespace System.Net.Http { /// - ///It's a collection of options for an HTTP request. + ///Represents a collection of options for an HTTP request. ///This class cannot be inherited. /// public sealed class HttpRequestOptions : IDictionary diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs index 9967e64d0d56cb..8ea35c6dfcb452 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs @@ -460,7 +460,6 @@ public override void Write(byte[] buffer, int offset, int count) WriteAsync(new SyncReadWriteAdapter(InnerStream), new ReadOnlyMemory(buffer, offset, count)).GetAwaiter().GetResult(); } - ///The token to monitor for cancellation requests. public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { ValidateBufferArguments(buffer, offset, count); @@ -474,7 +473,6 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati return WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), new ReadOnlyMemory(buffer, offset, count)); } - ///A public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default) { ThrowIfFailed(authSuccessCheck: true); From a6397b5345b26ac414bef00ca94cc1391b04e5b6 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Mon, 30 Aug 2021 13:26:26 +0200 Subject: [PATCH 21/26] Add some removed documentation --- .../System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs index 8ff2662e0c124a..68fbd071e7d64a 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs @@ -37,6 +37,9 @@ private void CheckDisposedOrStarted() } } + /// + /// Gets a value that indicates whether the handler is supported on the current platform. + /// [UnsupportedOSPlatformGuard("browser")] public static bool IsSupported => !OperatingSystem.IsBrowser(); From 64e13aad8389c7b73bedde1f02f964bc31b1d59a Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Thu, 2 Sep 2021 13:15:11 +0200 Subject: [PATCH 22/26] Make changes according to review --- .../System/Net/Http/HeaderEncodingSelector.cs | 4 +-- .../src/System/Net/Http/HttpContent.cs | 10 +++--- .../src/System/Net/Http/HttpRequestMessage.cs | 2 +- .../src/System/Net/Http/HttpRequestOptions.cs | 34 ++++++++++--------- .../System/Net/Http/HttpRequestOptionsKey.cs | 21 ++++++------ .../System/Net/Security/NegotiateStream.cs | 2 ++ 6 files changed, 39 insertions(+), 34 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HeaderEncodingSelector.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HeaderEncodingSelector.cs index 0ec01570287526..4a13d67913485b 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HeaderEncodingSelector.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HeaderEncodingSelector.cs @@ -9,8 +9,8 @@ namespace System.Net.Http /// Represents a method that specifies the to use when interpreting header values. /// /// Name of the header to specify the for. - /// The we are enoding/decoding the headers for. - /// The type of what the encoding is for. + /// The we are encoding/decoding the headers for. + /// The type which headers are being encoded/decoded; /// to use or to use the default behavior. public delegate Encoding? HeaderEncodingSelector(string headerName, TContext context); } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs index bee2f72137502e..6a0d7f1f8ee743 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs @@ -551,11 +551,11 @@ private async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStr } } - /// - /// Creates a to read the content from. - /// - ///The to register in case the stream needs to be disposed. - ///The output . + /// + /// Serializes the HTTP content to a memory stream. + /// + /// The cancellation token to cancel the operation. + /// The output memory stream which contains the serialized HTTP content. protected virtual Stream CreateContentReadStream(CancellationToken cancellationToken) { LoadIntoBuffer(MaxBufferSize, cancellationToken); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs index 7672101a3d15c7..1ca162ca2c020c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs @@ -116,7 +116,7 @@ public Uri? RequestUri public IDictionary Properties => Options; /// - /// Gets the options for the HTTP request. + /// Gets the special flags to use for the HTTP request. It's used to configure the HTTP request. /// public HttpRequestOptions Options => _options ??= new HttpRequestOptions(); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs index d38ba10e12ea96..a56fbb712b7f3c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs @@ -6,10 +6,10 @@ namespace System.Net.Http { - /// - ///Represents a collection of options for an HTTP request. - ///This class cannot be inherited. - /// + /// + /// Represents a collection of options for an HTTP request. + /// This class cannot be inherited. + /// public sealed class HttpRequestOptions : IDictionary { private Dictionary Options { get; } = new Dictionary(); @@ -40,12 +40,13 @@ public sealed class HttpRequestOptions : IDictionary bool IDictionary.Remove(string key) => Options.Remove(key); bool ICollection>.Remove(KeyValuePair item) => ((IDictionary)Options).Remove(item); bool IDictionary.TryGetValue(string key, out object? value) => Options.TryGetValue(key, out value); - /// - ///Gets the value of a given option. - /// - ///The key to get the value of. - ///When this method returns, contains the value of the option. This parameter is treated as uninitialized. - ///True, if an item is retrieved. + + /// + /// Gets the value of a given option. + /// + /// The key to get the value of. + /// When this method returns, contains the value of the option. This parameter is treated as uninitialized. + /// True, if an item is retrieved. public bool TryGetValue(HttpRequestOptionsKey key, [MaybeNullWhen(false)] out TValue value) { if (Options.TryGetValue(key.Key, out object? _value) && _value is TValue tvalue) @@ -57,12 +58,13 @@ public bool TryGetValue(HttpRequestOptionsKey key, [MaybeNullWhe value = default(TValue); return false; } - /// - ///Sets the value of a given option. - /// - ///The key for the option. - ///The value to set the option to - ///The type of the value to set the option to. + + /// + /// Sets the value of a given option. + /// + /// The key for the option. + /// The value to set the option to + /// The type of the value to set the option to. public void Set(HttpRequestOptionsKey key, TValue value) { Options[key.Key] = value; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs index 358575ee03556f..bf5987d79a85cf 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs @@ -5,19 +5,20 @@ namespace System.Net.Http { - /// - ///Represents a key in the options for an HTTP request. - /// - ///The type of the value of the option. + /// + /// Represents a key in the options for an HTTP request. + /// + /// The type of the value of the option. public readonly struct HttpRequestOptionsKey { - /// - ///Gets the string value of the option key. - /// + /// + /// Gets the string value of the option key. + /// public string Key { get; } - /// - ///Initializes a new instance of the HttpRequestOptionsKey struct using the supplied string key. - /// + + /// + /// Initializes a new instance of the HttpRequestOptionsKey struct using the supplied string key. + /// public HttpRequestOptionsKey(string key) { Key = key; diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs index 8ea35c6dfcb452..d84fefc21424d3 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs @@ -473,6 +473,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati return WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), new ReadOnlyMemory(buffer, offset, count)); } + /// A of void. public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default) { ThrowIfFailed(authSuccessCheck: true); @@ -484,6 +485,7 @@ public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationTo return new ValueTask(WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), buffer)); } + /// A of void. private async Task WriteAsync(TAdapter adapter, ReadOnlyMemory buffer) where TAdapter : IReadWriteAdapter { if (Interlocked.Exchange(ref _writeInProgress, 1) == 1) From 38721b6288b635a73faa9900efa8a5645d2fea45 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Tue, 7 Sep 2021 18:03:59 +0200 Subject: [PATCH 23/26] Make changes according to review --- .../System.Net.Http/src/System/Net/Http/HttpContent.cs | 6 ++++++ .../src/System/Net/Security/NegotiateStream.cs | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs index 6a0d7f1f8ee743..90bd0ad0251bdb 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs @@ -556,6 +556,12 @@ private async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStr /// /// The cancellation token to cancel the operation. /// The output memory stream which contains the serialized HTTP content. + /// + /// Once the operation completes, the returned memory stream represents the HTTP content. The returned stream can then be used to read the content using various stream APIs. + /// The method buffers the content to a memory stream. + /// Derived classes can override this behavior if there is a better way to retrieve the content as stream. + /// For example, a byte array or a string could use a more efficient method way such as wrapping a read-only MemoryStream around the bytes or string. + /// protected virtual Stream CreateContentReadStream(CancellationToken cancellationToken) { LoadIntoBuffer(MaxBufferSize, cancellationToken); diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs index d84fefc21424d3..ed3f92295fd72a 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs @@ -473,7 +473,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati return WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), new ReadOnlyMemory(buffer, offset, count)); } - /// A of void. + /// A that represents the asynchronous read operation. public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default) { ThrowIfFailed(authSuccessCheck: true); @@ -485,7 +485,6 @@ public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationTo return new ValueTask(WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), buffer)); } - /// A of void. private async Task WriteAsync(TAdapter adapter, ReadOnlyMemory buffer) where TAdapter : IReadWriteAdapter { if (Interlocked.Exchange(ref _writeInProgress, 1) == 1) From d856605ea7d0e667eaab3c5a4a15fcedf091e089 Mon Sep 17 00:00:00 2001 From: Filip Toth Date: Tue, 7 Sep 2021 19:37:47 +0200 Subject: [PATCH 24/26] Add documentation to SocketsHttpHandler.CookieContainer --- .../System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs index 68fbd071e7d64a..893ec469bd997e 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs @@ -53,6 +53,9 @@ public bool UseCookies } } + /// + /// Gets or sets the cookie container to be used. + /// [AllowNull] public CookieContainer CookieContainer { From a19317172cd1d041885d428b271e60fa8b3d33bd Mon Sep 17 00:00:00 2001 From: ManickaP Date: Wed, 8 Sep 2021 09:48:08 +0200 Subject: [PATCH 25/26] Removed options docs, cleaned up the rest --- .../src/System/Net/Http/HttpRequestMessage.cs | 3 --- .../src/System/Net/Http/HttpRequestOptions.cs | 17 ----------------- .../System/Net/Http/HttpRequestOptionsKey.cs | 11 ----------- .../SocketsHttpHandler/SocketsHttpHandler.cs | 6 +++--- .../src/System/Net/Security/NegotiateStream.cs | 1 + 5 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs index 1ca162ca2c020c..33e5b2527e1d54 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs @@ -115,9 +115,6 @@ public Uri? RequestUri [Obsolete("HttpRequestMessage.Properties has been deprecated. Use Options instead.")] public IDictionary Properties => Options; - /// - /// Gets the special flags to use for the HTTP request. It's used to configure the HTTP request. - /// public HttpRequestOptions Options => _options ??= new HttpRequestOptions(); public HttpRequestMessage() diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs index a56fbb712b7f3c..195eb0d10fe621 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptions.cs @@ -6,10 +6,6 @@ namespace System.Net.Http { - /// - /// Represents a collection of options for an HTTP request. - /// This class cannot be inherited. - /// public sealed class HttpRequestOptions : IDictionary { private Dictionary Options { get; } = new Dictionary(); @@ -40,13 +36,6 @@ public sealed class HttpRequestOptions : IDictionary bool IDictionary.Remove(string key) => Options.Remove(key); bool ICollection>.Remove(KeyValuePair item) => ((IDictionary)Options).Remove(item); bool IDictionary.TryGetValue(string key, out object? value) => Options.TryGetValue(key, out value); - - /// - /// Gets the value of a given option. - /// - /// The key to get the value of. - /// When this method returns, contains the value of the option. This parameter is treated as uninitialized. - /// True, if an item is retrieved. public bool TryGetValue(HttpRequestOptionsKey key, [MaybeNullWhen(false)] out TValue value) { if (Options.TryGetValue(key.Key, out object? _value) && _value is TValue tvalue) @@ -59,12 +48,6 @@ public bool TryGetValue(HttpRequestOptionsKey key, [MaybeNullWhe return false; } - /// - /// Sets the value of a given option. - /// - /// The key for the option. - /// The value to set the option to - /// The type of the value to set the option to. public void Set(HttpRequestOptionsKey key, TValue value) { Options[key.Key] = value; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs index bf5987d79a85cf..f51f8ebf162fe7 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestOptionsKey.cs @@ -5,20 +5,9 @@ namespace System.Net.Http { - /// - /// Represents a key in the options for an HTTP request. - /// - /// The type of the value of the option. public readonly struct HttpRequestOptionsKey { - /// - /// Gets the string value of the option key. - /// public string Key { get; } - - /// - /// Initializes a new instance of the HttpRequestOptionsKey struct using the supplied string key. - /// public HttpRequestOptionsKey(string key) { Key = key; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs index 893ec469bd997e..ea4adbc7601957 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs @@ -53,9 +53,6 @@ public bool UseCookies } } - /// - /// Gets or sets the cookie container to be used. - /// [AllowNull] public CookieContainer CookieContainer { @@ -421,6 +418,9 @@ public Func + /// Gets a property bag that can be used for ... + /// public IDictionary Properties => _settings._properties ?? (_settings._properties = new Dictionary()); diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs index ed3f92295fd72a..63fa927bf6fdbb 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStream.cs @@ -460,6 +460,7 @@ public override void Write(byte[] buffer, int offset, int count) WriteAsync(new SyncReadWriteAdapter(InnerStream), new ReadOnlyMemory(buffer, offset, count)).GetAwaiter().GetResult(); } + /// A that represents the asynchronous read operation. public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { ValidateBufferArguments(buffer, offset, count); From 845d160965da030a0275d26f51a87a8bf1005525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marie=20P=C3=ADchov=C3=A1?= <11718369+ManickaP@users.noreply.github.com> Date: Wed, 8 Sep 2021 16:08:20 +0200 Subject: [PATCH 26/26] Updated Properties summary --- .../System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs index ea4adbc7601957..5be369967df859 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs @@ -419,7 +419,7 @@ public Func - /// Gets a property bag that can be used for ... + /// Gets a writable dictionary (that is, a map) of custom properties for the HttpClient requests. The dictionary is initialized empty; you can insert and query key-value pairs for your custom handlers and special processing. /// public IDictionary Properties => _settings._properties ?? (_settings._properties = new Dictionary());