-/* $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
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);
/* 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__);
-/* $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
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;
{