@@ -132,7 +132,7 @@ private static void HandleClient(TransparentProxyEndPoint endPoint, TcpClient tc
132
132
//if(endPoint.UseServerNameIndication)
133
133
//{
134
134
// //implement in future once SNI supported by SSL stream
135
- // certificate = CertManager.CreateCertificate(endPoint.GenericCertificateName );
135
+ // certificate = CertManager.CreateCertificate(hostName );
136
136
//}
137
137
//else
138
138
certificate = CertManager . CreateCertificate ( endPoint . GenericCertificateName ) ;
@@ -207,7 +207,6 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
207
207
version = new Version ( 1 , 0 ) ;
208
208
}
209
209
210
-
211
210
args . ProxySession . Request . RequestHeaders = new List < HttpHeader > ( ) ;
212
211
213
212
string tmpLine ;
@@ -217,13 +216,9 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
217
216
args . ProxySession . Request . RequestHeaders . Add ( new HttpHeader ( header [ 0 ] , header [ 1 ] ) ) ;
218
217
}
219
218
220
-
221
-
222
219
var httpRemoteUri = new Uri ( ! IsHttps ? httpCmdSplit [ 1 ] : ( string . Concat ( "https://" , args . ProxySession . Request . Host , httpCmdSplit [ 1 ] ) ) ) ;
223
220
args . IsHttps = IsHttps ;
224
221
225
-
226
-
227
222
args . ProxySession . Request . RequestUri = httpRemoteUri ;
228
223
229
224
args . ProxySession . Request . Method = httpMethod ;
@@ -249,24 +244,8 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
249
244
250
245
lastRequestHostName = args . ProxySession . Request . RequestUri . Host ;
251
246
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
-
269
247
248
+
270
249
//If requested interception
271
250
if ( BeforeRequest != null )
272
251
{
@@ -275,12 +254,37 @@ private static void HandleHttpSessionRequest(TcpClient client, string httpCmd, S
275
254
276
255
args . ProxySession . Request . RequestLocked = true ;
277
256
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
+
278
277
if ( args . ProxySession . Request . CancelRequest )
279
278
{
280
279
Dispose ( client , clientStream , clientStreamReader , clientStreamWriter , args ) ;
281
280
break ;
282
281
}
283
282
283
+ if ( ! args . ProxySession . Request . ExpectContinue )
284
+ {
285
+ args . ProxySession . SetConnection ( connection ) ;
286
+ args . ProxySession . SendRequest ( ) ;
287
+ }
284
288
285
289
//If request was modified by user
286
290
if ( args . ProxySession . Request . RequestBodyRead )
0 commit comments