/*
- * $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
* 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;
}