diff options
author | rsc <devnull@localhost> | 2004-12-27 00:13:04 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-12-27 00:13:04 +0000 |
commit | 4bef0baf95850b1ee0fa5f5a8fda20872ce59426 (patch) | |
tree | cd8030874844ac591e518c1dd781a8311110b036 | |
parent | 94235a8b4bdd20766b41302fa21a31df660b078b (diff) | |
download | plan9port-4bef0baf95850b1ee0fa5f5a8fda20872ce59426.tar.gz plan9port-4bef0baf95850b1ee0fa5f5a8fda20872ce59426.tar.bz2 plan9port-4bef0baf95850b1ee0fa5f5a8fda20872ce59426.zip |
changes from plan 9
-rw-r--r-- | src/libhttpd/date.c | 1 | ||||
-rw-r--r-- | src/libhttpd/hio.c | 20 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/libhttpd/date.c b/src/libhttpd/date.c index 450f60f7..33349578 100644 --- a/src/libhttpd/date.c +++ b/src/libhttpd/date.c @@ -197,6 +197,7 @@ hdate2sec(char *date) strcpy(tm.zone, "GMT"); tm.tzoff = 0; + tm.yday = 0; return tm2sec(&tm); } diff --git a/src/libhttpd/hio.c b/src/libhttpd/hio.c index a89f311d..937997d0 100644 --- a/src/libhttpd/hio.c +++ b/src/libhttpd/hio.c @@ -283,7 +283,7 @@ hload(Hio *h, char *buf) s = strchr(hxfers, buf[1]); if(s == nil) - return 0; + return -1; h->xferenc = s - hxfers; t = h->start; @@ -393,8 +393,8 @@ hprint(Hio *h, char *fmt, ...) return n; } -int -hflush(Hio *h) +static int +_hflush(Hio *h, int dolength) { uchar *s; int w; @@ -417,6 +417,8 @@ hflush(Hio *h) h->pos[1] = '\n'; w = &h->pos[2] - s; } + if(dolength) + fprint(h->fd, "Content-Length: %d\r\n\r\n", w); if(write(h->fd, s, w) != w){ h->state = Herr; h->stop = h->pos; @@ -428,6 +430,18 @@ hflush(Hio *h) } int +hflush(Hio *h) +{ + return _hflush(h, 0); +} + +int +hlflush(Hio* h) +{ + return _hflush(h, 1); +} + +int hwrite(Hio *h, void *vbuf, int len) { uchar *pos, *buf; |