Don't send user-agent if the user sets it to NULL or ''
authorIlia Alshanetsky <iliaa@php.net>
Sat, 7 Jan 2006 18:31:06 +0000 (18:31 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 7 Jan 2006 18:31:06 +0000 (18:31 +0000)
http_request_api.c

index 082c5fc768bece975c572a8a28031a97954a244b..440eacd99957d08fa3efa22e14d2ebde753da719 100644 (file)
@@ -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') */