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

Warning when downloading from FTP #537

Closed
billdenney opened this issue Sep 7, 2018 · 3 comments
Closed

Warning when downloading from FTP #537

billdenney opened this issue Sep 7, 2018 · 3 comments

Comments

@billdenney
Copy link

When downloading from FTP, no http status should be expected (or maybe one should be imputed based on the results of the download), but there is a warning when trying to parse it:

> GET("ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/DVS/natality/Nat2015ps.zip")
Warning in parse_http_status(lines[[1]]) :
  NAs introduced by coercion to integer range
Warning: Failed to parse headers:
229 Entering Extended Passive Mode (|||64946|)
213 1255090
125 Data connection already open; Transfer starting.
226 Transfer complete.

Response [ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/DVS/natality/Nat2015ps.zip]
  Date: 2018-09-07 16:45
  Status: 226
  Content-Type: <unknown>
  Size: 1.26 MB
<BINARY BODY>
> 
@cderv
Copy link
Contributor

cderv commented Sep 8, 2018

I think it is because httr 📦 is not made to support ftp. However no warning or error is thrown to inform about that. If this is a deliberate choice for httr to not support ftp, a message could be added 🤔

To download from ftp, I would rely directly on curl

res <- curl::curl_download("ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/DVS/natality/Nat2015ps.zip", destfile = tempfile())

or base download.file...

@billdenney
Copy link
Author

billdenney commented Sep 8, 2018

Could a more informative warning be provided then like: “httr does not parse headers unless the transport is http or https.”? And in cases other than http/https, make no attempt to parse the header, since it's unsupported.

... With two kids underfoot, I only partially read your response. Yes, a more informative warning would be helpful for times using ftp (or gopher or ... protocols).

@hadley
Copy link
Member

hadley commented Nov 21, 2018

There's no support for ftp in httr. A more informative error message is not high priority because I don't think this is a common source of confusion because httr is clearly branded around http. (But I'd happily review a PR if one was provided)

@hadley hadley closed this as completed Nov 21, 2018
billdenney added a commit to billdenney/httr that referenced this issue Nov 25, 2018
hadley added a commit that referenced this issue Dec 4, 2018
gpompeo added a commit to gpompeo/lodown that referenced this issue Nov 13, 2019
changing filesize_fun to fix download from FTP considering that httr is not supposed to work with ftp (r-lib/httr#537)
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

3 participants