Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 1183c81

Browse files
committed
Remove unused WinHttpHandler.MaxRequestContentBufferSize property
This property has been effectively deprecated. It was left unimplemented in WinHttpHandler until we realized that we should remove it from the public WinHttpHandler contract. In the .NET Desktop, the equivalent HttpClientHandler.MaxRequestContentBufferSize property was only used when the handler needed to automatically buffer the request content. That only happened if neither 'Content-Length' nor 'Transfer-Encoding: chunked' request headers were specified. The advice to developers is to always be precise with the headers and explicitly choose the transfer mechanism. So, this condition is an edge case. When left ambiguous, the handler thus needed to buffer in the request content to determine its length and then would choose 'Content-Length' semantics when POST'ing. In CoreCLR and .NETNative, the handler will resolve the ambiguity by always choosing 'Transfer-Encoding: chunked'. The handler will never automatically buffer in the request content. [tfs-changeset: 1492780]
1 parent 7f762bd commit 1183c81

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/System.Net.Http/src/System/Net/HttpClientHandler.CoreCLR.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,16 @@ public int MaxAutomaticRedirections
121121

122122
public long MaxRequestContentBufferSize
123123
{
124-
get { return _winHttpHandler.MaxRequestContentBufferSize; }
125-
set { _winHttpHandler.MaxRequestContentBufferSize = value; }
124+
// This property has been deprecated. In the .NET Desktop it was only used when the handler needed to automatically
125+
// buffer the request content. That only happened if neither 'Content-Length' nor 'Transfer-Encoding: chunked'
126+
// request headers were specified. So, the handler thus needed to buffer in the request content to determine its
127+
// length and then would choose 'Content-Length' semantics when POST'ing. In CoreCLR and .NETNative, the handler
128+
// will resolve the ambiguity by always choosing 'Transfer-Encoding: chunked'. The handler will never automatically
129+
// buffer in the request content.
130+
get { return 0; }
131+
132+
// TODO: Add message/link to exception explaining the deprecation.
133+
set { throw new PlatformNotSupportedException(); }
126134
}
127135

128136
#endregion Properties

0 commit comments

Comments
 (0)