-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set compression to curl defaults #495
Conversation
@@ -183,7 +183,6 @@ static CURL* createEasy(tr_session* s, struct tr_web* web, struct tr_web_task* t | |||
task->timeout_secs = getTimeoutFromURL(task); | |||
|
|||
curl_easy_setopt(e, CURLOPT_AUTOREFERER, 1L); | |||
curl_easy_setopt(e, CURLOPT_ENCODING, "gzip;q=1.0, deflate, identity"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of unconditionally refusing to accept compressed responses, I'd rather check whether curl_version_info() indicates support for CURL_VERSION_LIBZ
feature. Obsiously, not on each and every request :)
ref: https://trac.transmissionbt.com/changeset/8658 curl_easy_setopt(e, CURLOPT_ENCODING, ""); |
Isn't curl_easy_setopt(e, CURLOPT_ENCODING, ""); a default setting? |
@neheb Looking at source for curl-7.58.0 configure defines HAVE_LIBZ content_encoding.c
|
So the default is whatever is supported by curl. What's the point in manually specifying it then. Or even doing checks? |
@neheb According to latest doc from libcurl https://curl.haxx.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html, in default the encoding is NULL which means not sending an Accept-Encoding header. In most cases, it works well except for some weird servers arbitrarily sending compressed data if no Accept-Encoding. |
While zlib is mandatory for transmission, it is not mandatory for curl. A libcurl that has been compiled with no support for zlib will return no data if compressed responses are set to on. In the basic case this prevents the port checking functionality from working properly. It also prevents web seeding from working as well.
Nice and clean. I like it. Force pushed a new commit. This has the side benefit of also supporting brotli compression if curl is compiled with it. |
@mikedld any complaints? I feel that there's no point to doing LIBZ checks since curl does it anyway. |
@neheb
Tested each way. The results are as follows
|
that's exactly what i force pushed... |
OK, sorry, looks good. I didn't see that. |
both transmission's remote.c and show.c already are using
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. I didn't dive into the documentation deep enough when I suggested to add a feature check ;)
Thanks for the input @cfpp2p, as always! |
While zlib is mandatory for transmission, it is not mandatory for curl.
A libcurl that has been compiled with no support for zlib will return no data if compressed responses are set to on.
In the basic case this prevents the port checking functionality from working properly. It also prevents web seeding from working as well.