read header until \r\n\r\n or \n\n

This commit is contained in:
Hiltjo Posthuma 2014-08-20 13:48:18 +00:00 committed by FRIGN
parent 19fbedc39a
commit 9fd46fd50e

View file

@ -447,7 +447,7 @@ request(void) {
/* read request into reqbuf (MAXBUFLEN byte of reqbuf is emergency 0 terminator */ /* read request into reqbuf (MAXBUFLEN byte of reqbuf is emergency 0 terminator */
for (; (r = read(req.fd, reqbuf + offset, MAXBUFLEN - offset)) > 0 && offset < MAXBUFLEN for (; (r = read(req.fd, reqbuf + offset, MAXBUFLEN - offset)) > 0 && offset < MAXBUFLEN
&& (!strstr(reqbuf, "\r\n") || !strstr(reqbuf, "\n")); ) && !strstr(reqbuf, "\r\n\r\n") && !strstr(reqbuf, "\n\n"); )
{ {
offset += r; offset += r;
reqbuf[offset] = 0; reqbuf[offset] = 0;