@@ -270,7 +270,7 @@ public function testProperlyHandlesProxyHeaders()
270
270
$ this ->assertEquals ($ headers , $ this ->fakeHeadersAsArray );
271
271
}
272
272
273
- public function testProperlyHandlesProxyHeadersWithCurlBug ()
273
+ public function testProperlyHandlesProxyHeadAdersWithCurlBug ()
274
274
{
275
275
$ rawHeader = $ this ->fakeRawProxyHeader . $ this ->fakeRawHeader ;
276
276
$ this ->curlMock
@@ -298,6 +298,34 @@ public function testProperlyHandlesProxyHeadersWithCurlBug()
298
298
$ this ->assertEquals ($ headers , $ this ->fakeHeadersAsArray );
299
299
}
300
300
301
+ public function testProperlyHandlesProxyHeadersWithCurlBug2 ()
302
+ {
303
+ $ rawHeader = $ this ->fakeRawProxyHeader2 . $ this ->fakeRawHeader ;
304
+ $ this ->curlMock
305
+ ->shouldReceive ('getinfo ' )
306
+ ->with (CURLINFO_HEADER_SIZE )
307
+ ->once ()
308
+ ->andReturn (mb_strlen ($ this ->fakeRawHeader )); // Mimic bug that doesn't count proxy header
309
+ $ this ->curlMock
310
+ ->shouldReceive ('version ' )
311
+ ->once ()
312
+ ->andReturn (array ('version_number ' => self ::CURL_VERSION_BUGGY ));
313
+ $ this ->curlMock
314
+ ->shouldReceive ('exec ' )
315
+ ->once ()
316
+ ->andReturn ($ rawHeader . $ this ->fakeRawBody );
317
+
318
+ $ this ->curlClient ->sendRequest ();
319
+ list ($ rawHeaders , $ rawBody ) = $ this ->curlClient ->extractResponseHeadersAndBody ();
320
+
321
+ $ this ->assertEquals ($ rawHeaders , trim ($ rawHeader ));
322
+ $ this ->assertEquals ($ rawBody , $ this ->fakeRawBody );
323
+
324
+ $ headers = FacebookCurlHttpClient::headersToArray ($ rawHeaders );
325
+
326
+ $ this ->assertEquals ($ headers , $ this ->fakeHeadersAsArray );
327
+ }
328
+
301
329
public function testProperlyHandlesRedirectHeaders ()
302
330
{
303
331
$ rawHeader = $ this ->fakeRawRedirectHeader . $ this ->fakeRawHeader ;
0 commit comments