@@ -1023,11 +1023,6 @@ private Task<Stream> InternalGetRequestStream()
10231023 {
10241024 CheckAbort ( ) ;
10251025
1026- if ( RequestSubmitted )
1027- {
1028- throw new InvalidOperationException ( SR . net_reqsubmitted ) ;
1029- }
1030-
10311026 // Match Desktop behavior: prevent someone from getting a request stream
10321027 // if the protocol verb/method doesn't support it. Note that this is not
10331028 // entirely compliant RFC2616 for the aforementioned compatibility reasons.
@@ -1038,6 +1033,11 @@ private Task<Stream> InternalGetRequestStream()
10381033 throw new ProtocolViolationException ( SR . net_nouploadonget ) ;
10391034 }
10401035
1036+ if ( RequestSubmitted )
1037+ {
1038+ throw new InvalidOperationException ( SR . net_reqsubmitted ) ;
1039+ }
1040+
10411041 _requestStream = new RequestStream ( ) ;
10421042
10431043 return Task . FromResult ( ( Stream ) _requestStream ) ;
@@ -1065,7 +1065,7 @@ public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, Objec
10651065 }
10661066
10671067 _requestStreamCallback = callback ;
1068- _requestStreamOperation = GetRequestStreamTask ( ) . ToApm ( callback , state ) ;
1068+ _requestStreamOperation = InternalGetRequestStream ( ) . ToApm ( callback , state ) ;
10691069
10701070 return _requestStreamOperation . Task ;
10711071 }
@@ -1097,30 +1097,6 @@ public override Stream EndGetRequestStream(IAsyncResult asyncResult)
10971097 return stream ;
10981098 }
10991099
1100- private Task < Stream > GetRequestStreamTask ( )
1101- {
1102- CheckAbort ( ) ;
1103-
1104- if ( RequestSubmitted )
1105- {
1106- throw new InvalidOperationException ( SR . net_reqsubmitted ) ;
1107- }
1108-
1109- // Match Desktop behavior: prevent someone from getting a request stream
1110- // if the protocol verb/method doesn't support it. Note that this is not
1111- // entirely compliant RFC2616 for the aforementioned compatibility reasons.
1112- if ( string . Equals ( HttpMethod . Get . Method , _originVerb , StringComparison . OrdinalIgnoreCase ) ||
1113- string . Equals ( HttpMethod . Head . Method , _originVerb , StringComparison . OrdinalIgnoreCase ) ||
1114- string . Equals ( "CONNECT" , _originVerb , StringComparison . OrdinalIgnoreCase ) )
1115- {
1116- throw new ProtocolViolationException ( SR . net_nouploadonget ) ;
1117- }
1118-
1119- _requestStream = new RequestStream ( ) ;
1120-
1121- return Task . FromResult ( ( Stream ) _requestStream ) ;
1122- }
1123-
11241100 private async Task < WebResponse > SendRequest ( )
11251101 {
11261102 if ( RequestSubmitted )
0 commit comments