tchanges from plan 9 - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 4bef0baf95850b1ee0fa5f5a8fda20872ce59426
parent 94235a8b4bdd20766b41302fa21a31df660b078b
Author: rsc 
Date:   Mon, 27 Dec 2004 00:13:04 +0000

changes from plan 9

Diffstat:
  M src/libhttpd/date.c                 |       1 +
  M src/libhttpd/hio.c                  |      20 +++++++++++++++++---

2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/libhttpd/date.c b/src/libhttpd/date.c
t@@ -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
t@@ -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;
t@@ -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;
t@@ -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;
t@@ -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;