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

HTTPCORE-770: Add plusAsBlank parameter to URIBuilder for dynamic configuration #481

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

arturobernalg
Copy link
Member

This PR introduces a new plusAsBlank flag to the URIBuilder class, allowing users to dynamically configure whether the '+' character in query parameters should be interpreted as a space (' ') or remain as a plus ('+').

@garydgregory
Copy link
Member

I'm not sure about creating a special case for a single character. Maybe registering a Map would be more flexible. I'm not sure what should be allowed to be mapped though.

@arturobernalg
Copy link
Member Author

I'm not sure about creating a special case for a single character. Maybe registering a Map would be more flexible. I'm not sure what should be allowed to be mapped though.

HI @garydgregory
As far as I understand, according to RFC3986, spaces in URIs should be encoded as %20, and the + character is not treated as a space. Introducing a map would add unnecessary complexity since only + is treated this way in form encoding. Now, on second thought, it may be incorrect to allow users to change the plusAsBlank value. I'm not sure anymore.

@ok2c
Copy link
Member

ok2c commented Sep 15, 2024

Now, on second thought, it may be incorrect to allow users to change the plusAsBlank value. I'm not sure anymore.

@arturobernalg This behavior is non-conformant but it is wide-spread and very common. This is a case where we ought to be lenient.

  1. There is no need to have a special constructor for this flag. Just a setter should suffice.
  2. Please add @since 5.4

…ation

- Added `plusAsBlank` flag to `URIBuilder` to dynamically configure whether '+' should be interpreted as a space in query parameters.
- Implemented `setPlusAsBlank` method to update the flag and re-parse the query accordingly.
@ok2c ok2c merged commit aec14c4 into apache:master Sep 16, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

3 participants