X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_client_curl.c;h=501c2521e7aff2acd3773d71740c7731195c8cb6;hp=cc5e8104f83573d5294d02ad25f6077477b7b7ab;hb=805287392b6266d05533043509367d7e411e595c;hpb=731b6a841374147b766c850b2a90c6bfade6f9f1 diff --git a/php_http_client_curl.c b/php_http_client_curl.c index cc5e810..501c252 100644 --- a/php_http_client_curl.c +++ b/php_http_client_curl.c @@ -258,6 +258,8 @@ static int php_http_curle_raw_callback(CURL *ch, curl_infotype type, char *data, h->progress.info = "blacklist check"; } else if (php_memnstr(data, ZEND_STRL("SSL"), data + length)) { h->progress.info = "ssl negotiation"; + } else if (php_memnstr(data, ZEND_STRL("upload"), data + length)) { + h->progress.info = "uploaded"; } else if (php_memnstr(data, ZEND_STRL("left intact"), data + length)) { h->progress.info = "not disconnected"; } else if (php_memnstr(data, ZEND_STRL("closed"), data + length)) { @@ -269,6 +271,7 @@ static int php_http_curle_raw_callback(CURL *ch, curl_infotype type, char *data, } else { #if PHP_DEBUG h->progress.info = data; + data[length - 1] = '\0'; #endif } if (h->client->callback.progress.func) { @@ -1100,7 +1103,11 @@ static void php_http_curle_options_init(php_http_options_t *registry TSRMLS_DC) /* useragent */ if ((opt = php_http_option_register(registry, ZEND_STRL("useragent"), CURLOPT_USERAGENT, IS_STRING))) { /* don't check strlen, to allow sending no useragent at all */ - ZVAL_STRING(&opt->defval, "PECL::HTTP/" PHP_PECL_HTTP_VERSION " (PHP/" PHP_VERSION ")", 0); + ZVAL_STRING(&opt->defval, + "PECL_HTTP/" PHP_PECL_HTTP_VERSION " " + "PHP/" PHP_VERSION " " + "libcurl/" LIBCURL_VERSION + , 0); } /* resume */ @@ -1492,8 +1499,8 @@ static STATUS php_http_client_curl_handler_prepare(php_http_client_curl_handler_ } } php_http_buffer_dtor(&header); - curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->options.headers); } + curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->options.headers); /* attach request body */ if ((body_size = php_http_message_body_size(msg->body))) { @@ -1807,7 +1814,7 @@ static STATUS php_http_client_curl_exec(php_http_client_t *h) /* see http://msdn.microsoft.com/library/en-us/winsock/winsock/windows_sockets_error_codes_2.asp */ php_error_docref(NULL TSRMLS_CC, E_WARNING, "WinSock error: %d", WSAGetLastError()); #else - php_error_docref(NULL TSRMLS_CC, E_WARNING, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); #endif return FAILURE; }