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

httr should not use "customrequest" (CURLOPT_CUSTOMREQUEST) #356

Closed
antoine-lizee opened this issue Apr 10, 2016 · 1 comment
Closed

httr should not use "customrequest" (CURLOPT_CUSTOMREQUEST) #356

antoine-lizee opened this issue Apr 10, 2016 · 1 comment

Comments

@antoine-lizee
Copy link
Contributor

This has a lot of undesired effect, including the inability of httr and rvest to properly follow redirects.

By setting here CURLOPT_CUSTOMREQUEST to "POST" or any other method instead of using CURLOPT_POST, CURLOPT_PUT ... and friends, the behavior of all the subsequent queries following the request will be modified, including the redirects.

The bug that caught me (and that I saw on SO in several obscure flavors) is to login successfully following a POST, and then crash (get a 403 or something related) following the ensued redirect, because the redirect issues a POST again instead of the ubiquitous GET. (also, see #65)

FYI, even though the RFC actually mentions that on 301, 302 and 303, the redirect method should not change, this is the default behaviour of all browsers, and of cURL as well - unless you specify the CURLOPT_POSTREDIR option, but this is another story.

@antoine-lizee
Copy link
Contributor Author

Small remark: because the customrequest option is last to be set at the request level, it's basically impossible to revert this behavior:

httr::POST(........, httr::config(customrequest = "", post = TRUE))

...will have no effect.

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

No branches or pull requests

2 participants