URI: 
       tfix various chunked-related bugs - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit f599f28c339fdd6018d64e71a7d49d8c515c2cde
   DIR parent 6ce75e8dc072178f410db9a6ae7d70a5101e640c
  HTML Author: rsc <devnull@localhost>
       Date:   Sat, 21 Apr 2007 19:48:16 +0000
       
       fix various chunked-related bugs
       
       Diffstat:
         M src/libhttpd/hio.c                  |      13 ++++++++-----
       
       1 file changed, 8 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/src/libhttpd/hio.c b/src/libhttpd/hio.c
       t@@ -4,6 +4,7 @@
        
        static        char        hstates[] = "nrewE";
        static        char        hxfers[] = " x";
       +static int _hflush(Hio*, int, int);
        
        int
        hinit(Hio *h, int fd, int mode)
       t@@ -326,7 +327,7 @@ hxferenc(Hio *h, int on)
        {
                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;
       t@@ -375,7 +376,7 @@ hvprint(Hio *h, char *fmt, va_list args)
                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;
       t@@ -394,7 +395,7 @@ hprint(Hio *h, char *fmt, ...)
        }
        
        static int
       -_hflush(Hio *h, int dolength)
       +_hflush(Hio *h, int force, int dolength)
        {
                uchar *s;
                int w;
       t@@ -406,6 +407,8 @@ _hflush(Hio *h, int dolength)
                }
                s = h->start;
                w = h->pos - s;
       +        if(w == 0 && !force)
       +                return 0;
                if(h->xferenc){
                        *--s = '\n';
                        *--s = '\r';
       t@@ -432,13 +435,13 @@ _hflush(Hio *h, int dolength)
        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