★ wanayoo — archive 1999 https://github.com/javaee-samples/javaee7-samples/pull/461Nouvelle recherche | Portail wanayoo
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

fix the test for HTTP protocol upgrade #461

Merged
merged 1 commit into from May 7, 2020

Conversation

@Ladicek
Copy link
Contributor

Ladicek commented May 7, 2020

If the HTTP client wants to request protocol upgrade, it must
send the Upgrade header. It should also set the Connection
header. This test didn't do that, so conforming implementations
could reject the request.upgrade() call. The fix is simple:
add the 2 headers on the client side (i.e., in the test).

To be able to set Connection and Upgrade headers on the
java.net.HttpURLConnection, restricted headers must be allowed
by setting a special system property.

See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism
and the Servlet specification 4.0, section 2.3.3.5.

If the HTTP client wants to request protocol upgrade, it must
send the `Upgrade` header. It should also set the `Connection`
header. This test didn't do that, so conforming implementations
could reject the `request.upgrade()` call. The fix is simple:
add the 2 headers on the client side (i.e., in the test).

To be able to set `Connection` and `Upgrade` headers on the
`java.net.HttpURLConnection`, restricted headers must be allowed
by setting a special system property.

See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism
and the Servlet specification 4.0, section 2.3.3.5.
@arjantijms
Copy link
Contributor

arjantijms commented May 7, 2020

Nice!

@arjantijms arjantijms merged commit 7471ec9 into javaee-samples:master May 7, 2020
1 check was pending
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@Ladicek Ladicek deleted the Ladicek:protocol-upgrade-fix branch May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.