--------------------- PatchSet 8993 Date: 2007/03/11 02:16:02 Author: hno Branch: http11 Tag: (none) Log: Second round of restructuring to prepare for 1xx. Members: src/client_side.c:1.154.2.12->1.154.2.13 src/store.c:1.39.2.2->1.39.2.3 src/structs.h:1.136.6.6->1.136.6.7 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.154.2.12 retrieving revision 1.154.2.13 diff -u -r1.154.2.12 -r1.154.2.13 --- squid/src/client_side.c 11 Mar 2007 01:47:14 -0000 1.154.2.12 +++ squid/src/client_side.c 11 Mar 2007 02:16:02 -0000 1.154.2.13 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.154.2.12 2007/03/11 01:47:14 hno Exp $ + * $Id: client_side.c,v 1.154.2.13 2007/03/11 02:16:02 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -167,6 +167,30 @@ static StoreEntry *clientCreateStoreEntry(clientHttpRequest *, method_t, request_flags); static inline int clientNatLookup(ConnStateData * conn); +/* Temporary here while restructuring stuff */ +static void +storeClientCopyHeadersCB(void *data, char *buf, ssize_t size) +{ + clientHttpRequest *http = data; + assert(http->header_callback); + assert(http->header_entry); + if (!http->header_entry) + return; + if (!memHaveHeaders(http->header_entry->mem_obj)) { + http->header_callback(data, NULL); + return; + } + http->header_callback(data, http->header_entry->mem_obj->reply); +} +void +storeClientCopyHeaders(store_client *sc, StoreEntry *e, STHCB *callback, void *callback_data) +{ + clientHttpRequest *http = callback_data; + http->header_callback = callback; + http->header_entry = e; + storeClientCopy(sc, e, 0, 0, CLIENT_SOCK_SZ, http->readbuf, storeClientCopyHeadersCB, http); +} + #if USE_IDENT static void clientIdentDone(const char *ident, void *data) Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.39.2.2 retrieving revision 1.39.2.3 diff -u -r1.39.2.2 -r1.39.2.3 --- squid/src/store.c 11 Mar 2007 01:47:18 -0000 1.39.2.2 +++ squid/src/store.c 11 Mar 2007 02:16:05 -0000 1.39.2.3 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.39.2.2 2007/03/11 01:47:18 hno Exp $ + * $Id: store.c,v 1.39.2.3 2007/03/11 02:16:05 hno Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -126,9 +126,11 @@ } int -memHaveHeaders(const MemObject * mem) +memHaveHeaders(const MemObject *mem) { - if (mem->reply == NULL) + if (!mem) + return 0; + if (!mem->reply) return 0; if (mem->reply->sline.status == 0) return 0; Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.136.6.6 retrieving revision 1.136.6.7 diff -u -r1.136.6.6 -r1.136.6.7 --- squid/src/structs.h 11 Mar 2007 01:47:18 -0000 1.136.6.6 +++ squid/src/structs.h 11 Mar 2007 02:16:06 -0000 1.136.6.7 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.136.6.6 2007/03/11 01:47:18 hno Exp $ + * $Id: structs.h,v 1.136.6.7 2007/03/11 02:16:06 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1238,6 +1238,8 @@ * zero.. [ahc] */ char readbuf[CLIENT_SOCK_SZ]; + STHCB *header_callback; /* Temporarily here for storeClientCopyHeaders */ + StoreEntry *header_entry; /* Temporarily here for storeClientCopyHeaders */ }; struct _ConnStateData {