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
URLs without protocol causes error in windows but not linux #619
Comments
I think this is an issue with This is with curl 4.2. On rstudio cloud, with R 3.6.0 library(curl)
url <- "www.ndexbio.org/v2/admin/status"
h <- new_handle()
resp <- curl_fetch_memory(url, handle = h)
resp$url
#> [1] "http://www.ndexbio.org/v2/admin/status" Created on 2019-10-14 by the reprex package (v0.3.0) With Windows 10, on my computer, library(curl)
url <- "www.ndexbio.org/v2/admin/status"
h <- new_handle()
resp <- curl_fetch_memory(url, handle = h)
resp$url
#> [1] "www.ndexbio.org/v2/admin/status" Created on 2019-10-14 by the reprex package (v0.3.0) As you see, the http is added in the result on linux, but not on windows. |
I did further tests on windows and I found that it worked with curl 3.3 but not with curl 4.0. |
I have just also realise that this is a duplicate of #607 |
hi, i must be missing something, because i can't see how this error could be caused by curl. https://github.com/r-lib/httr/blob/master/R/url.r#L38-L48 then https://github.com/r-lib/httr/blob/master/R/request.R#L159-L161 trivial fix is for happy to submit a PR. cheers |
You spotted the right lines, but Line 148 in 6b84c57
hence the hint on curl behavior. There was a change of behavior in curl 4.0 on windows. Before, the scheme was added by curl itself ( req$url has no scheme, resp$url has a scheme), from 4.0 it wasn't. On linux, it is still the case, the scheme is added. Having a different behavior on windows and linux is not ideal.
However, I completely agree that a fix could be done in httr directly by handling missing scheme before doing It possible that the curl behavior is now intented and a fix must be suggested here. |
From a comment from curl developer in jeroen/curl#209 (comment), it seems it could be a regression |
This is now fixed in last dev version of curl. See the issue there. |
it would still be good to merge #620 though ... the lag between fixes and them arriving in debian/ubuntu distros is often very long. the ubuntu LTS, for example, will probably never receive that update. |
I got a different behavior using httr in windows and in linux. It apeared first time at the end of August on the automatic build of my bioconductor package (ndexr).
It seems that omitting the protocol in the url causes an error on windows machines since:
linux or mac os are not affected.
The text was updated successfully, but these errors were encountered: