• Brad Fitzpatrick's avatar
    net/http: allow Handlers to handle http2 upgrade PRI requests · a6557a05
    Brad Fitzpatrick authored
    The http2 spec defines a magic string which initates an http2 session:
    
        "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
    
    It was intentionally chosen to kinda look like an HTTP request, but
    just different enough to break things not ready for it. This change
    makes Go ready for it.
    
    Notably: Go now accepts the request header (the prefix "PRI *
    HTTP/2.0\r\n\r\n") as a valid request, even though it doesn't have a
    Host header. But we now mark it as "Connection: close" and teach the
    Server to never read a second request from the connection once that's
    seen. If the http.Handler wants to deal with the upgrade, it has to
    hijack the request, read out the "body", compare it against
    "SM\r\n\r\n", and then speak http2. One of the new tests demonstrates
    that hijacking.
    
    Fixes #14451
    Updates #14141 (h2c)
    
    Change-Id: Ib46142f31c55be7d00c56fa2624ec8a232e00c43
    Reviewed-on: https://go-review.googlesource.com/21327Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    a6557a05
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...