Skip to content

redirect_uri vs added / #646

@jonthegeek

Description

@jonthegeek

httr2 (via curl::curl_parse_url(), which in turn is inheriting this behavior from C) always uses a minimum of "/" for the path now. That's almost always ok, but it caused a token request to fail for me via normalize_redirect_uri(), when "http://127.0.0.1:8888" (a path specified for that client) was normalized to "http://127.0.0.1:8888/" (which the client did not recognize). For this particular use-case I was able to patch in a fix by using sub("/$", "", url_build(parsed)) as the uri, but that feels hacky.

I can't think of a situation other than redirect_uri where this really matters. I also ran into it yesterday in a test (the req$url now always has the trailing / for httr2 1.1+ and previously lacked it, which caused a macos CI test to fail when it wasn't caught up with the other OSs yet), but that didn't feel like a big deal. The redirect one prevented me from refreshing a token until I patched it, though.

This kind of should be fixed at the curl level, but I wouldn't always consider this "broken", so I think normalize_redirect_uri is probably the best place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions