@@ -237,20 +237,25 @@ public function responseChecker($io)
237237 $ this ->assertEquals (null , json_decode ($ body , true ));
238238
239239 // Test transforms from proxies.
240- $ rawHeaders = Google_IO_Abstract::CONNECTION_ESTABLISHED
241- . "HTTP/1.1 200 OK \r\nContent-Type: application/json \r\n" ;
242- $ headersSize = strlen ($ rawHeaders );
243- // If we have a broken cURL version we have to simulate it to get the
244- // correct test result.
245- if ($ hasQuirk && get_class ($ io ) === 'Google_IO_Curl ' ) {
246- $ headersSize -= strlen (Google_IO_Abstract::CONNECTION_ESTABLISHED );
240+ $ connection_established_headers = array (
241+ "HTTP/1.0 200 Connection established \r\n\r\n" ,
242+ "HTTP/1.1 200 Connection established \r\n\r\n" ,
243+ );
244+ foreach ($ connection_established_headers as $ established_header ) {
245+ $ rawHeaders = "{$ established_header }HTTP/1.1 200 OK \r\nContent-Type: application/json \r\n" ;
246+ $ headersSize = strlen ($ rawHeaders );
247+ // If we have a broken cURL version we have to simulate it to get the
248+ // correct test result.
249+ if ($ hasQuirk && get_class ($ io ) === 'Google_IO_Curl ' ) {
250+ $ headersSize -= strlen ($ established_header );
251+ }
252+ $ rawBody = "{} " ;
253+
254+ $ rawResponse = "$ rawHeaders \r\n$ rawBody " ;
255+ list ($ headers , $ body ) = $ io ->parseHttpResponse ($ rawResponse , $ headersSize );
256+ $ this ->assertEquals (1 , sizeof ($ headers ));
257+ $ this ->assertEquals (array (), json_decode ($ body , true ));
247258 }
248- $ rawBody = "{} " ;
249-
250- $ rawResponse = "$ rawHeaders \r\n$ rawBody " ;
251- list ($ headers , $ body ) = $ io ->parseHttpResponse ($ rawResponse , $ headersSize );
252- $ this ->assertEquals (1 , sizeof ($ headers ));
253- $ this ->assertEquals (array (), json_decode ($ body , true ));
254259 }
255260
256261 public function processEntityRequest ($ io , $ client )
0 commit comments