@@ -232,20 +232,6 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
232232 args . Client . ClientStreamReader = clientStreamReader ;
233233 args . Client . ClientStreamWriter = clientStreamWriter ;
234234
235- //If requested interception
236- if ( BeforeRequest != null )
237- {
238- BeforeRequest ( null , args ) ;
239- }
240-
241- args . ProxySession . Request . RequestLocked = true ;
242-
243- if ( args . ProxySession . Request . CancelRequest )
244- {
245- Dispose ( client , clientStream , clientStreamReader , clientStreamWriter , args ) ;
246- break ;
247- }
248-
249235 if ( args . ProxySession . Request . UpgradeToWebSocket )
250236 {
251237 TcpHelper . SendRaw ( clientStream , httpCmd , args . ProxySession . Request . RequestHeaders ,
@@ -266,7 +252,7 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
266252 args . ProxySession . SetConnection ( connection ) ;
267253 args . ProxySession . SendRequest ( ) ;
268254
269- if ( Enable100ContinueBehaviour )
255+ if ( Enable100ContinueBehaviour )
270256 if ( args . ProxySession . Request . Is100Continue )
271257 {
272258 WriteResponseStatus ( args . ProxySession . Response . HttpVersion , "100" ,
@@ -281,6 +267,21 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
281267 }
282268
283269
270+ //If requested interception
271+ if ( BeforeRequest != null )
272+ {
273+ BeforeRequest ( null , args ) ;
274+ }
275+
276+ args . ProxySession . Request . RequestLocked = true ;
277+
278+ if ( args . ProxySession . Request . CancelRequest )
279+ {
280+ Dispose ( client , clientStream , clientStreamReader , clientStreamWriter , args ) ;
281+ break ;
282+ }
283+
284+
284285 //If request was modified by user
285286 if ( args . ProxySession . Request . RequestBodyRead )
286287 {
0 commit comments