forked from rack/rack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve
Rack::Request#authority
and related methods.
With IPv6, any time we have a string which represents an authority, as defined by RFC7540, the address must be contained within square brackets, e.g.: "[2020::1985]:443". Representations from the `host` header and `authority` pseudo-header must conform to this format. Some headers, notably `x-forwarded-for` and `x-forwarded-host` do not format the authority correctly. So we introduce a private method `wrap_ipv6` which uses a heuristic to detect these situations and fix the formatting. Additionally, we introduce some new assertions in `Rack::Lint` to ensure SREVER_NAME and HTTP_HOST match the formatting requirements.
- Loading branch information
Showing
3 changed files
with
143 additions
and
74 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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