On 08/18/2010 10:09 PM, Alex Rousskov wrote:
Compliance: rename Trailers header to Trailer everywhere.
RFC 2616 section 13.5.1 has a typo in Trailers header name. The correct
name is Trailer. See http://trac.tools.ietf.org/wg/httpbis/trac/ticket/9
Co-Advisor test cases: test_case/rfc2616/hopHdr-Trailer-toClt
test_case/rfc2616/hopHdr-Trailer-toSrv
It looks like I did not include the patch. Now attached.
Sorry,
Alex.
Compliance: rename Trailers header to Trailer everywhere.
RFC 2616 section 13.5.1 has a typo in Trailers header name. The correct
name is Trailer. See http://trac.tools.ietf.org/wg/httpbis/trac/ticket/9
Co-Advisor test cases: test_case/rfc2616/hopHdr-Trailer-toClt
test_case/rfc2616/hopHdr-Trailer-toSrv
=== modified file 'src/HttpHeader.cc'
--- src/HttpHeader.cc 2010-05-31 19:51:06 +0000
+++ src/HttpHeader.cc 2010-08-18 17:21:51 +0000
@@ -106,41 +106,41 @@ static const HttpHeaderFieldAttrs Header
{"Last-Modified", HDR_LAST_MODIFIED, ftDate_1123},
{"Link", HDR_LINK, ftStr},
{"Location", HDR_LOCATION, ftStr},
{"Max-Forwards", HDR_MAX_FORWARDS, ftInt64},
{"Mime-Version", HDR_MIME_VERSION, ftStr}, /* for now */
{"Pragma", HDR_PRAGMA, ftStr},
{"Proxy-Authenticate", HDR_PROXY_AUTHENTICATE, ftStr},
{"Proxy-Authentication-Info", HDR_PROXY_AUTHENTICATION_INFO, ftStr},
{"Proxy-Authorization", HDR_PROXY_AUTHORIZATION, ftStr},
{"Proxy-Connection", HDR_PROXY_CONNECTION, ftStr},
{"Proxy-support", HDR_PROXY_SUPPORT, ftStr},
{"Public", HDR_PUBLIC, ftStr},
{"Range", HDR_RANGE, ftPRange},
{"Referer", HDR_REFERER, ftStr},
{"Request-Range", HDR_REQUEST_RANGE, ftPRange}, /* usually matches HDR_RANGE */
{"Retry-After", HDR_RETRY_AFTER, ftStr}, /* for now (ftDate_1123 or ftInt!) */
{"Server", HDR_SERVER, ftStr},
{"Set-Cookie", HDR_SET_COOKIE, ftStr},
{"TE", HDR_TE, ftStr},
{"Title", HDR_TITLE, ftStr},
- {"Trailers", HDR_TRAILERS, ftStr},
+ {"Trailer", HDR_TRAILER, ftStr},
{"Transfer-Encoding", HDR_TRANSFER_ENCODING, ftStr},
{"Translate", HDR_TRANSLATE, ftStr}, /* for now. may need to crop */
{"Unless-Modified-Since", HDR_UNLESS_MODIFIED_SINCE, ftStr}, /* for now ignore. may need to crop */
{"Upgrade", HDR_UPGRADE, ftStr}, /* for now */
{"User-Agent", HDR_USER_AGENT, ftStr},
{"Vary", HDR_VARY, ftStr}, /* for now */
{"Via", HDR_VIA, ftStr}, /* for now */
{"Warning", HDR_WARNING, ftStr}, /* for now */
{"WWW-Authenticate", HDR_WWW_AUTHENTICATE, ftStr},
{"Authentication-Info", HDR_AUTHENTICATION_INFO, ftStr},
{"X-Cache", HDR_X_CACHE, ftStr},
{"X-Cache-Lookup", HDR_X_CACHE_LOOKUP, ftStr},
{"X-Forwarded-For", HDR_X_FORWARDED_FOR, ftStr},
{"X-Request-URI", HDR_X_REQUEST_URI, ftStr},
{"X-Squid-Error", HDR_X_SQUID_ERROR, ftStr},
{"Negotiate", HDR_NEGOTIATE, ftStr},
#if X_ACCELERATOR_VARY
{"X-Accelerator-Vary", HDR_X_ACCELERATOR_VARY, ftStr},
#endif
#if USE_ADAPTATION
@@ -232,41 +232,41 @@ static http_hdr_type ReplyHeadersArr[] =
#endif
#if USE_ADAPTATION
HDR_X_NEXT_SERVICES,
#endif
HDR_X_SQUID_ERROR,
HDR_SURROGATE_CONTROL
};
static HttpHeaderMask RequestHeadersMask; /* set run-time using RequestHeaders */
static http_hdr_type RequestHeadersArr[] = {
HDR_AUTHORIZATION, HDR_FROM, HDR_HOST,
HDR_IF_MATCH, HDR_IF_MODIFIED_SINCE, HDR_IF_NONE_MATCH,
HDR_IF_RANGE, HDR_MAX_FORWARDS, HDR_PROXY_CONNECTION,
HDR_PROXY_AUTHORIZATION, HDR_RANGE, HDR_REFERER, HDR_REQUEST_RANGE,
HDR_USER_AGENT, HDR_X_FORWARDED_FOR, HDR_SURROGATE_CAPABILITY
};
static HttpHeaderMask HopByHopHeadersMask;
static http_hdr_type HopByHopHeadersArr[] = {
HDR_CONNECTION, HDR_KEEP_ALIVE, /*HDR_PROXY_AUTHENTICATE,*/ HDR_PROXY_AUTHORIZATION,
- HDR_TE, HDR_TRAILERS, HDR_TRANSFER_ENCODING, HDR_UPGRADE, HDR_PROXY_CONNECTION
+ HDR_TE, HDR_TRAILER, HDR_TRANSFER_ENCODING, HDR_UPGRADE, HDR_PROXY_CONNECTION
};
/* header accounting */
static HttpHeaderStat HttpHeaderStats[] = {
{"all"},
#if USE_HTCP
{"HTCP reply"},
#endif
{"request"},
{"reply"}
};
static int HttpHeaderStatCount = countof(HttpHeaderStats);
static int HeaderEntryParsedCount = 0;
/*
* local routines
*/
#define assert_eid(id) assert((id) >= 0 && (id) < HDR_ENUM_END)
=== modified file 'src/HttpHeader.h'
--- src/HttpHeader.h 2010-03-05 07:10:40 +0000
+++ src/HttpHeader.h 2010-08-18 17:22:27 +0000
@@ -87,41 +87,41 @@ typedef enum {
HDR_LAST_MODIFIED,
HDR_LINK,
HDR_LOCATION,
HDR_MAX_FORWARDS,
HDR_MIME_VERSION,
HDR_PRAGMA,
HDR_PROXY_AUTHENTICATE,
HDR_PROXY_AUTHENTICATION_INFO,
HDR_PROXY_AUTHORIZATION,
HDR_PROXY_CONNECTION,
HDR_PROXY_SUPPORT,
HDR_PUBLIC,
HDR_RANGE,
HDR_REQUEST_RANGE, /**< some clients use this, sigh */
HDR_REFERER,
HDR_RETRY_AFTER,
HDR_SERVER,
HDR_SET_COOKIE,
HDR_TE,
HDR_TITLE,
- HDR_TRAILERS,
+ HDR_TRAILER,
HDR_TRANSFER_ENCODING,
HDR_TRANSLATE, /* IIS custom header we may need to cut off */
HDR_UNLESS_MODIFIED_SINCE, /* IIS custom header we may need to cut off */
HDR_UPGRADE,
HDR_USER_AGENT,
HDR_VARY,
HDR_VIA,
HDR_WARNING,
HDR_WWW_AUTHENTICATE,
HDR_AUTHENTICATION_INFO,
HDR_X_CACHE,
HDR_X_CACHE_LOOKUP, /**< tmp hack, remove later */
HDR_X_FORWARDED_FOR,
HDR_X_REQUEST_URI, /**< appended if ADD_X_REQUEST_URI is #defined */
HDR_X_SQUID_ERROR,
HDR_NEGOTIATE,
#if X_ACCELERATOR_VARY
HDR_X_ACCELERATOR_VARY,
#endif
#if USE_ADAPTATION
=== modified file 'src/HttpReply.cc'
--- src/HttpReply.cc 2010-07-13 16:43:00 +0000
+++ src/HttpReply.cc 2010-08-18 17:22:03 +0000
@@ -45,41 +45,41 @@
/* local constants */
/* If we receive a 304 from the origin during a cache revalidation, we must
* update the headers of the existing entry. Specifically, we need to update all
* end-to-end headers and not any hop-by-hop headers (rfc2616 13.5.3).
*
* This is not the whole story though: since it is possible for a faulty/malicious
* origin server to set headers it should not in a 304, we must explicitly ignore
* these too. Specifically all entity-headers except those permitted in a 304
* (rfc2616 10.3.5) must be ignored.
*
* The list of headers we don't update is made up of:
* all hop-by-hop headers
* all entity-headers except Expires and Content-Location
*/
static HttpHeaderMask Denied304HeadersMask;
static http_hdr_type Denied304HeadersArr[] = {
// hop-by-hop headers
HDR_CONNECTION, HDR_KEEP_ALIVE, HDR_PROXY_AUTHENTICATE, HDR_PROXY_AUTHORIZATION,
- HDR_TE, HDR_TRAILERS, HDR_TRANSFER_ENCODING, HDR_UPGRADE,
+ HDR_TE, HDR_TRAILER, HDR_TRANSFER_ENCODING, HDR_UPGRADE,
// entity headers
HDR_ALLOW, HDR_CONTENT_ENCODING, HDR_CONTENT_LANGUAGE, HDR_CONTENT_LENGTH,
HDR_CONTENT_MD5, HDR_CONTENT_RANGE, HDR_CONTENT_TYPE, HDR_LAST_MODIFIED
};
/* module initialization */
void
httpReplyInitModule(void)
{
assert(HTTP_STATUS_NONE == 0); // HttpReply::parse() interface assumes that
httpHeaderMaskInit(&Denied304HeadersMask, 0);
httpHeaderCalcMask(&Denied304HeadersMask, Denied304HeadersArr, countof(Denied304HeadersArr));
}
HttpReply::HttpReply() : HttpMsg(hoReply), date (0), last_modified (0),
expires (0), surrogate_control (NULL), content_range (NULL), keep_alive (0),
protoPrefix("HTTP/"), bodySizeMax(-2)
{
init();
}
=== modified file 'src/http.cc'
--- src/http.cc 2010-08-13 07:53:08 +0000
+++ src/http.cc 2010-08-18 17:22:19 +0000
@@ -1763,41 +1763,41 @@ copyOneHeaderFromClientsideRequestToUpst
case HDR_PROXY_AUTHORIZATION:
/** \par Proxy-Authorization:
* Only pass on proxy authentication to peers for which
* authentication forwarding is explicitly enabled
*/
if (!flags.originpeer && flags.proxying && orig_request->peer_login &&
(strcmp(orig_request->peer_login, "PASS") == 0 ||
strcmp(orig_request->peer_login, "PROXYPASS") == 0 ||
strcmp(orig_request->peer_login, "PASSTHRU") == 0)) {
hdr_out->addEntry(e->clone());
}
break;
/** \par RFC 2616 sect 13.5.1 - Hop-by-Hop headers which Squid does not pass on. */
case HDR_CONNECTION: /** \par Connection: */
case HDR_TE: /** \par TE: */
case HDR_KEEP_ALIVE: /** \par Keep-Alive: */
case HDR_PROXY_AUTHENTICATE: /** \par Proxy-Authenticate: */
- case HDR_TRAILERS: /** \par Trailers: */
+ case HDR_TRAILER: /** \par Trailer: */
case HDR_UPGRADE: /** \par Upgrade: */
case HDR_TRANSFER_ENCODING: /** \par Transfer-Encoding: */
break;
/** \par OTHER headers I haven't bothered to track down yet. */
case HDR_AUTHORIZATION:
/** \par WWW-Authorization:
* Pass on WWW authentication */
if (!flags.originpeer) {
hdr_out->addEntry(e->clone());
} else {
/** \note In accelerators, only forward authentication if enabled
* (see also httpFixupAuthentication for special cases)
*/
if (orig_request->peer_login &&
(strcmp(orig_request->peer_login, "PASS") == 0 ||
strcmp(orig_request->peer_login, "PASSTHRU") == 0 ||