+ /* so, if curl sees a 3xx code, a Location header and a Connection:close header
+ * it decides not to read the response body.
+ */
+ if ((flags & PHP_HTTP_MESSAGE_PARSER_EMPTY_REDIRECTS)
+ && (*message)->type == PHP_HTTP_RESPONSE
+ && (*message)->http.info.response.code/100 == 3
+ && (h_loc = php_http_message_header(*message, ZEND_STRL("Location"), 1))
+ && (h_con = php_http_message_header(*message, ZEND_STRL("Connection"), 1))
+ ) {
+ if (php_http_match(Z_STRVAL_P(h_con), "close", PHP_HTTP_MATCH_WORD)) {
+ php_http_message_parser_state_push(parser, 1, PHP_HTTP_MESSAGE_PARSER_STATE_DONE);
+ zval_ptr_dtor(&h_loc);
+ zval_ptr_dtor(&h_con);
+ break;
+ }
+ }
+ if (h_loc) {
+ zval_ptr_dtor(&h_loc);
+ }
+ if (h_con) {
+ zval_ptr_dtor(&h_con);
+ }
+