]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/HttpReply.cc
Bug #874: rough port of the http_reply_header_size functionality
[thirdparty/squid.git] / src / HttpReply.cc
index 8cce8fff76ec1f384915bebd59b669a5effaf2a1..ad557ca99542bf45973467aeae3b8c2bec7dd01b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpReply.cc,v 1.69 2004/12/20 16:30:32 robertc Exp $
+ * $Id: HttpReply.cc,v 1.70 2004/12/21 17:52:53 robertc Exp $
  *
  * DEBUG: section 58    HTTP Reply (Response)
  * AUTHOR: Alex Rousskov
@@ -151,16 +151,17 @@ httpReplyParse(HttpReply * rep, const char *buf, ssize_t end)
      * becuase somebody may feed a non NULL-terminated buffer to
      * us.
      */
-    char *headers = (char *)memAllocate(MEM_4K_BUF);
+    MemBuf mb = MemBufNull;
     int success;
-    size_t s = XMIN(end + 1, (ssize_t)4096);
     /* reset current state, because we are not used in incremental fashion */
     httpReplyReset(rep);
     /* put a string terminator.  s is how many bytes to touch in
      * 'buf' including the terminating NULL. */
-    xstrncpy(headers, buf, s);
-    success = httpReplyParseStep(rep, headers, 0);
-    memFree(headers, MEM_4K_BUF);
+    memBufDefInit(&mb);
+    memBufAppend(&mb, buf, end);
+    memBufAppend(&mb, "\0", 1);
+    success = httpReplyParseStep(rep, mb.buf, 0);
+    memBufClean(&mb);
     return success == 1;
 }