lwthiker / curl-impersonate

curl-impersonate: A special build of curl that can impersonate Chrome & Firefox
MIT License
3.46k stars 229 forks source link

Allow disabling built-in HTTP headers #94

Closed lwthiker closed 1 year ago

lwthiker commented 1 year ago

Let the user disable the built-in list of HTTP headers when using libcurl-impersonate, either directly or when replacing it at runtime with LD_PRELOAD. This is intended to give the user more precise control over the content and order of the HTTP headers.

To support this, the curl_easy_impersonate() now has an added argument that can be set to 0, in which case the built-in list of HTTP headers used by libcurl-impersonate will not be automatically sent. Instead, the user is expected to supply all the headers by themselves using the standard CURLOPT_HTTPHEADER libcurl option.

When using LD_PRELOAD to inject libcurl-impersonate, one can disable the built-in headers by setting the CURL_IMPERSONATE_HEADERS environment variable to "no".

Fixes #90. Please note: This PR changes the signature of the curl_easy_impersonate() function. I'm not aware of anyone using this function directly right now. If you rely on it such that it can't be changed, please let me know.