mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2026-10-11 19:56:37 +00:00
Handle curl_easy_reset() calls when impersonating (#44)
curl_easy_reset() may be used by an application to reset the options on a curl handle. If an app has the CURL_IMPERSONATE env var defined, then the impersonation options are automatically set in curl_easy_init() but will be cleared in a call to curl_easy_reset(). The desired behavior is for the impersonation options to be retained (as they are "transparent" to the user), which this commit takes care of. Note that this only has an effect when libcurl-impersonate is loaded and the CURL_IMPERSONATE env var is set. Otherwise the regular behavior of resetting all the handle options is retained. Test that the unique TLS signature of curl-impersonate is preserved after a call to curl_easy_reset() when libcurl-impersonate is loaded. For this purpose change the 'minicurl' testing util to support multiple URLs and launch it with 2 different URLs when testing the TLS signature.
This commit is contained in:
@@ -97,7 +97,11 @@ Note that if you call `curl_easy_setopt()` later with one of the above it will o
|
||||
```bash
|
||||
LD_PRELOAD=/path/to/libcurl-impersonate.so CURL_IMPERSONATE=chrome98 my_app
|
||||
```
|
||||
The `CURL_IMPERSONATE` env var will cause `curl_easy_impersonate()` to be called automatically for any new curl handle created by `curl_easy_init()`.
|
||||
The `CURL_IMPERSONATE` env var has two effects:
|
||||
* `curl_easy_impersonate()` is called automatically for any new curl handle created by `curl_easy_init()`.
|
||||
* `curl_easy_impersonate()` is called automatically after any `curl_easy_reset()` call.
|
||||
|
||||
This means that all the options needed for impersonation will be automatically set for any curl handle.
|
||||
|
||||
Note that the above will NOT WORK for `curl` itself because the curl tool overrides the TLS settings. Use the wrapper scripts instead.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user