--------------------- PatchSet 5999 Date: 2003/10/29 17:40:23 Author: dwsquid Branch: icap-2_5 Tag: (none) Log: Need to pass start time and log_addr to icapReqModStart() for proper access.log entries. Members: src/client_side.c:1.47.2.28.2.11->1.47.2.28.2.12 src/icap_reqmod.c:1.1.2.11->1.1.2.12 src/protos.h:1.41.6.13.2.13->1.41.6.13.2.14 src/structs.h:1.48.2.9.2.14->1.48.2.9.2.15 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.47.2.28.2.11 retrieving revision 1.47.2.28.2.12 diff -u -r1.47.2.28.2.11 -r1.47.2.28.2.12 --- squid/src/client_side.c 29 Oct 2003 16:18:05 -0000 1.47.2.28.2.11 +++ squid/src/client_side.c 29 Oct 2003 17:40:23 -0000 1.47.2.28.2.12 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.47.2.28.2.11 2003/10/29 16:18:05 dwsquid Exp $ + * $Id: client_side.c,v 1.47.2.28.2.12 2003/10/29 17:40:23 dwsquid Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3833,10 +3833,19 @@ if (!http->request->flags.do_icap_reqmod_precache) return 0; debug(33, 3) ("clientIcapReqMod: calling icapReqModStart for %p\n", http); + /* + * Note, we pass 'start' and 'log_addr' to ICAP so the access.log + * entry comes out right. The 'clientHttpRequest' created by + * the ICAP side is the one that gets logged. The first + * 'clientHttpRequest' does not get logged because its out.size + * is zero and log_type is unset. + */ icap = icapReqModStart(ICAP_SERVICE_REQMOD_PRECACHE, http->uri, http->request, - http->conn->fd); + http->conn->fd, + http->start, + http->conn->log_addr); if (NULL == icap) return 0; return 1; Index: squid/src/icap_reqmod.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/icap_reqmod.c,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -r1.1.2.11 -r1.1.2.12 --- squid/src/icap_reqmod.c 29 Oct 2003 17:24:57 -0000 1.1.2.11 +++ squid/src/icap_reqmod.c 29 Oct 2003 17:40:25 -0000 1.1.2.12 @@ -1,5 +1,5 @@ /* - * $Id: icap_reqmod.c,v 1.1.2.11 2003/10/29 17:24:57 dwsquid Exp $ + * $Id: icap_reqmod.c,v 1.1.2.12 2003/10/29 17:40:25 dwsquid Exp $ * * DEBUG: section 81 Internet Content Adaptation Protocol (ICAP) Client * AUTHOR: Geetha Manjunath, Hewlett Packard Company @@ -84,11 +84,12 @@ http->range_iter.boundary = StringNull; http->request = requestLink(icap->request); http->flags.did_icap_reqmod = 1; - http->start = current_time; + http->start = icap->reqmod.start; http->conn = cbdataAlloc(ConnStateData); http->conn->fd = icap->reqmod.client_fd; http->conn->in.size = 0; http->conn->in.buf = NULL; + http->conn->log_addr = icap->reqmod.log_addr; http->conn->chr = http; comm_add_close_handler(http->conn->fd, connStateFree, http->conn); return http; @@ -575,7 +576,7 @@ * structure and request a TCP connection to the server. */ IcapStateData * -icapReqModStart(icap_service_t type, const char *uri, request_t * request, int fd) +icapReqModStart(icap_service_t type, const char *uri, request_t * request, int fd, struct timeval start, struct in_addr log_addr) { IcapStateData *icap = NULL; icap_service *service = NULL; @@ -605,7 +606,9 @@ } icap->current_service = service; icap->preview_size = service->preview; - icap->reqmod.uri = uri; + icap->reqmod.uri = uri; /* XXX should be xstrdup? */ + icap->reqmod.start = start; + icap->reqmod.log_addr = log_addr; icap->request = requestLink(request); icap->reqmod.hdr_state = 0; icap->reqmod.client_fd = fd; Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.41.6.13.2.13 retrieving revision 1.41.6.13.2.14 diff -u -r1.41.6.13.2.13 -r1.41.6.13.2.14 --- squid/src/protos.h 29 Oct 2003 16:29:58 -0000 1.41.6.13.2.13 +++ squid/src/protos.h 29 Oct 2003 17:40:25 -0000 1.41.6.13.2.14 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.41.6.13.2.13 2003/10/29 16:29:58 dwsquid Exp $ + * $Id: protos.h,v 1.41.6.13.2.14 2003/10/29 17:40:25 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1378,7 +1378,7 @@ /* * icap_reqmod.c */ -IcapStateData *icapReqModStart(icap_service_t, const char *, request_t *, int); +IcapStateData *icapReqModStart(icap_service_t, const char *, request_t *, int, struct timeval, struct in_addr); /* icap_opt.c */ void icapOptInit(void); Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.48.2.9.2.14 retrieving revision 1.48.2.9.2.15 diff -u -r1.48.2.9.2.14 -r1.48.2.9.2.15 --- squid/src/structs.h 29 Oct 2003 16:18:07 -0000 1.48.2.9.2.14 +++ squid/src/structs.h 29 Oct 2003 17:40:26 -0000 1.48.2.9.2.15 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.48.2.9.2.14 2003/10/29 16:18:07 dwsquid Exp $ + * $Id: structs.h,v 1.48.2.9.2.15 2003/10/29 17:40:26 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1010,6 +1010,8 @@ struct { const char *uri; /* URI for REQMODs */ int client_fd; + struct timeval start; /* for logging */ + struct in_addr log_addr; /* for logging */ int hdr_state; MemBuf hdr_buf; } reqmod;