--------------------- PatchSet 8964 Date: 2007/02/27 14:48:27 Author: adri Branch: storework Tag: (none) Log: remove clientCheckHeaderStateData; its unneeded. Members: src/client_side.c:1.168.2.12->1.168.2.13 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.168.2.12 retrieving revision 1.168.2.13 diff -u -r1.168.2.12 -r1.168.2.13 --- squid/src/client_side.c 25 Feb 2007 18:53:50 -0000 1.168.2.12 +++ squid/src/client_side.c 27 Feb 2007 14:48:27 -0000 1.168.2.13 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.168.2.12 2007/02/25 18:53:50 hno Exp $ + * $Id: client_side.c,v 1.168.2.13 2007/02/27 14:48:27 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -453,7 +453,7 @@ return e; } -static void +void clientAccessCheckDone(int answer, void *data) { clientHttpRequest *http = data; @@ -1847,20 +1847,14 @@ } } -typedef struct { - clientHttpRequest *http; -} clientCheckHeaderStateData; - -CBDATA_TYPE(clientCheckHeaderStateData); - -static void clientHttpLocationRewriteCheck(clientCheckHeaderStateData * state); +static void clientHttpLocationRewriteCheck(clientHttpRequest * http); static void clientHttpLocationRewriteCheckDone(int answer, void *data); -static void clientHttpLocationRewrite(clientCheckHeaderStateData * state); +static void clientHttpLocationRewrite(clientHttpRequest * state); static void clientHttpLocationRewriteDone(void *data, char *reply); -static void clientHttpReplyAccessCheck(clientCheckHeaderStateData * state); +static void clientHttpReplyAccessCheck(clientHttpRequest * state); static void clientHttpReplyAccessCheckDone(int answer, void *data); -static void clientCheckErrorMap(clientCheckHeaderStateData * state); -static void clientCheckHeaderDone(clientCheckHeaderStateData * state); +static void clientCheckErrorMap(clientHttpRequest * state); +static void clientCheckHeaderDone(clientHttpRequest * state); /* * accepts chunk of a http message in buf, parses prefix, filters headers and @@ -1869,7 +1863,6 @@ static void clientHandleReply(clientHttpRequest *http, HttpReply *server_reply) { - clientCheckHeaderStateData *state; StoreEntry *entry = http->entry; ConnStateData *conn = http->conn; int fd = conn->fd; @@ -1931,81 +1924,73 @@ * so it could be written in one hit - but again, thats gone now. */ http->range_iter.prefix_size = 0; - CBDATA_INIT_TYPE(clientCheckHeaderStateData); - /* - * This -state- thing can go as we've deleted buf/body_buf; we're only toying around - * with state->http now. That can go away. - */ - state = cbdataAlloc(clientCheckHeaderStateData); - state->http = http; cbdataLock(http); - clientHttpLocationRewriteCheck(state); + clientHttpLocationRewriteCheck(http); } static void -clientHttpLocationRewriteCheck(clientCheckHeaderStateData * state) +clientHttpLocationRewriteCheck(clientHttpRequest * http) { - HttpReply *rep = state->http->reply; + HttpReply *rep = http->reply; aclCheck_t *ch; - if (!cbdataValid(state->http)) { + if (!cbdataValid(http)) { /* oops.. */ - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); return; } if (!Config.Program.location_rewrite.command || !httpHeaderHas(&rep->header, HDR_LOCATION)) { - clientHttpLocationRewriteDone(state, NULL); + clientHttpLocationRewriteDone(http, NULL); return; } if (Config.accessList.location_rewrite) { - ch = clientAclChecklistCreate(Config.accessList.location_rewrite, state->http); - ch->reply = state->http->reply; - aclNBCheck(ch, clientHttpLocationRewriteCheckDone, state); + ch = clientAclChecklistCreate(Config.accessList.location_rewrite, http); + ch->reply = http->reply; + aclNBCheck(ch, clientHttpLocationRewriteCheckDone, http); } else { - clientHttpLocationRewriteCheckDone(ACCESS_ALLOWED, state); + clientHttpLocationRewriteCheckDone(ACCESS_ALLOWED, http); } } static void clientHttpLocationRewriteCheckDone(int answer, void *data) { - clientCheckHeaderStateData *state = data; - if (!cbdataValid(state->http)) { + clientHttpRequest *http = data; + if (!cbdataValid(http)) { /* oops.. */ - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); return; } if (answer == ACCESS_ALLOWED) { - clientHttpLocationRewrite(state); + clientHttpLocationRewrite(http); } else { - clientHttpLocationRewriteDone(state, NULL); + clientHttpLocationRewriteDone(http, NULL); } } static void -clientHttpLocationRewrite(clientCheckHeaderStateData * state) +clientHttpLocationRewrite(clientHttpRequest * http) { - HttpReply *rep = state->http->reply; - if (!cbdataValid(state->http)) { + HttpReply *rep = http->reply; + if (!cbdataValid(http)) { /* oops.. */ - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); return; } if (!httpHeaderHas(&rep->header, HDR_LOCATION)) - clientHttpLocationRewriteDone(state, NULL); + clientHttpLocationRewriteDone(http, NULL); else - locationRewriteStart(rep, state->http, clientHttpLocationRewriteDone, state); + locationRewriteStart(rep, http, clientHttpLocationRewriteDone, http); } static void clientHttpLocationRewriteDone(void *data, char *reply) { - clientCheckHeaderStateData *state = data; - clientHttpRequest *http = state->http; + clientHttpRequest *http = data; HttpReply *rep = http->reply; ConnStateData *conn = http->conn; if (!cbdataValid(http)) { /* oops.. */ - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); return; } if (reply && *reply) { @@ -2022,24 +2007,24 @@ httpHeaderPutStr(&rep->header, HDR_LOCATION, reply); } } - clientHttpReplyAccessCheck(state); + clientHttpReplyAccessCheck(http); } static void -clientHttpReplyAccessCheck(clientCheckHeaderStateData * state) +clientHttpReplyAccessCheck(clientHttpRequest * http) { aclCheck_t *ch; - if (!cbdataValid(state->http)) { + if (!cbdataValid(http)) { /* oops.. */ - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); return; } - if (Config.accessList.reply && state->http->log_type != LOG_TCP_DENIED && !clientAlwaysAllowResponse(state->http->reply->sline.status)) { - ch = clientAclChecklistCreate(Config.accessList.reply, state->http); - ch->reply = state->http->reply; - aclNBCheck(ch, clientHttpReplyAccessCheckDone, state); + if (Config.accessList.reply && http->log_type != LOG_TCP_DENIED && !clientAlwaysAllowResponse(http->reply->sline.status)) { + ch = clientAclChecklistCreate(Config.accessList.reply, http); + ch->reply = http->reply; + aclNBCheck(ch, clientHttpReplyAccessCheckDone, http); } else { - clientHttpReplyAccessCheckDone(ACCESS_ALLOWED, state); + clientHttpReplyAccessCheckDone(ACCESS_ALLOWED, http); } } @@ -2058,11 +2043,10 @@ static void clientHttpReplyAccessCheckDone(int answer, void *data) { - clientCheckHeaderStateData *state = data; - clientHttpRequest *http = state->http; - if (!cbdataValid(state->http)) { + clientHttpRequest *http = data; + if (!cbdataValid(http)) { /* oops.. */ - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); return; } debug(33, 2) ("The reply for %s %s is %s, because it matched '%s'\n", @@ -2085,20 +2069,19 @@ errorAppendEntry(http->entry, err); return; } - clientCheckErrorMap(state); + clientCheckErrorMap(http); } static void clientCheckErrorMapDone(StoreEntry * e, int body_offset, squid_off_t content_length, void *data) { - clientCheckHeaderStateData *state = data; - if (!cbdataValid(state->http)) { + clientHttpRequest *http = data; + if (!cbdataValid(http)) { /* oops.. */ - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); return; } if (e) { - clientHttpRequest *http = state->http; /* Get rid of the old request entry */ storeClientUnregister(http->sc, http->entry, http); storeUnlockObject(http->entry); @@ -2107,25 +2090,24 @@ storeLockObject(e); http->sc = storeClientRegister(http->entry, http); /* Adjust the header size */ - //state->http->reply->hdr_sz = body_offset; /* Clean up any old body content */ - httpBodyClean(&state->http->reply->body); + httpBodyClean(&http->reply->body); /* And finally, adjust content-length to the new value */ - httpHeaderDelById(&state->http->reply->header, HDR_CONTENT_LENGTH); + httpHeaderDelById(&http->reply->header, HDR_CONTENT_LENGTH); if (content_length >= 0) { - httpHeaderPutSize(&state->http->reply->header, HDR_CONTENT_LENGTH, content_length); + httpHeaderPutSize(&http->reply->header, HDR_CONTENT_LENGTH, content_length); } } - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); } + static void -clientCheckErrorMap(clientCheckHeaderStateData * state) +clientCheckErrorMap(clientHttpRequest * http) { - clientHttpRequest *http = state->http; - HttpReply *rep = state->http->reply; + HttpReply *rep = http->reply; if (!cbdataValid(http)) { /* oops.. */ - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); return; } if (rep->sline.status < 100 || rep->sline.status >= 400) { @@ -2133,10 +2115,10 @@ /* XXX The NULL is meant to pass ACL name, but the ACL name is not * known here (AclMatchedName is no longer valid) */ - if (errorMapStart(Config.errorMapList, request, rep, NULL, clientCheckErrorMapDone, state)) + if (errorMapStart(Config.errorMapList, request, rep, NULL, clientCheckErrorMapDone, http)) return; } - clientCheckHeaderDone(state); + clientCheckHeaderDone(http); } /* @@ -2149,12 +2131,10 @@ * from comm_write_mbuf(). */ static void -clientCheckHeaderDone(clientCheckHeaderStateData * state) +clientCheckHeaderDone(clientHttpRequest * http) { - HttpReply *rep = state->http->reply; - clientHttpRequest *http = state->http; + HttpReply *rep = http->reply; MemBuf mb; - cbdataFree(state); if (!cbdataValid(http)) goto aborted; /* reset range iterator */