#endif
+ /* Surrogate-Control requires Surrogate-Capability from upstream to pass on */
+ if ( hdr->has(HDR_SURROGATE_CONTROL) ) {
+ if (!request->header.has(HDR_SURROGATE_CAPABILITY)) {
+ hdr->delById(HDR_SURROGATE_CONTROL);
+ }
+ /* TODO: else case: drop any controls intended specifically for our surrogate ID */
+ }
+
httpHdrMangleList(hdr, request, ROR_REPLY);
}
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) ||
/* The HttpHeader logic cannot tell if the header it's parsing is a reply to an
* accelerated request or not...
- * Still, this is an abtraction breach. - RC
+ * Still, this is an abstraction breach. - RC
*/
if (sctusable->max_age != -1) {
if (sctusable->max_age < sctusable->max_stale)
httpHdrScTargetDestroy(sctusable);
}
}
-
-#endif
}
int
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) {