@@ -233,6 +233,7 @@ private static async Task HandleHttpSessionRequest(TcpClient client, string http
233233 Dispose ( client , clientStream , clientStreamReader , clientStreamWriter , null ) ;
234234 break ;
235235 }
236+
236237#endif
237238 args . WebSession . Request . RequestUri = httpRemoteUri ;
238239
@@ -269,7 +270,7 @@ await TcpHelper.SendRaw(clientStream, httpCmd, args.WebSession.Request.RequestHe
269270 }
270271
271272 //construct the web request that we are going to issue on behalf of the client.
272- connection = await TcpConnectionManager . GetClient ( args . WebSession . Request . RequestUri . Host , args . WebSession . Request . RequestUri . Port , args . IsHttps , version ) . ConfigureAwait ( false ) ;
273+ connection = await TcpConnectionManager . GetClient ( args . WebSession . Request . RequestUri . Host , args . WebSession . Request . RequestUri . Port , args . IsHttps , version ) . ConfigureAwait ( false ) ;
273274
274275
275276 args . WebSession . Request . RequestLocked = true ;
@@ -343,6 +344,8 @@ await WriteResponseStatus(args.WebSession.Response.HttpVersion, "417",
343344 return ;
344345 }
345346
347+ await TcpConnectionManager . ReleaseClient ( connection ) ;
348+
346349 // read the next request
347350 httpCmd = await clientStreamReader . ReadLineAsync ( ) . ConfigureAwait ( false ) ;
348351
@@ -355,8 +358,6 @@ await WriteResponseStatus(args.WebSession.Response.HttpVersion, "417",
355358
356359 }
357360
358- if ( connection != null )
359- await TcpConnectionManager . ReleaseClient ( connection ) ;
360361 }
361362
362363 private static async Task WriteConnectResponse ( StreamWriter clientStreamWriter , Version httpVersion )
0 commit comments