--------------------- PatchSet 10330 Date: 2007/12/28 02:23:59 Author: adri Branch: s27_adri Tag: (none) Log: Change the header parsing code to take (buf, len) , parse_start. This is closer to what the reference buffer stuff wants and will make modifying the code to use said reference buffering easier in the future. Members: src/http.c:1.63.2.3.4.22->1.63.2.3.4.23 Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.63.2.3.4.22 retrieving revision 1.63.2.3.4.23 diff -u -r1.63.2.3.4.22 -r1.63.2.3.4.23 --- squid/src/http.c 27 Dec 2007 10:04:47 -0000 1.63.2.3.4.22 +++ squid/src/http.c 28 Dec 2007 02:23:59 -0000 1.63.2.3.4.23 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.63.2.3.4.22 2007/12/27 10:04:47 adri Exp $ + * $Id: http.c,v 1.63.2.3.4.23 2007/12/28 02:23:59 adri Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -425,13 +425,18 @@ * chunk. */ static size_t -httpProcessReplyHeaderBlock(HttpStateData * httpState, const char *buf, int size) +httpProcessReplyHeaderBlock(HttpStateData * httpState, const char *o_buf, int o_size, int parse_start) { StoreEntry *entry = httpState->entry; size_t hdr_len; size_t hdr_size; HttpReply *reply = entry->mem_obj->reply; Ctx ctx = ctx_enter(entry->mem_obj->url); + const char *buf = o_buf + parse_start; + int size = o_size - parse_start; + + assert(size >= 0); + debug(11, 3) ("httpProcessReplyHeader: key '%s'\n", storeKeyText(entry->hash.key)); @@ -486,7 +491,7 @@ httpState->reply_hdr_state = 0; ctx_exit(ctx); if (hdr_size < size) - return hdr_size + httpProcessReplyHeaderBlock(httpState, buf + hdr_size, size - hdr_size); + return hdr_size + httpProcessReplyHeaderBlock(httpState, buf, size, hdr_size); else return hdr_size; } @@ -938,7 +943,7 @@ /* Fake an "end-of-headers" to work around such broken servers */ memBufAppend(&httpState->reply_hdr, "\r\n", 2); assert(buf_start < httpState->reply_hdr.size); - httpProcessReplyHeaderBlock(httpState, httpState->reply_hdr.buf + buf_start, httpState->reply_hdr.size - buf_start); + httpProcessReplyHeaderBlock(httpState, httpState->reply_hdr.buf, httpState->reply_hdr.size, buf_start); } if (entry->mem_obj->reply->sline.status == HTTP_HEADER_TOO_LARGE) { storeEntryReset(entry); @@ -962,7 +967,7 @@ */ storeBuffer(entry); assert(buf_start < httpState->reply_hdr.size); - done = httpProcessReplyHeaderBlock(httpState, httpState->reply_hdr.buf + buf_start, httpState->reply_hdr.size - buf_start); + done = httpProcessReplyHeaderBlock(httpState, httpState->reply_hdr.buf, httpState->reply_hdr.size, buf_start); if (httpState->reply_hdr_state == 2) { http_status s = entry->mem_obj->reply->sline.status; if (s == HTTP_HEADER_TOO_LARGE) {