Skip to content

core: Do not offer 'h2' via Upgrade on TLS connections. - #836

Open
arturobernalg wants to merge 2 commits into
apache:trunkfrom
arturobernalg:fix/httpd-59311-h2-upgrade-tls
Open

arturobernalg wants to merge 2 commits into
apache:trunkfrom
arturobernalg:fix/httpd-59311-h2-upgrade-tls

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

RFC 9113 section 3.3 requires HTTP/2 over TLS to be negotiated exclusively via ALPN. httpd currently announces "Upgrade: h2" to HTTP/1.1 clients on TLS connections, which violates that.

server/protocol.c (ap_get_protocol_upgrades): exclude 'h2' from the Upgrade header when the connection is TLS. Test updated (test_103_upgrade.py, test_h2_103_06) and changes-entries added.

This restores the fix from r1740075 (2016), reverted in r1748591 only for lack of a 2.4.x backport, not for being incorrect.

Tested locally: make check-pytest PYTEST_DIRS=test/modules/http2 passes for the affected test.

PR: 59311

* server/protocol.c (ap_get_protocol_upgrades): Exclude 'h2' from the
  list of protocols announced in the Upgrade response header when the
  connection is already using TLS.  RFC 9113 section 3.3 requires
  HTTP/2 over TLS to be negotiated exclusively via ALPN; offering 'h2'
  through the HTTP/1.1 Upgrade mechanism on TLS is a protocol
  violation that some clients handle poorly.

* test/modules/http2/test_103_upgrade.py (test_h2_103_06): Update to
  assert the corrected behaviour.

* changes-entries/h2-upgrade-tls.txt: Add entry.

This restores the fix from r1740075 (2016), reverted in r1748591 only
for lack of a 2.4.x backport, not for being incorrect.

PR: 59311
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.

1 participant