changes from plan 9

This commit is contained in:
rsc 2004-12-27 00:13:04 +00:00
parent 94235a8b4b
commit 4bef0baf95
2 changed files with 18 additions and 3 deletions

View file

@ -197,6 +197,7 @@ hdate2sec(char *date)
strcpy(tm.zone, "GMT");
tm.tzoff = 0;
tm.yday = 0;
return tm2sec(&tm);
}

View file

@ -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;
@ -427,6 +429,18 @@ hflush(Hio *h)
return 0;
}
int
hflush(Hio *h)
{
return _hflush(h, 0);
}
int
hlflush(Hio* h)
{
return _hflush(h, 1);
}
int
hwrite(Hio *h, void *vbuf, int len)
{