According to the W3C documentation the Surrogate/1.0 capabilities and
the Surrogate-Control: header are distinct from the ESI capabilities.
This patch makes Squid always advertise and perform the Surrogate/1.0
capabilities for reverse-proxy requests.
Full ESI support is no longer required to use the bare-bones
Surrogate-Control: capabilities.
Amos
=== modified file 'src/cf.data.pre'
--- src/cf.data.pre 2010-02-05 23:27:27 +0000
+++ src/cf.data.pre 2010-02-06 06:49:37 +0000
@@ -4312,7 +4312,6 @@
COMMENT_END
NAME: httpd_accel_surrogate_id
-IFDEF: USE_SQUID_ESI
TYPE: string
LOC: Config.Accel.surrogate_id
DEFAULT: unset-id
@@ -4324,7 +4323,6 @@
DOC_END
NAME: http_accel_surrogate_remote
-IFDEF: USE_SQUID_ESI
COMMENT: on|off
TYPE: onoff
DEFAULT: off
=== modified file 'src/client_side_reply.cc'
--- src/client_side_reply.cc 2010-02-06 06:32:11 +0000
+++ src/client_side_reply.cc 2010-02-06 11:18:40 +0000
@@ -1421,6 +1421,14 @@
#endif
+ /* Surrogate-Control requires Surrogate-Capability upstream to pass on */
+ if ( http->flags.accel && hdr->has(HDR_SURROGATE_CONTROL) ) {
+ if (!request->header.has(HDR_SURROGATE_CAPABILITY)) {
+ hdr->delById(HDR_SURROGATE_CONTROL);
+ }
+ /* TODO: else, drop any controls intended specifically for our surrogate ID */
+ }
+
httpHdrMangleList(hdr, request, ROR_REPLY);
}
=== modified file 'src/http.cc'
--- src/http.cc 2010-02-06 06:32:11 +0000
+++ src/http.cc 2010-02-06 10:12:33 +0000
@@ -310,12 +310,8 @@
void
HttpStateData::processSurrogateControl(HttpReply *reply)
{
-#if USE_SQUID_ESI
-
if (request->flags.accelerated && reply->surrogate_control) {
- HttpHdrScTarget *sctusable =
- httpHdrScGetMergedTarget(reply->surrogate_control,
- Config.Accel.surrogate_id);
+ HttpHdrScTarget *sctusable = httpHdrScGetMergedTarget(reply->surrogate_control, Config.Accel.surrogate_id);
if (sctusable) {
if (EBIT_TEST(sctusable->mask, SC_NO_STORE) ||
@@ -345,8 +341,6 @@
httpHdrScTargetDestroy(sctusable);
}
}
-
-#endif
}
int
@@ -1596,16 +1590,17 @@
strVia.clean();
}
-#if USE_SQUID_ESI
if (orig_request->flags.accelerated) {
/* Append Surrogate-Capabilities */
- String strSurrogate (hdr_in->getList(HDR_SURROGATE_CAPABILITY));
- snprintf(bbuf, BBUF_SZ, "%s=\"Surrogate/1.0 ESI/1.0\"",
- Config.Accel.surrogate_id);
+ String strSurrogate(hdr_in->getList(HDR_SURROGATE_CAPABILITY));
+#if USE_SQUID_ESI
+ snprintf(bbuf, BBUF_SZ, "%s=\"Surrogate/1.0 ESI/1.0\"", Config.Accel.surrogate_id);
+#else
+ snprintf(bbuf, BBUF_SZ, "%s=\"Surrogate/1.0\"", Config.Accel.surrogate_id);
+#endif
strListAdd(&strSurrogate, bbuf, ',');
hdr_out->putStr(HDR_SURROGATE_CAPABILITY, strSurrogate.termedBuf());
}
-#endif
/** \pre Handle X-Forwarded-For */
if (strcmp(opt_forwarded_for, "delete") != 0) {
=== modified file 'src/structs.h'
--- src/structs.h 2010-02-05 23:27:27 +0000
+++ src/structs.h 2010-02-06 06:49:38 +0000
@@ -315,10 +315,7 @@
time_t authenticateIpTTL;
struct {
-#if USE_SQUID_ESI
char *surrogate_id;
-#endif
-
} Accel;
char *appendDomain;
size_t appendDomainLen;
@@ -427,11 +424,7 @@
int ie_refresh;
int vary_ignore_expire;
int pipeline_prefetch;
-
-#if USE_SQUID_ESI
int surrogate_is_remote;
-#endif
-
int request_entities;
int detect_broken_server_pconns;
int balance_on_multiple_ip;