Index: src/protos.h =================================================================== RCS file: /server/cvs-server/squid/squid/src/protos.h,v retrieving revision 1.449 diff -u -w -r1.449 protos.h --- src/protos.h 3 Oct 2002 06:45:53 -0000 1.449 +++ src/protos.h 4 Oct 2002 09:47:29 -0000 @@ -306,18 +306,10 @@ /* http.c */ extern int httpCachable(method_t); extern void httpStart(FwdState *); -extern void httpParseReplyHeaders(const char *, http_reply *); -extern void httpProcessReplyHeader(HttpStateData *, const char *, int); -extern mb_size_t httpBuildRequestPrefix(request_t * request, - request_t * orig_request, - StoreEntry * entry, - MemBuf * mb, - int cfd, - http_state_flags); extern void httpAnonInitModule(void); extern int httpAnonHdrAllowed(http_hdr_type hdr_id); extern int httpAnonHdrDenied(http_hdr_type hdr_id); -extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, HttpHeader *, int, http_state_flags); +extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, HttpHeader *, http_state_flags); extern void httpBuildVersion(http_version_t * version, unsigned int major, unsigned int minor); extern const char *httpMakeVaryMark(request_t * request, HttpReply * reply); Index: src/http.c =================================================================== RCS file: /server/cvs-server/squid/squid/src/http.c,v retrieving revision 1.393 diff -u -w -r1.393 http.c --- src/http.c 24 Sep 2002 10:46:42 -0000 1.393 +++ src/http.c 4 Oct 2002 09:47:29 -0000 @@ -54,6 +54,12 @@ static void httpMakePublic(StoreEntry *); static int httpCachableReply(HttpStateData *); static void httpMaybeRemovePublic(StoreEntry *, http_status); +static mb_size_t httpBuildRequestPrefix(request_t * request, + request_t * orig_request, + StoreEntry * entry, + MemBuf * mb, + http_state_flags); +static void httpProcessReplyHeader(HttpStateData *, const char *, int); static void httpStateFree(int fd, void *data) @@ -725,7 +731,6 @@ request_t * orig_request, StoreEntry * entry, HttpHeader * hdr_out, - int cfd, http_state_flags flags) { /* building buffer for complex strings */ @@ -829,7 +834,10 @@ } /* append X-Forwarded-For */ strFwd = httpHeaderGetList(hdr_in, HDR_X_FORWARDED_FOR); - strListAdd(&strFwd, (cfd < 0 ? "unknown" : fd_table[cfd].ipaddr), ','); + if (opt_forwarded_for && orig_request->client_addr.s_addr != no_addr.s_addr) + strListAdd(&strFwd, inet_ntoa(orig_request->client_addr), ','); + else + strListAdd(&strFwd, "unknown", ','); httpHeaderPutStr(hdr_out, HDR_X_FORWARDED_FOR, strBuf(strFwd)); stringClean(&strFwd); @@ -904,7 +912,6 @@ request_t * orig_request, StoreEntry * entry, MemBuf * mb, - int cfd, http_state_flags flags) { const int offset = mb->size; @@ -915,7 +922,7 @@ { HttpHeader hdr; Packer p; - httpBuildRequestHeader(request, orig_request, entry, &hdr, cfd, flags); + httpBuildRequestHeader(request, orig_request, entry, &hdr, flags); packerToMemInit(&p, mb); httpHeaderPackInto(&hdr, &p); httpHeaderClean(&hdr); @@ -932,7 +939,6 @@ MemBuf mb; request_t *req = httpState->request; StoreEntry *entry = httpState->entry; - int cfd; peer *p = httpState->_peer; CWCB *sendHeaderDone; @@ -943,13 +949,6 @@ else sendHeaderDone = httpSendComplete; - if (!opt_forwarded_for) - cfd = -1; - else if (entry->mem_obj == NULL) - cfd = -1; - else - cfd = entry->mem_obj->fd; - assert(-1 == cfd || FD_SOCKET == fd_table[cfd].type); if (p != NULL) httpState->flags.proxying = 1; else @@ -974,7 +973,6 @@ httpState->orig_request, entry, &mb, - cfd, httpState->flags); debug(11, 6) ("httpSendRequest: FD %d:\n%s\n", httpState->fd, mb.buf); comm_write_mbuf(httpState->fd, mb, sendHeaderDone, httpState);