commit - 6ce75e8dc072178f410db9a6ae7d70a5101e640c
commit + f599f28c339fdd6018d64e71a7d49d8c515c2cde
blob - b404cf4c306ecab8ca513f352946eecc25de3487
blob + 97d13617385c74a9e50dc29b5d478ca34b38322f
--- src/libhttpd/hio.c
+++ src/libhttpd/hio.c
static char hstates[] = "nrewE";
static char hxfers[] = " x";
+static int _hflush(Hio*, int, int);
int
hinit(Hio *h, int fd, int mode)
{
if(h->xferenc && !on && h->pos != h->start)
hflush(h);
- if(hflush(h) < 0)
+ if(_hflush(h, 1, 0) < 0)
return -1;
h->xferenc = !!on;
return 0;
f.flush = fmthflush;
f.farg = h;
f.nfmt = 0;
- fmtlocaleinit(&f, nil, nil, nil);
+// fmtlocaleinit(&f, nil, nil, nil);
n = fmtvprint(&f, fmt, args);
h->pos = f.to;
return n;
}
static int
-_hflush(Hio *h, int dolength)
+_hflush(Hio *h, int force, int dolength)
{
uchar *s;
int w;
}
s = h->start;
w = h->pos - s;
+ if(w == 0 && !force)
+ return 0;
if(h->xferenc){
*--s = '\n';
*--s = '\r';
int
hflush(Hio *h)
{
- return _hflush(h, 0);
+ return _hflush(h, 0, 0);
}
int
hlflush(Hio* h)
{
- return _hflush(h, 1);
+ return _hflush(h, 0, 1);
}
int