From 7ed0decd1cb0ea45cf10b9741608d2e13c9949ad Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Sat, 7 Jan 2006 18:31:06 +0000 Subject: [PATCH] Don't send user-agent if the user sets it to NULL or '' --- http_request_api.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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') */ -- 2.30.2