htget: dump rest of lines buffer before main content xfer
authorBrett Gordon <beretta42@gmail.com>
Sat, 11 Nov 2017 20:26:44 +0000 (15:26 -0500)
committerBrett Gordon <beretta42@gmail.com>
Sat, 11 Nov 2017 20:26:44 +0000 (15:26 -0500)
Applications/netd/htget.c

index 14aa19a..6e40a43 100644 (file)
@@ -185,6 +185,10 @@ int main(int argc, char *argv[])
     /* FIXME: if we saw a Transfer-Encoding: chunked" we need to do this
        bit differently */
     if (code == 200) {
+       if (write(of, readp, bufend - readp) < 0){
+           perror("write");
+           exit(1);
+       }
         while((len = xread()) > 0) {
             if (write(of, buf, len) != len) {
                 perror("write");