Skip to content

Encode square brackets in path segments#9410

Open
eyupcanakman wants to merge 1 commit intosquare:masterfrom
eyupcanakman:fix/encode-square-brackets-in-path-segments
Open

Encode square brackets in path segments#9410
eyupcanakman wants to merge 1 commit intosquare:masterfrom
eyupcanakman:fix/encode-square-brackets-in-path-segments

Conversation

@eyupcanakman
Copy link
Copy Markdown

HttpUrl.Builder.addPathSegment() and setPathSegment() did not percent-encode [ and ] in path segments. RFC 3986 section 3.3 reserves brackets for IPv6 literals in the authority component, so they should be percent-encoded when they appear in path segments.

Added a PATH_SEGMENT_ENCODE_SET_RAW constant that includes [] and applied it to raw-input methods (addPathSegment, addPathSegments, setPathSegment). addEncodedPathSegment(), setEncodedPathSegment(), and URL parsing preserve literal brackets as before.

Fixes #6790

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.

HttpUrl#addPathSegment does not encode square brackets '[', ']

1 participant