aboutsummaryrefslogtreecommitdiff
path: root/src/libhttpd/gethead.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libhttpd/gethead.c')
-rw-r--r--src/libhttpd/gethead.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/libhttpd/gethead.c b/src/libhttpd/gethead.c
index 5983345e..0677cc8f 100644
--- a/src/libhttpd/gethead.c
+++ b/src/libhttpd/gethead.c
@@ -15,15 +15,11 @@ hgethead(HConnect *c, int many)
int n;
hin = &c->hin;
-fprint(2, "hgethead top %p - %p\n", hin->pos, hin->stop);
for(;;){
s = (char*)hin->pos;
pp = s;
-fprint(2, "hgethead %p - %p\n", pp, hin->stop);
while(p = memchr(pp, '\n', (char*)hin->stop - pp)){
-fprint(2, "hgethead %p - %p newline at %p %d\n", pp, hin->stop, p, *pp);
if(!many || p == pp || (p == pp + 1 && *pp == '\r')){
-fprint(2, "breaking\n");
pp = p + 1;
break;
}
@@ -32,14 +28,13 @@ fprint(2, "breaking\n");
hin->pos = (uchar*)pp;
n = pp - s;
if(c->hstop + n > &c->header[HBufSize])
- return 0;
+ return -1;
memmove(c->hstop, s, n);
c->hstop += n;
*c->hstop = '\0';
-fprint(2, "p %p\n", p);
if(p != nil)
- return 1;
- if(hreadbuf(hin, hin->pos) == nil || hin->state == Hend)
return 0;
+ if(hreadbuf(hin, hin->pos) == nil || hin->state == Hend)
+ return -1;
}
}