From: Ilia Alshanetsky Date: Sat, 7 Jan 2006 18:31:06 +0000 (+0000) Subject: Don't send user-agent if the user sets it to NULL or '' X-Git-Tag: RELEASE_1_0_4~10 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=7ed0decd1cb0ea45cf10b9741608d2e13c9949ad;p=m6w6%2Fext-http Don't send user-agent if the user sets it to NULL or '' --- diff --git a/http_request_api.c b/http_request_api.c index 082c5fc..440eacd 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -477,8 +477,12 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti } /* useragent, default "PECL::HTTP/version (PHP/version)" */ - if ((zoption = http_request_option(request, options, "useragent", IS_STRING)) && Z_STRLEN_P(zoption)) { - HTTP_CURL_OPT(USERAGENT, Z_STRVAL_P(zoption)); + if ((zoption = http_request_option(request, options, "useragent", IS_STRING))) { + if (Z_STRLEN_P(zoption)) { + HTTP_CURL_OPT(USERAGENT, Z_STRVAL_P(zoption)); + } else { + HTTP_CURL_OPT(USERAGENT, NULL); + } } /* additional headers, array('name' => 'value') */