--------------------- PatchSet 290 Date: 2002/12/09 14:51:51 Author: apbarrett Branch: follow_xff Tag: (none) Log: Add an indirect_client_addr member to struct _request_t, and ensure that indirect_client_addr is initialised wherever client_addr is initialised. Members: src/HttpRequest.cc:1.2->1.2.8.1 src/client_side.cc:1.12->1.12.2.1 src/client_side_request.cc:1.4->1.4.6.1 src/structs.h:1.9.2.1->1.9.2.2 Index: squid3/src/HttpRequest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpRequest.cc,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -u -r1.2 -r1.2.8.1 --- squid3/src/HttpRequest.cc 25 Oct 2002 21:45:57 -0000 1.2 +++ squid3/src/HttpRequest.cc 9 Dec 2002 14:51:51 -0000 1.2.8.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.cc,v 1.2 2002/10/25 21:45:57 squidadm Exp $ + * $Id: HttpRequest.cc,v 1.2.8.1 2002/12/09 14:51:51 apbarrett Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -47,6 +47,9 @@ req->max_forwards = -1; req->lastmod = -1; req->client_addr = no_addr; +#if FOLLOW_X_FORWARDED_FOR + req->indirect_client_addr = req->client_addr; +#endif /* FOLLOW_X_FORWARDED_FOR */ req->my_addr = no_addr; httpHeaderInit(&req->header, hoRequest); return req; Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -r1.12 -r1.12.2.1 --- squid3/src/client_side.cc 18 Nov 2002 03:12:57 -0000 1.12 +++ squid3/src/client_side.cc 9 Dec 2002 14:51:51 -0000 1.12.2.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.12 2002/11/18 03:12:57 squidadm Exp $ + * $Id: client_side.cc,v 1.12.2.1 2002/12/09 14:51:51 apbarrett Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1373,6 +1373,9 @@ request->flags.internal = http->flags.internal; setLogUri (http, urlCanonicalClean(request)); request->client_addr = conn->peer.sin_addr; +#if FOLLOW_X_FORWARDED_FOR + request->indirect_client_addr = request->client_addr; +#endif /* FOLLOW_X_FORWARDED_FOR */ request->my_addr = conn->me.sin_addr; request->my_port = ntohs(conn->me.sin_port); request->http_ver = http->http_ver; Index: squid3/src/client_side_request.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v retrieving revision 1.4 retrieving revision 1.4.6.1 diff -u -r1.4 -r1.4.6.1 --- squid3/src/client_side_request.cc 1 Nov 2002 09:13:08 -0000 1.4 +++ squid3/src/client_side_request.cc 9 Dec 2002 14:51:51 -0000 1.4.6.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.4 2002/11/01 09:13:08 squidadm Exp $ + * $Id: client_side_request.cc,v 1.4.6.1 2002/12/09 14:51:51 apbarrett Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -164,6 +164,9 @@ /* Internally created requests cannot have bodies today */ request->content_length = 0; request->client_addr = no_addr; +#if FOLLOW_X_FORWARDED_FOR + request->indirect_client_addr = request->client_addr; +#endif /* FOLLOW_X_FORWARDED_FOR */ request->my_addr = no_addr; /* undefined for internal requests */ request->my_port = 0; request->http_ver = http_ver; @@ -508,6 +511,9 @@ new_request->http_ver = old_request->http_ver; httpHeaderAppend(&new_request->header, &old_request->header); new_request->client_addr = old_request->client_addr; +#if FOLLOW_X_FORWARDED_FOR + new_request->indirect_client_addr = old_request->indirect_client_addr; +#endif /* FOLLOW_X_FORWARDED_FOR */ new_request->my_addr = old_request->my_addr; new_request->my_port = old_request->my_port; new_request->flags.redirected = 1; Index: squid3/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -r1.9.2.1 -r1.9.2.2 --- squid3/src/structs.h 9 Dec 2002 14:23:57 -0000 1.9.2.1 +++ squid3/src/structs.h 9 Dec 2002 14:51:51 -0000 1.9.2.2 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.9.2.1 2002/12/09 14:23:57 apbarrett Exp $ + * $Id: structs.h,v 1.9.2.2 2002/12/09 14:51:51 apbarrett Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1502,6 +1502,9 @@ int max_forwards; /* these in_addr's could probably be sockaddr_in's */ struct in_addr client_addr; +#if FOLLOW_X_FORWARDED_FOR + struct in_addr indirect_client_addr; /* after following X-Forwarded-For */ +#endif /* FOLLOW_X_FORWARDED_FOR */ struct in_addr my_addr; unsigned short my_port; HttpHeader header;