Req #64723 [Com]: Set default value for CURLOPT_USERAGENT

From: Date: Wed, 05 Mar 2014 20:59:33 +0000
Subject: Req #64723 [Com]: Set default value for CURLOPT_USERAGENT
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184541@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64723&edit=1

 ID:                 64723
 Comment by:         narf at devilix dot net
 Reported by:        dr_mantis at regad dot org
 Summary:            Set default value for CURLOPT_USERAGENT
 Status:             Open
 Type:               Feature/Change Request
 Package:            cURL related
 Operating System:   N/A
 PHP Version:        5.4.14
 Block user comment: N
 Private report:     N

 New Comment:

-1

This would be a BC break and those are not nice ...
Plus, I see no reason why I should be forced to explicitly set the user-agent to an empty one.


Previous Comments:
------------------------------------------------------------------------
[2013-04-26 14:56:53] dr_mantis at regad dot org

Description:
------------
When calling curl from command-line, unless specified otherwise it sets by default the User Agent to
'curl/x.y.z'.

It would be nice if the php curl extension did the same thing (at the moment, the user agent is set
to blank), to avoid having to do something like

$v = curl_version();
curl_setopt( $curl, CURLOPT_USERAGENT, 'curl/' . $v['version'] );

Test script:
---------------
$ curl localhost

==> access.log
::1 - - [26/Apr/2013:16:54:52 +0200] "GET / HTTP/1.1" 200 1665 "-"
"curl/7.27.0"

$ php -a
php > $c = curl_init('localhost');
php > curl_exec($c);

==> access.log
::1 - - [26/Apr/2013:16:53:15 +0200] "GET / HTTP/1.1" 200 1665 "-" "-"




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64723&edit=1


Thread (3 messages)

« previous php.bugs (#184541) next »