From d8a44dfbd20a87f61bb9dea122d53c30654389ca Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Wed, 3 Dec 2014 04:06:59 -0800 Subject: [PATCH] Alternate-Protocol is a hop-by-hop header Google are pushing Alternate-Protocol header to arbitrarily move clients from HTTP to their experimental and proprietary protocols. When relayed through a proxy this can cause traffic bifurcation with side effects ranging from client visible failures, to traffic increase on the network as proxy caching is bypassed, to security vulnerabilities or privacy information leaks over the experimental protocol. By treating the Alternate-Protocol header as a hop-by-hop header only relevant on client->origin connections we can both prevent the above issues occuring on networks utilizing a proxy, and also participate in the protocol exprimentation process ourselves. --- src/HttpHeader.cc | 2 ++ src/HttpHeader.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 8105063ef4..27c4f8535c 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -87,6 +87,7 @@ static const HttpHeaderFieldAttrs HeadersAttrs[] = { {"Accept-Ranges", HDR_ACCEPT_RANGES, ftStr}, {"Age", HDR_AGE, ftInt}, {"Allow", HDR_ALLOW, ftStr}, + {"Alternate-Protocol", HDR_ALTERNATE_PROTOCOL, ftStr}, {"Authorization", HDR_AUTHORIZATION, ftStr}, /* for now */ {"Cache-Control", HDR_CACHE_CONTROL, ftPCc}, {"Connection", HDR_CONNECTION, ftStr}, @@ -266,6 +267,7 @@ static http_hdr_type RequestHeadersArr[] = { static HttpHeaderMask HopByHopHeadersMask; static http_hdr_type HopByHopHeadersArr[] = { + HDR_ALTERNATE_PROTOCOL, HDR_CONNECTION, HDR_HTTP2_SETTINGS, HDR_KEEP_ALIVE, /*HDR_PROXY_AUTHENTICATE,*/ HDR_PROXY_AUTHORIZATION, HDR_TE, HDR_TRAILER, HDR_TRANSFER_ENCODING, HDR_UPGRADE, HDR_PROXY_CONNECTION }; diff --git a/src/HttpHeader.h b/src/HttpHeader.h index 8681d1aaca..c86d17cf1d 100644 --- a/src/HttpHeader.h +++ b/src/HttpHeader.h @@ -57,6 +57,7 @@ typedef enum { HDR_ACCEPT_RANGES, /**< RFC 2608, 2616 */ HDR_AGE, /**< RFC 2608, 2616 */ HDR_ALLOW, /**< RFC 2608, 2616 */ + HDR_ALTERNATE_PROTOCOL, /**< GFE custom header we may have to erase */ /*HDR_ALTERNATES,*/ /* deprecated RFC 2068, 2295 */ HDR_AUTHORIZATION, /**< RFC 2608, 2616, 4559 */ HDR_CACHE_CONTROL, /**< RFC 2608, 2616 */ -- 2.47.2