From: wessels <> Date: Fri, 12 Apr 1996 11:15:29 +0000 (+0000) Subject: add "by" value to Forwarded: header X-Git-Tag: SQUID_3_0_PRE1~6202 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d9766e350ff095ff537fdc3b1d41b63cb958e431;p=thirdparty%2Fsquid.git add "by" value to Forwarded: header --- diff --git a/src/http.cc b/src/http.cc index dae0c8adc9..dfcc9405c4 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,4 +1,4 @@ -/* $Id: http.cc,v 1.40 1996/04/12 04:53:48 wessels Exp $ */ +/* $Id: http.cc,v 1.41 1996/04/12 05:15:29 wessels Exp $ */ /* * DEBUG: Section 11 http: HTTP @@ -414,6 +414,7 @@ static void httpSendRequest(fd, data) static char *HARVEST_PROXY_TEXT = "via Harvest Cache version"; int len = 0; int buflen; + int cfd = -1; char *Method = RequestMethodStr[data->method]; debug(11, 5, "httpSendRequest: FD %d: data %p.\n", fd, data); @@ -463,8 +464,13 @@ static void httpSendRequest(fd, data) /* Add Forwarded: header */ ybuf = get_free_4k_page(__FILE__,__LINE__); - sprintf(ybuf, "Forwarded: by http://%s:%d/\r\n", - getMyHostname(), getAsciiPortNum()); + if ((cfd = storePendingFirstFD(data->entry)) < 0) { + sprintf(ybuf, "Forwarded: by http://%s:%d/\r\n", + getMyHostname(), getAsciiPortNum()); + } else { + sprintf(ybuf, "Forwarded: by http://%s:%d/ for %s\r\n", + getMyHostname(), getAsciiPortNum(), fd_table[cfd].ipaddr); + } strcat(buf, ybuf); len += strlen(ybuf); put_free_4k_page(ybuf, __FILE__, __LINE__); diff --git a/src/store.cc b/src/store.cc index 892029869b..f5f0a45a4c 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ -/* $Id: store.cc,v 1.45 1996/04/12 04:53:50 wessels Exp $ */ -#ident "$Id: store.cc,v 1.45 1996/04/12 04:53:50 wessels Exp $" +/* $Id: store.cc,v 1.46 1996/04/12 05:15:30 wessels Exp $ */ +#ident "$Id: store.cc,v 1.46 1996/04/12 05:15:30 wessels Exp $" /* * DEBUG: Section 20 store @@ -2631,6 +2631,20 @@ int swapInError(fd_unused, entry) return 0; } +int storePendingFirstFD(e) + StoreEntry *e; +{ + int s; + int i; + if (!e->mem_obj) + return -1; + s = (int) e->mem_obj->pending_list_size; + for (i=0; imem_obj->pending[i]) + return e->mem_obj->pending[i]->fd; + return -1; +} + int storePendingNClients(e) StoreEntry *e; {