@@ -132,7 +132,7 @@ private static void HandleClient(TransparentProxyEndPoint endPoint, TcpClient tc
132132 //if(endPoint.UseServerNameIndication)
133133 //{
134134 // //implement in future once SNI supported by SSL stream
135- // certificate = CertManager.CreateCertificate(endPoint.GenericCertificateName );
135+ // certificate = CertManager.CreateCertificate(hostName );
136136 //}
137137 //else
138138 certificate = CertManager . CreateCertificate ( endPoint . GenericCertificateName ) ;
@@ -207,7 +207,6 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
207207 version = new Version ( 1 , 0 ) ;
208208 }
209209
210-
211210 args . ProxySession . Request . RequestHeaders = new List < HttpHeader > ( ) ;
212211
213212 string tmpLine ;
@@ -217,13 +216,9 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
217216 args . ProxySession . Request . RequestHeaders . Add ( new HttpHeader ( header [ 0 ] , header [ 1 ] ) ) ;
218217 }
219218
220-
221-
222219 var httpRemoteUri = new Uri ( ! IsHttps ? httpCmdSplit [ 1 ] : ( string . Concat ( "https://" , args . ProxySession . Request . Host , httpCmdSplit [ 1 ] ) ) ) ;
223220 args . IsHttps = IsHttps ;
224221
225-
226-
227222 args . ProxySession . Request . RequestUri = httpRemoteUri ;
228223
229224 args . ProxySession . Request . Method = httpMethod ;
@@ -249,24 +244,8 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
249244
250245 lastRequestHostName = args . ProxySession . Request . RequestUri . Host ;
251246 args . ProxySession . Request . Host = args . ProxySession . Request . RequestUri . Host ;
252- args . ProxySession . SetConnection ( connection ) ;
253- args . ProxySession . SendRequest ( ) ;
254-
255- if ( Enable100ContinueBehaviour )
256- if ( args . ProxySession . Request . Is100Continue )
257- {
258- WriteResponseStatus ( args . ProxySession . Response . HttpVersion , "100" ,
259- "Continue" , args . Client . ClientStreamWriter ) ;
260- args . Client . ClientStreamWriter . WriteLine ( ) ;
261- }
262- else if ( args . ProxySession . Request . ExpectationFailed )
263- {
264- WriteResponseStatus ( args . ProxySession . Response . HttpVersion , "417" ,
265- "Expectation Failed" , args . Client . ClientStreamWriter ) ;
266- args . Client . ClientStreamWriter . WriteLine ( ) ;
267- }
268-
269247
248+
270249 //If requested interception
271250 if ( BeforeRequest != null )
272251 {
@@ -275,12 +254,37 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
275254
276255 args . ProxySession . Request . RequestLocked = true ;
277256
257+ if ( args . ProxySession . Request . ExpectContinue )
258+ {
259+ args . ProxySession . SetConnection ( connection ) ;
260+ args . ProxySession . SendRequest ( ) ;
261+ }
262+
263+ if ( Enable100ContinueBehaviour )
264+ if ( args . ProxySession . Request . Is100Continue )
265+ {
266+ WriteResponseStatus ( args . ProxySession . Response . HttpVersion , "100" ,
267+ "Continue" , args . Client . ClientStreamWriter ) ;
268+ args . Client . ClientStreamWriter . WriteLine ( ) ;
269+ }
270+ else if ( args . ProxySession . Request . ExpectationFailed )
271+ {
272+ WriteResponseStatus ( args . ProxySession . Response . HttpVersion , "417" ,
273+ "Expectation Failed" , args . Client . ClientStreamWriter ) ;
274+ args . Client . ClientStreamWriter . WriteLine ( ) ;
275+ }
276+
278277 if ( args . ProxySession . Request . CancelRequest )
279278 {
280279 Dispose ( client , clientStream , clientStreamReader , clientStreamWriter , args ) ;
281280 break ;
282281 }
283282
283+ if ( ! args . ProxySession . Request . ExpectContinue )
284+ {
285+ args . ProxySession . SetConnection ( connection ) ;
286+ args . ProxySession . SendRequest ( ) ;
287+ }
284288
285289 //If request was modified by user
286290 if ( args . ProxySession . Request . RequestBodyRead )
0 commit comments