@@ -257,6 +257,8 @@ private async Task<RetryResult> handleHttpSessionRequest(string requestHttpMetho
257
257
TcpServerConnection ? serverConnection , SslApplicationProtocol sslApplicationProtocol ,
258
258
CancellationToken cancellationToken , CancellationTokenSource cancellationTokenSource )
259
259
{
260
+ args . HttpClient . Request . Locked = true ;
261
+
260
262
// a connection generator task with captured parameters via closure.
261
263
Func < Task < TcpServerConnection > > generator = ( ) =>
262
264
tcpConnectionFactory . GetServerConnection ( this , args , isConnect : false ,
@@ -266,6 +268,9 @@ private async Task<RetryResult> handleHttpSessionRequest(string requestHttpMetho
266
268
// for connection pool, retry fails until cache is exhausted.
267
269
return await retryPolicy < ServerConnectionException > ( ) . ExecuteAsync ( async ( connection ) =>
268
270
{
271
+ // set the connection and send request headers
272
+ args . HttpClient . SetConnection ( connection ) ;
273
+
269
274
args . TimeLine [ "Connection Ready" ] = DateTime . Now ;
270
275
271
276
if ( args . HttpClient . Request . UpgradeToWebSocket )
@@ -290,12 +295,9 @@ private async Task handleHttpSessionRequest(TcpServerConnection connection, Sess
290
295
{
291
296
var cancellationToken = args . CancellationTokenSource . Token ;
292
297
var request = args . HttpClient . Request ;
293
- request . Locked = true ;
294
298
295
299
var body = request . CompressBodyAndUpdateContentLength ( ) ;
296
300
297
- // set the connection and send request headers
298
- args . HttpClient . SetConnection ( connection ) ;
299
301
await args . HttpClient . SendRequest ( Enable100ContinueBehaviour , args . IsTransparent ,
300
302
cancellationToken ) ;
301
303
0 commit comments