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

http2 core module support #7

Open
silverwind opened this issue Aug 19, 2020 · 2 comments · May be fixed by #8
Open

http2 core module support #7

silverwind opened this issue Aug 19, 2020 · 2 comments · May be fixed by #8

Comments

@silverwind
Copy link
Contributor

http2 has different semantics for communicating the host header. In http a simple request results in these req.headers:

{
  host: 'localhost:5000'
}

while in http2 it is:

[Object: null prototype] {
  ':method': 'GET',
  ':path': '/',
  ':scheme': 'https',
  ':authority': 'localhost:5000'
}

So for minimum support, :authority could be used instead of host. It may be worth considering using :path and :scheme as well but I guess that info is probably just duplicate with req.url or req.secure.

silverwind added a commit to silverwind/original-url that referenced this issue Oct 6, 2020
Add support for node code http2 in compatibility mode. Differences:

- req.secure is replaced by req.scheme
- req.headers.host is replaced by req.headers['authority']

Fixes: watson#7
@silverwind silverwind linked a pull request Oct 6, 2020 that will close this issue
silverwind added a commit to silverwind/original-url that referenced this issue Oct 6, 2020
Add support for node code http2 in compatibility mode. Differences:

- req.secure is replaced by req.scheme
- req.headers.host is replaced by req.headers['authority']

Fixes: watson#7
silverwind added a commit to silverwind/original-url that referenced this issue Oct 6, 2020
Add support for node code http2 in compatibility mode. Differences:

- req.secure is replaced by req.scheme
- req.headers.host is replaced by req.headers['authority']

Fixes: watson#7
@david-luna
Copy link

Hi,

I guess here we can follow the progressive enhancement approach. So we use http2 headers when present and fallback to the current behavior for backwards compatibility and non http2 requests.

@silverwind
Copy link
Contributor Author

#8 does it the other way around, it first checks for host and then for :authority. Should not matter because both can probably never appear at the same time.

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 a pull request may close this issue.

2 participants