Mark Nottingham wrote:
FYI, I've asked Mozilla to stop sending Proxy-Connection:
https://bugzilla.mozilla.org/show_bug.cgi?id=570283
Any additional thoughts here? Should Squid stop using it, to
encourage its demise (I won't use the word "early," as it's been
around far too long already)?
+1.
Attached is a quick (untested) patch for 3.HEAD to make Squid stop
sending it on outbound requests to peers, and also ignore it's content
on HTTP-strict builds.
For origin server connections the non-strict builds will retain the
status-quo: interpret it, but treat it as an HTTP/0.9 thing to be
upgraded to HTTP/1.1 Connection:.
squidclient is also fixed not to send it.
Amos
--
Please be using
Current Stable Squid 2.7.STABLE9 or 3.1.4
=== modified file 'src/HttpHeaderTools.cc'
--- src/HttpHeaderTools.cc 2010-03-22 13:05:28 +
+++ src/HttpHeaderTools.cc 2010-07-02 04:28:39 +
@@ -145,19 +145,19 @@
httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive)
{
String list;
-http_hdr_type ht;
int res;
/* what type of header do we have? */
+#if HTTP_VIOLATIONS
if (hdr->has(HDR_PROXY_CONNECTION))
-ht = HDR_PROXY_CONNECTION;
-else if (hdr->has(HDR_CONNECTION))
-ht = HDR_CONNECTION;
+list = hdr->getList(HDR_PROXY_CONNECTION);
+else
+#endif
+if (hdr->has(HDR_CONNECTION))
+list = hdr->getList(HDR_CONNECTION);
else
return 0;
-list = hdr->getList(ht);
-
res = strListIsMember(&list, directive, ',');
list.clean();
=== modified file 'src/cf.data.pre'
--- src/cf.data.pre 2010-06-26 01:18:17 +
+++ src/cf.data.pre 2010-07-02 04:01:05 +
@@ -3991,7 +3991,6 @@
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
- request_header_access Proxy-Connection allow all
request_header_access All deny all
although many of those are HTTP reply headers, and so should be
@@ -4067,7 +4066,6 @@
reply_header_access Retry-After allow all
reply_header_access Title allow all
reply_header_access Connection allow all
- reply_header_access Proxy-Connection allow all
reply_header_access All deny all
although the HTTP request headers won't be usefully controlled
=== modified file 'src/client_side_reply.cc'
--- src/client_side_reply.cc 2010-04-17 10:38:50 +
+++ src/client_side_reply.cc 2010-07-02 04:06:59 +
@@ -1401,9 +1401,8 @@
hdr->delById(HDR_VIA);
hdr->putStr(HDR_VIA, strVia.termedBuf());
}
-/* Signal keep-alive if needed */
-hdr->putStr( (http->flags.accel || http->flags.intercepted)? HDR_CONNECTION : HDR_PROXY_CONNECTION,
- request->flags.proxy_keepalive ? "keep-alive" : "close");
+/* Signal keep-alive or close explicitly */
+hdr->putStr(HDR_CONNECTION, request->flags.proxy_keepalive ? "keep-alive" : "close");
#if ADD_X_REQUEST_URI
/*
=== modified file 'src/http.cc'
--- src/http.cc 2010-06-28 05:13:07 +
+++ src/http.cc 2010-07-02 04:33:24 +
@@ -1732,11 +1732,7 @@
/* maybe append Connection: keep-alive */
if (flags.keepalive) {
-if (flags.proxying) {
-hdr_out->putStr(HDR_PROXY_CONNECTION, "keep-alive");
-} else {
-hdr_out->putStr(HDR_CONNECTION, "keep-alive");
-}
+hdr_out->putStr(HDR_CONNECTION, "keep-alive");
}
/* append Front-End-Https */
@@ -1881,12 +1877,13 @@
break;
-case HDR_PROXY_CONNECTION:
+case HDR_PROXY_CONNECTION: // SHOULD ignore. But doing so breaks things.
+break;
case HDR_X_FORWARDED_FOR:
case HDR_CACHE_CONTROL:
-/** \par Proxy-Connaction:, X-Forwarded-For:, Cache-Control:
+/** \par X-Forwarded-For:, Cache-Control:
* handled specially by Squid, so leave off for now.
* append these after the loop if needed */
break;
=== modified file 'tools/squidclient.cc'
--- tools/squidclient.cc 2010-05-27 11:16:08 +
+++ tools/squidclient.cc 2010-07-02 04:04:32 +
@@ -427,17 +427,11 @@
strcat(msg, buf);
}
-/* HTTP/1.0 may need keep-alive */
-if (strcmp(version, "1.0") == 0) {
-if (keep_alive) {
-if (strchr(url, ':')) {
-snprintf(buf, BUFSIZ, "Proxy-Connection: keep-alive\r\n");
-strcat(msg, buf);
-} else
-strcat(msg, "Connection: keep-alive\r\n");
-}
-}
-/* HTTP/1.1 may need close */
+/* HTTP/1.0 may need keep-alive explicitly */
+if (strcmp(version, "1.0") == 0 && keep_alive)
+strcat(msg, "Connection: keep-alive\r\n");
+
+/* HTTP/1.1 may need close explicitly */
if (!keep_alive)
strcat(msg, "Connection: close\r\n");