Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Depends:
R (>= 4.1)
Imports:
cli (>= 3.0.0),
curl (>= 6.2.1),
curl (>= 6.4.0),
glue,
lifecycle,
magrittr,
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# httr2 (development version)

* URL construction is now powered by `curl::curl_modify_url()`, and hence now (correctly) escapes the `path` component (#732). This means that `req_url_path()` now can only affect the path component of the URL, not the query params or fragment.
* Redacted headers are no longer serialized to disk. This is important since it makes it harder to accidentally leak secrets to files on disk, but comes at a cost: you can longer perform such requests that have been saved and reloaded (#721).
* New `req_get_method()` and `req_get_body()` allow you to do some limited prediction of what a request _will_ do when it's performed (#718).
* Functions that capture interrutps (like `req_perform_parallel()` and friends) are now easier to escape if they're called inside a loop: you can press Ctrl + C twice to guarantee an exit (#1810).
Expand Down
3 changes: 2 additions & 1 deletion R/resp-url.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#' @export
#' @examples
#' resp <- request(example_url()) |>
#' req_url_path("/get?hello=world") |>
#' req_url_path("/get") |>
#' req_url_query(hello = "world") |>
#' req_perform()
#'
#' resp |> resp_url()
Expand Down
49 changes: 13 additions & 36 deletions R/url.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ url_parse <- function(url, base_url = NULL) {
check_string(url)
check_string(base_url, allow_null = TRUE)

curl <- curl::curl_parse_url(url, baseurl = base_url, decode = FALSE)
curl <- curl::curl_parse_url(url, baseurl = base_url)

parsed <- list(
scheme = curl$scheme,
Expand Down Expand Up @@ -267,44 +267,21 @@ url_build <- function(url) {
stop_input_type(url, "a parsed URL")
}

if (!is.null(url$query)) {
query <- url_query_build(url$query)
if (length(url$query) == 0) {
query <- ""
} else {
query <- NULL
query <- I(url_query_build(url$query))
}

if (is.null(url$username) && is.null(url$password)) {
user_pass <- NULL
} else if (is.null(url$username) && !is.null(url$password)) {
cli::cli_abort("Cannot set url {.arg password} without {.arg username}.")
} else if (!is.null(url$username) && is.null(url$password)) {
user_pass <- paste0(url$username, "@")
} else {
user_pass <- paste0(url$username, ":", url$password, "@")
}

if (!is.null(user_pass) || !is.null(url$hostname) || !is.null(url$port)) {
authority <- paste0(user_pass, url$hostname)
if (!is.null(url$port)) {
authority <- paste0(authority, ":", url$port)
}
} else {
authority <- NULL
}

if (is.null(url$path) || !startsWith(url$path, "/")) {
url$path <- paste0("/", url$path)
}

prefix <- function(prefix, x) if (!is.null(x)) paste0(prefix, x)
paste0(
url$scheme,
if (!is.null(url$scheme)) ":",
if (!is.null(url$scheme) || !is.null(authority)) "//",
authority,
url$path,
prefix("?", query),
prefix("#", url$fragment)
curl::curl_modify_url(
scheme = url$scheme,
host = url$hostname,
user = url$username,
password = url$password,
port = url$port,
path = url$path,
query = query,
fragment = url$fragment
)
}

Expand Down
3 changes: 2 additions & 1 deletion man/resp_url.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions revdep/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# Revdeps

## Failed to check (3)
## Failed to check (1)

|package |version |error |warning |note |
|:----------|:-------|:-----|:-------|:----|
|GeoTox |? | | | |
|insight |? | | | |
|parameters |? | | | |
|package |version |error |warning |note |
|:------------|:-------|:-----|:-------|:----|
|arcgisplaces |0.1.2 |1 | | |

## New problems (6)

|package |version |error |warning |note |
|:-------------|:-------|:------|:-------|:----|
|[atrrr](problems.md#atrrr)|0.1.0 |__+1__ | | |
|[httptest2](problems.md#httptest2)|1.1.0 |__+1__ | | |
|[osmapiR](problems.md#osmapir)|0.2.3 |__+2__ | | |
|[planscorer](problems.md#planscorer)|0.0.2 |__+1__ | | |
|[spanishoddata](problems.md#spanishoddata)|0.2.0 |__+1__ | | |
|[tidyllm](problems.md#tidyllm)|0.3.4 |__+1__ | | |

31 changes: 26 additions & 5 deletions revdep/cran.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
## revdepcheck results

We checked 201 reverse dependencies (200 from CRAN + 1 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package.
We checked 221 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 2 packages
* We saw 6 new problems
* We failed to check 1 packages

Issues with CRAN packages are summarised below.

### New problems
(This reports the first line of each new failure)

* atrrr
checking tests ... ERROR

* httptest2
checking tests ... ERROR

* osmapiR
checking examples ... ERROR
checking tests ... ERROR

* planscorer
checking tests ... ERROR

* spanishoddata
checking tests ... ERROR

* tidyllm
checking tests ... ERROR

### Failed to check

* insight (NA)
* parameters (NA)
* arcgisplaces (NA)
Loading