{"action":"created","issue":{"url":"https://api.github.com/repos/ropensci/crul/issues/91","repository_url":"https://api.github.com/repos/ropensci/crul","labels_url":"https://api.github.com/repos/ropensci/crul/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/ropensci/crul/issues/91/comments","events_url":"https://api.github.com/repos/ropensci/crul/issues/91/events","html_url":"https://github.com/ropensci/crul/issues/91","id":357691142,"node_id":"MDU6SXNzdWUzNTc2OTExNDI=","number":91,"title":"Head Fails on FTP Requests When the File Doesn't Exist","user":{"login":"billdenney","id":10359931,"node_id":"MDQ6VXNlcjEwMzU5OTMx","avatar_url":"https://avatars1.githubusercontent.com/u/10359931?v=4","gravatar_id":"","url":"https://api.github.com/users/billdenney","html_url":"https://github.com/billdenney","followers_url":"https://api.github.com/users/billdenney/followers","following_url":"https://api.github.com/users/billdenney/following{/other_user}","gists_url":"https://api.github.com/users/billdenney/gists{/gist_id}","starred_url":"https://api.github.com/users/billdenney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billdenney/subscriptions","organizations_url":"https://api.github.com/users/billdenney/orgs","repos_url":"https://api.github.com/users/billdenney/repos","events_url":"https://api.github.com/users/billdenney/events{/privacy}","received_events_url":"https://api.github.com/users/billdenney/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-09-06T14:48:04Z","updated_at":"2018-09-20T07:56:29Z","closed_at":null,"author_association":"NONE","body":"For `fb$head()` below, I expected to get a response object back that indicates the file doesn't exist and not an error.  The same is true for `fb$get()`\r\n\r\n``` r\r\nlibrary(crul)\r\nurl_choices <- list(\r\n  HTTP=list(\r\n    good=\"https://github.com/ropensci/crul\",\r\n    bad=\"https://github.com/ropensci/crul/not_a_good_url\"\r\n  ),\r\n  FTP=list(\r\n    good=\"ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/DVS/natality/Nat1970.zip\",\r\n    bad=\"ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/DVS/natality/foo\"\r\n  )\r\n)\r\n\r\nhg <- HttpClient$new(url=url_choices$HTTP$good)\r\nhb <- HttpClient$new(url=url_choices$HTTP$bad)\r\nfg <- HttpClient$new(url=url_choices$FTP$good)\r\nfb <- HttpClient$new(url=url_choices$FTP$bad)\r\n\r\nhg$head()\r\n#> <crul response> \r\n#>   url: https://github.com/ropensci/crul\r\n#>   request_headers: \r\n#>     User-Agent: libcurl/7.59.0 r-curl/3.2 crul/0.6.0\r\n#>   response_headers: \r\n#>     status: HTTP/1.1 200 OK\r\n#>     server: GitHub.com\r\n#>     date: Thu, 06 Sep 2018 14:47:46 GMT\r\n#>     content-type: text/html; charset=utf-8\r\n#>     status: 200 OK\r\n#>     cache-control: no-cache\r\n#>     vary: X-PJAX\r\n#>     set-cookie: has_recent_activity=1; path=/; expires=Thu, 06 Sep 2018 15:47:46 -0000\r\n#>     set-cookie: _octo=GH1.1.103899242.1536245266; domain=.github.com; path=/; expires=Sun, 06 Sep 2020 14:47:46 -0000\r\n#>     set-cookie: logged_in=no; domain=.github.com; path=/; expires=Mon, 06 Sep 2038 14:47:46 -0000; secure; HttpOnly\r\n#>     set-cookie: _gh_sess=M0tEUXpPMW82Y2JiZDRkSUpFTWZueXp4TUZpa3RQZzZmbEpRTCtHZFEwY213M25NYVFHTk9jZlBvTUh6RVYzdTdzRVluTHdkQlkyRnoyUTIxOE1XVzBBWDNJRXlVc2ZsLzR1K3ZjWEFaRisrRmdYa1psSlhUNU4xazlPS016SDVGb2lUZ0dIaUdielBvNVR6R0M3RFQ4SDhYZU1NSWRPaHp1eXZ5ekkwTC9ZUXo1eWVzYmVYTHMzdmVEWVFob2VxM0FuTkZkTVRKTzVUUFNmUWtUNGJLa2dCc2xFTloyRWlvSlRlZTY5bGkxMFA2Nnl5elYxRlZYUXNTNG10VkpiMi0teFdlS2phTmlnNEFSZHRjVXo1QTZzUT09--b09d86c6c8f55485e731eb1fd812dc148ae293b5; path=/; secure; HttpOnly\r\n#>     x-request-id: 4863a0f3-22e5-4512-8943-b36388ed7f50\r\n#>     x-runtime: 0.346120\r\n#>     strict-transport-security: max-age=31536000; includeSubdomains; preload\r\n#>     x-frame-options: deny\r\n#>     x-content-type-options: nosniff\r\n#>     x-xss-protection: 1; mode=block\r\n#>     expect-ct: max-age=2592000, report-uri=\"https://api.github.com/_private/browser/errors\"\r\n#>     content-security-policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com status.github.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com wss://live.github.com; font-src assets-cdn.github.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src assets-cdn.github.com; style-src 'unsafe-inline' assets-cdn.github.com\r\n#>     x-runtime-rack: 0.356144\r\n#>     content-encoding: gzip\r\n#>     x-github-request-id: EDB1:0D44:1793BB:2EECD6:5B913E12\r\n#>   status: 200\r\nhb$head()\r\n#> <crul response> \r\n#>   url: https://github.com/ropensci/crul/not_a_good_url\r\n#>   request_headers: \r\n#>     User-Agent: libcurl/7.59.0 r-curl/3.2 crul/0.6.0\r\n#>   response_headers: \r\n#>     status: HTTP/1.1 404 Not Found\r\n#>     server: GitHub.com\r\n#>     date: Thu, 06 Sep 2018 14:47:47 GMT\r\n#>     content-type: text/plain; charset=utf-8\r\n#>     status: 404 Not Found\r\n#>     cache-control: no-cache\r\n#>     vary: X-PJAX\r\n#>     set-cookie: has_recent_activity=1; path=/; expires=Thu, 06 Sep 2018 15:47:47 -0000\r\n#>     set-cookie: logged_in=no; domain=.github.com; path=/; expires=Mon, 06 Sep 2038 14:47:47 -0000; secure; HttpOnly\r\n#>     set-cookie: _gh_sess=QmVkS2d1WHJtZ21tdk1Ec0hyOEZhWjZmcDlhMXMxOXJaRlVybUtvUm5yc3lMb1JtU2pBQzNNZ2VXODc4WCtRbk5xdmlsdk1Wd0ZORmxoNWpLdGVWV0hFaERDMlcvK25UeVM4V0FqeWVYa3M9LS1Yc0lqT1MxRk9VcTdRQjJVN09HWk9nPT0%3D--f026eaf31c74402a5a0eec31885e89e7dda402e0; path=/; secure; HttpOnly\r\n#>     x-request-id: c6887a67-9836-4c42-ae0c-1db031b049b7\r\n#>     x-runtime: 0.010998\r\n#>     strict-transport-security: max-age=31536000; includeSubdomains; preload\r\n#>     x-frame-options: deny\r\n#>     x-content-type-options: nosniff\r\n#>     x-xss-protection: 1; mode=block\r\n#>     referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin\r\n#>     expect-ct: max-age=2592000, report-uri=\"https://api.github.com/_private/browser/errors\"\r\n#>     content-security-policy: default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'\r\n#>     x-runtime-rack: 0.018345\r\n#>     content-encoding: gzip\r\n#>     x-github-request-id: EDB1:0D44:1794E5:2EEEA4:5B913E13\r\n#>   status: 404\r\nfg$head()\r\n#> <crul response> \r\n#>   url: ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/DVS/natality/Nat1970.zip\r\n#>   request_headers: \r\n#>     User-Agent: libcurl/7.59.0 r-curl/3.2 crul/0.6.0\r\n#>   response_headers: \r\n#>   status: 350\r\nfb$head()\r\n#> Error in curl::curl_fetch_memory(x$url$url, handle = x$url$handle): Given file does not exist\r\nfb$get()\r\n#> Error in curl::curl_fetch_memory(x$url$url, handle = x$url$handle): Given file does not exist\r\n```\r\n\r\nCreated on 2018-09-06 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0).\r\n\r\n\r\n<!-- If this issue relates to usage of the package, whether a question, bug or similar, along with your query, please paste your devtools::session_info() or sessionInfo() into the code block below. If not, delete all this and proceed :) -->\r\n\r\n<details> <summary><strong>Session Info</strong></summary>\r\n\r\n```r\r\n> sessionInfo()\r\nR version 3.5.1 (2018-07-02)\r\nPlatform: x86_64-w64-mingw32/x64 (64-bit)\r\nRunning under: Windows >= 8 x64 (build 9200)\r\n\r\nMatrix products: default\r\n\r\nlocale:\r\n[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   \r\n[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          \r\n[5] LC_TIME=English_United States.1252    \r\n\r\nattached base packages:\r\n[1] stats     graphics  grDevices utils     datasets  methods   base     \r\n\r\nother attached packages:\r\n[1] reprex_0.2.0 crul_0.6.0  \r\n\r\nloaded via a namespace (and not attached):\r\n [1] Rcpp_0.12.18     rstudioapi_0.7   knitr_1.20       magrittr_1.5     whisker_0.3-2    devtools_1.13.6 \r\n [7] debugme_1.1.0    R6_2.2.2         rlang_0.2.2      stringr_1.3.1    tools_3.5.1      clipr_0.4.1     \r\n[13] withr_2.1.2      htmltools_0.3.6  yaml_2.2.0       digest_0.6.16    assertthat_0.2.0 rprojroot_1.3-2 \r\n[19] httpcode_0.2.0   crayon_1.3.4     processx_3.2.0   callr_3.0.0      base64enc_0.1-3  ps_1.1.0        \r\n[25] triebeard_0.3.0  curl_3.2         memoise_1.1.0    evaluate_0.11    rmarkdown_1.10   stringi_1.2.4   \r\n[31] compiler_3.5.1   urltools_1.7.1   backports_1.1.2 \r\n```\r\n</details>\r\n"},"comment":{"url":"https://api.github.com/repos/ropensci/crul/issues/comments/423080404","html_url":"https://github.com/ropensci/crul/issues/91#issuecomment-423080404","issue_url":"https://api.github.com/repos/ropensci/crul/issues/91","id":423080404,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzA4MDQwNA==","user":{"login":"billdenney","id":10359931,"node_id":"MDQ6VXNlcjEwMzU5OTMx","avatar_url":"https://avatars1.githubusercontent.com/u/10359931?v=4","gravatar_id":"","url":"https://api.github.com/users/billdenney","html_url":"https://github.com/billdenney","followers_url":"https://api.github.com/users/billdenney/followers","following_url":"https://api.github.com/users/billdenney/following{/other_user}","gists_url":"https://api.github.com/users/billdenney/gists{/gist_id}","starred_url":"https://api.github.com/users/billdenney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billdenney/subscriptions","organizations_url":"https://api.github.com/users/billdenney/orgs","repos_url":"https://api.github.com/users/billdenney/repos","events_url":"https://api.github.com/users/billdenney/events{/privacy}","received_events_url":"https://api.github.com/users/billdenney/received_events","type":"User","site_admin":false},"created_at":"2018-09-20T07:56:29Z","updated_at":"2018-09-20T07:56:29Z","author_association":"NONE","body":"I took a quick look at the ftp client, and while it looks like a direction that makes sense for ftp, I haven't found myself needing direct ftp access in that way.  (I recognize that this is my workflow-- not a general statement for its usefulness.)  Currently, my needs are more akin to \"I have a URL that I need to get a file from or put a file into.\"  For me, that is more the `libcurl`/`crul` type of interface."}}
{"actor":{"display_login":"billdenney"}}