diff options
author | rsc <devnull@localhost> | 2004-03-21 04:33:13 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-03-21 04:33:13 +0000 |
commit | 2277c5d7bbe1f9595fad512d8f790708473a9bf1 (patch) | |
tree | 4d653e13906f1971d3170dba6dbe0fbf92eb48d6 /src/libhttpd | |
parent | a770daa795754cb600ad3fab2fdd2961147006c4 (diff) | |
download | plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.tar.gz plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.tar.bz2 plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.zip |
Small tweaks
Lots of new code imported.
Diffstat (limited to 'src/libhttpd')
-rw-r--r-- | src/libhttpd/gethead.c | 7 | ||||
-rw-r--r-- | src/libhttpd/hio.c | 13 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/libhttpd/gethead.c b/src/libhttpd/gethead.c index 91abc7c9..5983345e 100644 --- a/src/libhttpd/gethead.c +++ b/src/libhttpd/gethead.c @@ -15,11 +15,15 @@ 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)){ - if(!many || p == pp || p == pp + 1 && *pp == '\r'){ +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,6 +36,7 @@ hgethead(HConnect *c, int many) 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) diff --git a/src/libhttpd/hio.c b/src/libhttpd/hio.c index 7cfb5557..34d3a3a2 100644 --- a/src/libhttpd/hio.c +++ b/src/libhttpd/hio.c @@ -157,10 +157,15 @@ hreadbuf(Hio *h, void *vsave) memmove(h->start + cpy, hh->pos, in); hh->pos += in; } - }else if(in && (in = read(h->fd, h->start + cpy, in)) < 0){ - h->state = Herr; - h->pos = h->stop; - return nil; + }else if(in){ +fprint(2, "read %d from %d\n", in, h->fd); + if((in = read(h->fd, h->start + cpy, in)) < 0){ +fprint(2, "got error: %r\n"); + h->state = Herr; + h->pos = h->stop; + return nil; + } +fprint(2, "got %d\n", in); } if(in == 0) h->state = Hend; |