--------------------- PatchSet 5728 Date: 2003/05/09 14:14:31 Author: hno Branch: icap-2_5 Tag: (none) Log: removed the ICAP_FIELD macro to make the code look more like normal Squid code Members: src/http.c:1.17.6.3.6.1->1.17.6.3.6.2 src/icap.c:1.1.16.2->1.1.16.3 Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.17.6.3.6.1 retrieving revision 1.17.6.3.6.2 diff -u -r1.17.6.3.6.1 -r1.17.6.3.6.2 --- squid/src/http.c 4 Apr 2003 16:55:31 -0000 1.17.6.3.6.1 +++ squid/src/http.c 9 May 2003 14:14:31 -0000 1.17.6.3.6.2 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.17.6.3.6.1 2003/04/04 16:55:31 hno Exp $ + * $Id: http.c,v 1.17.6.3.6.2 2003/05/09 14:14:31 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -48,7 +48,6 @@ /* I am using some of these functions in ICAP */ #ifdef HS_FEAT_ICAP #define STATIC -#define ICAP_FIELD(httpState) (httpState)->icap #else #define STATIC static #endif @@ -655,7 +654,7 @@ */ httpProcessReplyHeader(httpState, buf, len); #ifdef HS_FEAT_ICAP - if (ICAP_FIELD(httpState) && ICAP_FIELD(httpState)->http_fd == fd) { + if (httpState->icap && httpState->icap->http_fd == fd) { icapSendRespMod(httpState, buf, len, 1); return; } @@ -696,7 +695,7 @@ * when headers are complete and no body is specified in encapsulated header * we probably can finish this request */ - icap = ICAP_FIELD(httpState); + icap = httpState->icap; if (icap && icap->reqmod && icap->enc_null_body >= 0 && httpState->reply_hdr_state == 2) { fwdComplete(httpState->fwd); comm_close(fd); @@ -715,7 +714,7 @@ /* yes we have to clear all these! */ #ifdef HS_FEAT_ICAP /* only enter respmod if we are not in reqmod mode */ - if (ICAP_FIELD(httpState) && !ICAP_FIELD(httpState)->reqmod && ICAP_FIELD(httpState)->http_fd == fd) { + if (httpState->icap && !httpState->icap->reqmod && httpState->icap->http_fd == fd) { icapSendRespMod(httpState, buf, len, 1); return; } @@ -735,7 +734,7 @@ } else { #ifdef HS_FEAT_ICAP /* don't enter respmod for reqmod replies from icap server */ - if (ICAP_FIELD(httpState) && !ICAP_FIELD(httpState)->reqmod && ICAP_FIELD(httpState)->http_fd == fd) { + if (httpState->icap && !httpState->icap->reqmod && httpState->icap->http_fd == fd) { icapSendRespMod(httpState, buf, len, 0); } else #endif Index: squid/src/icap.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/icap.c,v retrieving revision 1.1.16.2 retrieving revision 1.1.16.3 diff -u -r1.1.16.2 -r1.1.16.3 --- squid/src/icap.c 7 Apr 2003 13:29:04 -0000 1.1.16.2 +++ squid/src/icap.c 9 May 2003 14:14:32 -0000 1.1.16.3 @@ -1,5 +1,5 @@ /* - * $Id: icap.c,v 1.1.16.2 2003/04/07 13:29:04 hno Exp $ + * $Id: icap.c,v 1.1.16.3 2003/05/09 14:14:32 hno Exp $ * This file has the ICAP client code... * * Author: Geetha Manjunath, @@ -34,7 +34,6 @@ */ #include "squid.h" -#define ICAP_FIELD(httpState) (httpState)->icap static const char *const crlf = "\r\n"; #define EXPECTED_ICAP_HEADER_LEN 256 @@ -186,7 +185,7 @@ * * it crashed. Ralf */ - icapParseEncapsulated(ICAP_FIELD(httpState), header_enc, header_enc_end); + icapParseEncapsulated(httpState->icap, header_enc, header_enc_end); } directResponse = !(!strstr(icap_header, "res-")); } @@ -266,8 +265,8 @@ httpSendRequest(httpState); } - icapStateFree(ICAP_FIELD(httpState)); - ICAP_FIELD(httpState) = NULL; + icapStateFree(httpState->icap); + httpState->icap = NULL; } } @@ -326,7 +325,7 @@ MemBuf mb; MemBuf mb_hdr; HttpStateData *httpState = data; - IcapStateData *icap = ICAP_FIELD(httpState); + IcapStateData *icap = httpState->icap; request_t *req = httpState->request; StoreEntry *entry = httpState->entry; char *client_addr; @@ -406,7 +405,7 @@ icap_service *service = NULL; icap_service_t type; - if (ICAP_FIELD(httpState) + if (httpState->icap || !httpState->orig_request->flags.do_icap) return -1; @@ -432,7 +431,7 @@ icap->current_service = service; icap->reqmod = 1; icap->http_fd = httpState->fd; - ICAP_FIELD(httpState) = icap; + httpState->icap = icap; #if 1 /* register the handler to free HTTP state data when the FD closes */ @@ -546,7 +545,7 @@ } else if (status == 204) { IcapStateData *icap = httpState->icap; comm_close(fd); - ICAP_FIELD(httpState) = NULL; + httpState->icap = NULL; if ((icap->state & ICAP_EndOfInputData) != 0) { /* Reset is required to avoid duplicate stmemFreeDataUpto , * but will I loose all info now ? */ @@ -609,8 +608,8 @@ /* do not delete the ICAP field here. * it is needed to route data now still coming from the HTTP * connection up to the ICAP server - icapStateFree(ICAP_FIELD(httpState)); - ICAP_FIELD(httpState) = NULL; + icapStateFree(httpState->icap); + httpState->icap = NULL; */ httpState->fd = fd; /* now read the HTTP data from the ICAP connection */ comm_add_close_handler(fd, httpStateFree, httpState); @@ -701,7 +700,7 @@ err->request = requestLink(httpState->orig_request); errorAppendEntry(entry, err); cbdataUnlock(httpState); - ICAP_FIELD(httpState) = NULL; + httpState->icap = NULL; comm_close(fd); return; } @@ -717,7 +716,7 @@ icapSendRespMod(HttpStateData * httpState, void *buf, int len, int theEnd) { MemBuf mb; - IcapStateData *icap = ICAP_FIELD(httpState); + IcapStateData *icap = httpState->icap; int size; const int preview_size = icap->preview_size; char ch; @@ -837,7 +836,7 @@ buildRespModHeader(MemBuf * mb, HttpStateData * httpState, char *buf, ssize_t len, int theEnd) { - IcapStateData *icap = ICAP_FIELD(httpState); + IcapStateData *icap = httpState->icap; MemBuf mb_hdr; char *client_addr; request_t *req = httpState->request; @@ -920,7 +919,7 @@ icap_service *service = NULL; icap_service_t type; - if (ICAP_FIELD(httpState) || + if (httpState->icap || !httpState->orig_request->flags.do_icap) return -1; @@ -945,7 +944,7 @@ icap->current_service = service; icap->preview_size = service->preview; - ICAP_FIELD(httpState) = icap; + httpState->icap = icap; fd = icap->icap_fd; icap->http_fd = httpState->fd; @@ -1023,7 +1022,7 @@ debug(17, 2) ("icapConnectTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); if (cbdataValid(httpState)) { - assert(fd == ICAP_FIELD(httpState)->icap_fd); + assert(fd == httpState->icap->icap_fd); cbdataUnlock(httpState); } if (entry->mem_obj->inmem_hi == 0) {