add php.ini entry to set default user_agent for curl

From: Date: Thu, 08 Apr 2021 12:41:05 +0000
Subject: add php.ini entry to set default user_agent for curl
Groups: php.internals 
Request: Send a blank email to internals+get-114001@lists.php.net to get a copy of this message
Dear Internals,
I'd like to suggest a new enhancement for 8.1 as outlined in the title.

The initial pull request is here:
https://github.com/php/php-src/pull/6834/files

--- Details:
Since quite a while PHP offers a dedicated user_agent php.ini entry, but it
affects only all internal implementations like file_get_contents. cURL has
no default and you need to modify CURLOPT_USERAGENT in the code and for the
SoapClient there is a parameter 'user-agent' in the constructor which can
be set.

Therefore I'd like to introduce an equal entry for curl.user_agent which
would set a default user_agent when making curl requests. Of course you can
override it with CURLOPT_USERAGENT if required. (I can implement the same
for SoapClient, if requested)

--- Alternative:
I could also use the default user_agent entry, but I wasn't sure what the
best practise is and went for the more "local" approach for the initial
implementation.

--- Bigger picture:
When the preferred solution is to use the default user_agent, we could also
try to determine more places where i could send the default user_agent to
give this php.ini entry a more consistent feeling.

Thanks for your consideration,
Michael

PS: Subscribing to the list through https://www.php.net/mailing-lists.php is
not possible and quits with the following error: We were unable to
subscribe you due to some technical problems. Please try again later.


Thread (4 messages)

« previous php.internals (#114001) next »