Skip to content
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

Fix HEAD requests with a body on libcurl 7.70+ #213

Merged
merged 1 commit into from
Jul 25, 2020

Conversation

sagebind
Copy link
Owner

@sagebind sagebind commented Jul 23, 2020

libcurl 7.71.0 introduced a breaking change that caused the order in which CURLOPT_NOBODY and CURLOPT_UPLOAD are set to matter. Previously we were setting CURLOPT_UPLOAD first and then CURLOPT_NOBODY when the user wishes to make a HEAD request with a request body.

Change the order of operations such that the response body is still ignored, but the internal request type is still PUT.

Fixes #214.

libcurl 7.70.0 introduced a breaking change that caused the order in which `CURLOPT_NOBODY` and `CURLOPT_UPLOAD` are set to matter. Previously we were setting `CURLOPT_UPLOAD` first and then `CURLOPT_NOBODY` when the user wishes to make a HEAD request with a request body. In libcurl 7.70+, `CURLOPT_NOBODY` implicitly changes the internal request type back to a normal HEAD request with no body, undoing the previous `CURLOPT_UPLOAD` call.

Change the order of operations such that the response body is still ignored, but the internal request type is still PUT.

See curl/curl@9c845be#diff-72ee0eef31d053c9e6d4fb22e81d2407
@codecov
Copy link

codecov bot commented Jul 23, 2020

Codecov Report

Merging #213 into master will decrease coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #213      +/-   ##
==========================================
- Coverage   69.63%   69.52%   -0.11%     
==========================================
  Files          33       33              
  Lines        1867     1867              
==========================================
- Hits         1300     1298       -2     
- Misses        567      569       +2     
Impacted Files Coverage Δ
src/client.rs 62.34% <100.00%> (ø)
src/cookies/psl/mod.rs 83.33% <0.00%> (-2.39%) ⬇️
src/auth.rs 59.37% <0.00%> (-1.57%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be3912d...1f4bbf3. Read the comment docs.

@sagebind sagebind marked this pull request as ready for review July 23, 2020 19:03
@sagebind sagebind merged commit 4ec81c0 into master Jul 25, 2020
@sagebind sagebind deleted the fix-head-body-regression branch July 25, 2020 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HEAD requests with a body break or hang under libcurl 7.71.0+
1 participant