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

Comments

Projects
None yet
3 participants
@billdenney

billdenney commented Sep 7, 2018

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment