/*
- * $Id: client_side.cc,v 1.589 2002/08/28 16:10:57 wessels Exp $
+ * $Id: client_side.cc,v 1.590 2002/09/01 13:46:55 hno Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
debug(33, 3) ("clientBuildReplyHeader: can't keep-alive, unknown body size\n");
request->flags.proxy_keepalive = 0;
}
+ /* Append Via */
+ {
+ LOCAL_ARRAY(char, bbuf, MAX_URL + 32);
+ String strVia = httpHeaderGetList(hdr, HDR_VIA);
+ snprintf(bbuf, sizeof(bbuf), "%d.%d %s",
+ rep->sline.version.major,
+ rep->sline.version.minor, ThisCache);
+ strListAdd(&strVia, bbuf, ',');
+ httpHeaderDelById(hdr, HDR_VIA);
+ httpHeaderPutStr(hdr, HDR_VIA, strBuf(strVia));
+ stringClean(&strVia);
+ }
/* Signal keep-alive if needed */
httpHeaderPutStr(hdr,
http->flags.accel ? HDR_CONNECTION : HDR_PROXY_CONNECTION,
/*
- * $Id: http.cc,v 1.388 2002/06/06 15:11:31 hno Exp $
+ * $Id: http.cc,v 1.389 2002/09/01 13:46:56 hno Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
String strConnection = StringNull;
const HttpHeader *hdr_in = &orig_request->header;
const HttpHeaderEntry *e;
- String strVia;
String strFwd;
HttpHeaderPos pos = HttpHeaderInitPos;
httpHeaderInit(hdr_out, hoRequest);
httpHeaderPutInt(hdr_out, HDR_MAX_FORWARDS, hops - 1);
}
break;
+ case HDR_VIA:
+ /* If Via is disabled then forward any received header as-is */
+ if (!Config.onoff.via)
+ httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e));
+ break;
case HDR_PROXY_CONNECTION:
case HDR_CONNECTION:
- case HDR_VIA:
case HDR_X_FORWARDED_FOR:
case HDR_CACHE_CONTROL:
/* append these after the loop if needed */
}
/* append Via */
- strVia = httpHeaderGetList(hdr_in, HDR_VIA);
- snprintf(bbuf, BBUF_SZ, "%d.%d %s",
- orig_request->http_ver.major,
- orig_request->http_ver.minor, ThisCache);
- strListAdd(&strVia, bbuf, ',');
- httpHeaderPutStr(hdr_out, HDR_VIA, strBuf(strVia));
- stringClean(&strVia);
-
+ if (Config.onoff.via) {
+ String strVia = httpHeaderGetList(hdr_in, HDR_VIA);
+ snprintf(bbuf, BBUF_SZ, "%d.%d %s",
+ orig_request->http_ver.major,
+ orig_request->http_ver.minor, ThisCache);
+ strListAdd(&strVia, bbuf, ',');
+ httpHeaderPutStr(hdr_out, HDR_VIA, strBuf(strVia));
+ stringClean(&strVia);
+ }
/* append X-Forwarded-For */
strFwd = httpHeaderGetList(hdr_in, HDR_X_FORWARDED_FOR);
strListAdd(&strFwd, (cfd < 0 ? "unknown" : fd_table[cfd].ipaddr), ',');