X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_client_curl.c;h=5443e666b4a592dd437f1499bea78a85ffbfcb85;hp=43a93371157f4ecb3b11bc6d307eec8c3c43cdd9;hb=da79735adbc6acdd2d4f99c4891906e906a1beb4;hpb=f95804b9731a37187624208a1e2f720da373a989 diff --git a/php_http_client_curl.c b/php_http_client_curl.c index 43a9337..5443e66 100644 --- a/php_http_client_curl.c +++ b/php_http_client_curl.c @@ -528,7 +528,7 @@ static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info) } #endif -#if PHP_HTTP_CURL_VERSION(7,19,1) && defined(PHP_HTTP_HAVE_OPENSSL) +#if (PHP_HTTP_CURL_VERSION(7,19,1) && defined(PHP_HTTP_HAVE_OPENSSL)) || (PHP_HTTP_CURL_VERSION(7,42,0) && defined(PHP_HTTP_HAVE_GNUTLS)) { int i; zval *ci_array; @@ -584,7 +584,14 @@ static php_http_message_t *php_http_curlm_responseparser(php_http_client_curl_ha response = php_http_message_init(NULL, 0, h->response.body TSRMLS_CC); php_http_header_parser_init(&parser TSRMLS_CC); - php_http_header_parser_parse(&parser, &h->response.headers, PHP_HTTP_HEADER_PARSER_CLEANUP, &response->hdrs, (php_http_info_callback_t) php_http_message_info_callback, (void *) &response); + while (h->response.headers.used) { + php_http_header_parser_state_t st = php_http_header_parser_parse(&parser, + &h->response.headers, PHP_HTTP_HEADER_PARSER_CLEANUP, &response->hdrs, + (php_http_info_callback_t) php_http_message_info_callback, (void *) &response); + if (PHP_HTTP_HEADER_PARSER_STATE_FAILURE == st) { + break; + } + } php_http_header_parser_dtor(&parser); /* move body to right message */ @@ -594,6 +601,7 @@ static php_http_message_t *php_http_curlm_responseparser(php_http_client_curl_ha while (ptr->parent) { ptr = ptr->parent; } + php_http_message_body_free(&response->body); response->body = ptr->body; ptr->body = NULL; } @@ -1225,6 +1233,11 @@ static void php_http_curle_options_init(php_http_options_t *registry TSRMLS_DC) opt->setter = php_http_curle_option_set_proxyheader; } #endif +#if PHP_HTTP_CURL_VERSION(7,43,0) + if ((opt = php_http_option_register(registry, ZEND_STRL("proxy_service_name"), CURLOPT_PROXY_SERVICE_NAME, IS_STRING))) { + opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN; + } +#endif #if PHP_HTTP_CURL_VERSION(7,40,0) if ((opt = php_http_option_register(registry, ZEND_STRL("unix_socket_path"), CURLOPT_UNIX_SOCKET_PATH, IS_STRING))) { @@ -1301,6 +1314,11 @@ static void php_http_curle_options_init(php_http_options_t *registry TSRMLS_DC) if ((opt = php_http_option_register(registry, ZEND_STRL("httpauthtype"), CURLOPT_HTTPAUTH, IS_LONG))) { Z_LVAL(opt->defval) = CURLAUTH_ANYSAFE; } +#if PHP_HTTP_CURL_VERSION(7,43,0) + if ((opt = php_http_option_register(registry, ZEND_STRL("service_name"), CURLOPT_SERVICE_NAME, IS_STRING))) { + opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN; + } +#endif /* redirects */ if ((opt = php_http_option_register(registry, ZEND_STRL("redirect"), CURLOPT_FOLLOWLOCATION, IS_LONG))) { @@ -1507,6 +1525,9 @@ static void php_http_curle_options_init(php_http_options_t *registry TSRMLS_DC) if ((opt = php_http_option_register(registry, ZEND_STRL("tlsauthpass"), CURLOPT_TLSAUTH_PASSWORD, IS_STRING))) { opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN; } +#endif +#if PHP_HTTP_CURL_VERSION(7,42,0) && (defined(PHP_HTTP_HAVE_NSS) || defined(PHP_HTTP_HAVE_DARWINSSL)) + php_http_option_register(registry, ZEND_STRL("falsestart"), CURLOPT_SSL_FALSESTART, IS_BOOL); #endif } }