Repository navigation
Conversation
httpAssembleURI() only recognized bare IPv6 addresses. A host that is already in brackets, such as the "[2001:db8::1]" that cupsd takes from the Host: header, went to the reg-name branch and was percent-encoded, so printer-uri-supported and friends came back as "ipp://%5B2001%3Adb8%3A%3A1%5D:631/...". Copy a bracketed IP-literal as-is, as the existing comment says, and add tests.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
httpAssembleURI() percent-encodes a host that is an IPv6 address literal in brackets:
The comment says a bracketed IPv6 address is assumed to be in URI form already, but the code
only recognizes a bare address (hex digits and ':'), so a host starting with '[' goes to the
reg-name branch and gets '[', ':' and ']' percent-encoded.
I ran into this with cupsd 2.x: it passes the host from the Host: header, brackets included,
so a client that connects to an IPv6 address gets back
From reading the code I think PAPPL does the same with client->host_field (printer icons,
web links, the redirect to https), but I haven't tested that.
This change copies a host of the form "[...]" as-is, as long as the part inside the
brackets only has characters that can appear in an IP-literal (alphanumerics and
"-._~:%+"). Anything else, e.g. "[::1]/x" or an unterminated "[::1", still goes through the
reg-name encoding as before. Bare IPv6 addresses are handled as before.
Testing:
passes with it. The existing tests still pass.
The same code is in CUPS 2.x (cups/http-support.c), and this patch applies there unchanged.