]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
add "by" value to Forwarded: header
authorwessels <>
Fri, 12 Apr 1996 11:15:29 +0000 (11:15 +0000)
committerwessels <>
Fri, 12 Apr 1996 11:15:29 +0000 (11:15 +0000)
src/http.cc
src/store.cc

index dae0c8adc9a1da4c4b529619dab3b6197b3f3581..dfcc9405c46a4a066591d54ea0c021a4ccaeb6b4 100644 (file)
@@ -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__);
index 892029869b1c0c266917507504cbd539dff98314..f5f0a45a4c74f6df87cb12df914a518e6a9d1fa6 100644 (file)
@@ -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; i<s; i++)
+               if (e->mem_obj->pending[i])
+                       return e->mem_obj->pending[i]->fd;
+       return -1;
+}
+
 int storePendingNClients(e)
      StoreEntry *e;
 {