--------------------- PatchSet 10376 Date: 2008/01/06 10:13:39 Author: adri Branch: s27_adri Tag: (none) Log: Fix the code to (almost) do what the existing reply parser does. Unfortunately my hdr_sz isn't including the trailing \r\n, so I need to figure out why thats the case and fix it in the next commit. Members: libhttp/HttpHeader.c:1.1.2.3->1.1.2.4 src/HttpReply.c:1.23.6.1.4.3->1.23.6.1.4.4 Index: squid/libhttp/HttpHeader.c =================================================================== RCS file: /cvsroot/squid-sf//squid/libhttp/Attic/HttpHeader.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid/libhttp/HttpHeader.c 6 Jan 2008 09:56:00 -0000 1.1.2.3 +++ squid/libhttp/HttpHeader.c 6 Jan 2008 10:13:39 -0000 1.1.2.4 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.c,v 1.1.2.3 2008/01/06 09:56:00 adri Exp $ + * $Id: HttpHeader.c,v 1.1.2.4 2008/01/06 10:13:39 adri Exp $ */ #include @@ -88,7 +88,7 @@ int n = offset; int fs, fe, vs, ve; char *b = buf_buf(buf); - int retcode = 0; /* 0 - exit, more data plz; -1 = exit, error plz; 1 = exit, completed! */ + int retcode = 0; /* 0 - exit, more data plz; -1 = exit, error plz; >0 = exit, completed! */ /* * We'll loop through until we find: @@ -212,7 +212,7 @@ //ph->bofs = n; /* next line! */ } - return retcode; + return n - offset; } /* Index: squid/src/HttpReply.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpReply.c,v retrieving revision 1.23.6.1.4.3 retrieving revision 1.23.6.1.4.4 diff -u -r1.23.6.1.4.3 -r1.23.6.1.4.4 --- squid/src/HttpReply.c 6 Jan 2008 09:19:53 -0000 1.23.6.1.4.3 +++ squid/src/HttpReply.c 6 Jan 2008 10:13:39 -0000 1.23.6.1.4.4 @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.c,v 1.23.6.1.4.3 2008/01/06 09:19:53 adri Exp $ + * $Id: HttpReply.c,v 1.23.6.1.4.4 2008/01/06 10:13:39 adri Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -422,6 +422,7 @@ assert(rep->pstate < psParsed); /* For now we'll assume we need to parse the whole lot */ + httpReplyReset(rep); /* Find end of start line */ re = memchr(buf, '\n', len); @@ -449,7 +450,8 @@ /* Update rep */ httpReplyHdrCacheInit(rep); /* the previous code had hdr_sz including the status line + headers and final \r\n */ - rep->hdr_sz = ret - offset; + /* XXX at the moment ret + i doesn't include the final \r\n; so it gets incl. in the body! bad adrian! */ + rep->hdr_sz = ret + i; rep->pstate++; /* Done */