--------------------- PatchSet 11181 Date: 2007/11/06 21:19:30 Author: Duane Wessels Branch: HEAD Tag: (none) Log: Extended the Squid -> Rewriter interface with key=value pairs Our customer wants to use a redirector (rewriter) but needs additional fields. We think that new fields should be of the form "key=value" so that, in the future, the user can choose which fields to send to the rewriter. Members: src/cf.data.pre:1.485->1.486 src/redirect.cc:1.121->1.122 Index: squid3/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid/squid3/src/cf.data.pre,v retrieving revision 1.485 retrieving revision 1.486 diff -u -r1.485 -r1.486 --- squid3/src/cf.data.pre 31 Oct 2007 10:34:36 -0000 1.485 +++ squid3/src/cf.data.pre 6 Nov 2007 21:19:30 -0000 1.486 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.485 2007/10/31 10:34:36 amosjeffries Exp $ +# $Id: cf.data.pre,v 1.486 2007/11/06 21:19:30 wessels Exp $ # # SQUID Web Proxy Cache http://www.squid-cache.org/ # ---------------------------------------------------------- @@ -2364,7 +2364,12 @@ For each requested URL rewriter will receive on line with the format - URL client_ip "/" fqdn user method + URL client_ip "/" fqdn user method [ kvpairs] + + In the future, the rewriter interface will be extended with + key=value pairs ("kvpairs" shown above). Rewriter programs + should be prepared to receive and possibly ignore additional + whitespace-separated tokens on each input line. And the rewriter may return a rewritten URL. The other components of the request line does not need to be returned (ignored if they are). Index: squid3/src/redirect.cc =================================================================== RCS file: /cvsroot/squid/squid3/src/redirect.cc,v retrieving revision 1.121 retrieving revision 1.122 diff -u -r1.121 -r1.122 --- squid3/src/redirect.cc 27 Sep 2007 23:58:06 -0000 1.121 +++ squid3/src/redirect.cc 6 Nov 2007 21:19:31 -0000 1.122 @@ -1,6 +1,6 @@ /* - * $Id: redirect.cc,v 1.121 2007/09/27 23:58:06 amosjeffries Exp $ + * $Id: redirect.cc,v 1.122 2007/11/06 21:19:31 wessels Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -117,6 +117,8 @@ redirectStateData *r = NULL; const char *fqdn; char buf[8192]; + char claddr[20]; + char myaddr[20]; assert(http); assert(handler); debugs(61, 5, "redirectStart: '" << http->uri << "'"); @@ -161,12 +163,16 @@ if ((fqdn = fqdncache_gethostbyaddr(r->client_addr, 0)) == NULL) fqdn = dash_str; - snprintf(buf, 8192, "%s %s/%s %s %s\n", + xstrncpy(claddr, inet_ntoa(r->client_addr), 20); + xstrncpy(myaddr, inet_ntoa(http->request->my_addr), 20); + snprintf(buf, 8192, "%s %s/%s %s %s myip=%s myport=%d\n", r->orig_url, - inet_ntoa(r->client_addr), + claddr, fqdn, r->client_ident[0] ? rfc1738_escape(r->client_ident) : dash_str, - r->method_s); + r->method_s, + myaddr, + http->request->my_port); helperSubmit(redirectors, buf, redirectHandleReply, r); }