rfc:curl_user_agent

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rfc:curl_user_agent [2021/06/25 13:52] – created paresyrfc:curl_user_agent [2021/07/08 09:55] (current) paresy
Line 1: Line 1:
-====== PHP RFC: Your Title Here ======+====== PHP RFC: Default User-Agent for cURL======
   * Version: 1.0   * Version: 1.0
   * Date: 2021-06-25   * Date: 2021-06-25
   * Author: Michael Maroszek (maroszek@gmx.net)   * Author: Michael Maroszek (maroszek@gmx.net)
 +  * Proposed Version: PHP 8.2
   * Status: Under Discussion   * Status: Under Discussion
   * First Published at: http://wiki.php.net/rfc/curl_user_agent   * First Published at: http://wiki.php.net/rfc/curl_user_agent
Line 8: Line 9:
  
 ===== Introduction ===== ===== Introduction =====
-PHP had a user_agent php.ini entry for decades, which would be used as a default value. But it would only be considered for stream based operations like file_get_contents. This RFC proposes a new user_agent php.ini for cURL which would also allow setting a default user_agent for all cURL request. This would benefit in better consistency for settings a default user_agent. Also this feature is very useful in a SAPI context, which i will illustrate later.+PHP has a user_agent php.ini entry for decades, which can be set as a default value. But it is considered for stream based operations like file_get_contents. This RFC proposes a new curl.user_agent php.ini entry which would allow setting a default user_agent for all cURL request. This would benefit in better consistency for setting a default user_agent. This feature will mainly be used in a SAPI context in my use-case, which i will illustrate later.
  
 ===== Proposal ===== ===== Proposal =====
Line 22: Line 23:
  
 ===== RFC Impact ===== ===== RFC Impact =====
 +
 ==== To SAPIs ==== ==== To SAPIs ====
-This feature is especially useful for SAPI usage, as it allows a default header for all HTTP requests (independently if stream based or cURL based) that will allow the remote side to detect the application. At the moment you need to have a workflow or a wrapper that will ensure that the User-Agent is set.+This feature is especially useful for SAPI usage, as it allows a default header for all HTTP requests (independently if stream based or cURL based) that will allow the remote side to detect the application. At the moment you need to have a workflow or a wrapper that will ensure that the User-Agent is set for all streams and cURL requests. In our use-case the user is also allowed to create PHP scripts by himself. In this situation the user will most probably not set the User-Agent at all, but rely on the defaults.
  
 ==== To Existing Extensions ==== ==== To Existing Extensions ====
Line 38: Line 40:
  
 ===== Open Issues ===== ===== Open Issues =====
-No issues left.+Discussion if the ini visibility should be PHP_INI_ALL or PHP_INI_SYSTEM 
 +https://github.com/php/php-src/pull/6834/files#r628774432
  
 ===== Unaffected PHP Functionality ===== ===== Unaffected PHP Functionality =====
Line 47: Line 50:
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
-At the moment the php.ini option is placed inside the curl section. +At the moment the php.ini option is proposed inside the curl section. If the discussion should not end unanimously we should consider adding a voting option if the curl section or the global section should be targeted for the user_agent entry.
  
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
-Links to any external patches and tests go here. +Tests are included in the following PR.
- +
-If there is no patch, make it clear who will create a patch, or whether a volunteer to help with implementation is needed. +
- +
-Make it clear if the patch is intended to be the final patch, or is just a prototype. +
- +
-For changes affecting the core language, you should also provide a patch for the language specification.+
  
 ===== Implementation ===== ===== Implementation =====
rfc/curl_user_agent.1624629168.txt.gz · Last modified: 2021/06/25 13:52 by paresy