--------------------- PatchSet 1848 Date: 2005/09/19 16:16:29 Author: dwsquid Branch: squid3-icap Tag: (none) Log: Make this server-side work when ICAP_CLIENT is defined, but when httpState->icap is NULL Members: src/http.cc:1.49.2.25->1.49.2.26 Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.49.2.25 retrieving revision 1.49.2.26 diff -u -r1.49.2.25 -r1.49.2.26 --- squid3/src/http.cc 18 Sep 2005 04:12:42 -0000 1.49.2.25 +++ squid3/src/http.cc 19 Sep 2005 16:16:29 -0000 1.49.2.26 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.49.2.25 2005/09/18 04:12:42 dwsquid Exp $ + * $Id: http.cc,v 1.49.2.26 2005/09/19 16:16:29 dwsquid Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -114,9 +114,10 @@ #if ICAP_CLIENT - delete httpState->icap; - - cbdataReferenceDone(httpState->icap); + if (httpState->icap) { + delete httpState->icap; + cbdataReferenceDone(httpState->icap); + } #endif @@ -1141,24 +1142,39 @@ if (len > end) { #if ICAP_CLIENT - icap->sendMoreData (StoreIOBuffer(len - end, 0, (char*)buf+end)); -#else - entry->write (StoreIOBuffer(len - end, currentOffset, (char*)buf+end)); - currentOffset += (len - end); + if (icap) { + icap->sendMoreData (StoreIOBuffer(len - end, 0, (char*)buf+end)); + } else { +#endif + + entry->write (StoreIOBuffer(len - end, currentOffset, (char*)buf+end)); + currentOffset += (len - end); + + body_bytes_read += (len - end); +#if ICAP_CLIENT + + } + #endif - body_bytes_read += (len - end); } flags.headers_pushed = 1; } else { #if ICAP_CLIENT - icap->sendMoreData (StoreIOBuffer(len, 0, (char*)buf)); -#else - entry->write(StoreIOBuffer(len, currentOffset, (char*)buf)); - currentOffset += len; + if (icap) { + icap->sendMoreData (StoreIOBuffer(len, 0, (char*)buf)); + } else { +#endif + + entry->write(StoreIOBuffer(len, currentOffset, (char*)buf)); + currentOffset += len; +#if ICAP_CLIENT + + } + #endif body_bytes_read += len; @@ -1212,28 +1228,6 @@ case COMPLETE_NONPERSISTENT_MSG: debug(11,5)("processReplyData: COMPLETE_NONPERSISTENT_MSG\n"); - -#if REALLY - // hope we can just use transactionComplete() instead of - // this repeated code. - /* close the connection ourselves */ - /* yes - same as for a complete persistent conn here */ - commSetTimeout(fd, -1, NULL, NULL); - commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0); - comm_remove_close_handler(fd, httpStateFree, this); - fwdUnregister(fd, fwd); -#if ICAP_CLIENT - - icap->doneSending(); -#endif - - fwdComplete(fwd); - /* TODO: check that fd is still open here */ - comm_close (fd); - fd = -1; - httpStateFree(fd, this); -#endif - transactionComplete(); return; } @@ -1342,13 +1336,19 @@ } #if ICAP_CLIENT - icap->doneSending(); + if (icap) { + icap->doneSending(); + } else { -#else +#endif + + fwdComplete(fwd); - fwdComplete(fwd); + httpStateFree(-1, this); - httpStateFree(-1, this); +#if ICAP_CLIENT + + } #endif }