fixed problem on gzip streams (bug #438045) fixed minor spot of redundant

* nanohttp.c: fixed problem on gzip streams (bug #438045)
* xpath.c: fixed minor spot of redundant code - no logic change.

svn path=/trunk/; revision=3616
diff --git a/nanohttp.c b/nanohttp.c
index 26b5d7e..51bb898 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -1204,17 +1204,19 @@
         ctxt->strm->next_out = dest;
         ctxt->strm->avail_out = len;
 
-        do {
-            orig_avail_in = ctxt->strm->avail_in = ctxt->inptr - ctxt->inrptr - bytes_read;
+        while (ctxt->strm->avail_out > 0 && xmlNanoHTTPRecv(ctxt) > 0) {
+            orig_avail_in = ctxt->strm->avail_in =
+			    ctxt->inptr - ctxt->inrptr - bytes_read;
             ctxt->strm->next_in = BAD_CAST (ctxt->inrptr + bytes_read);
 
             z_ret = inflate(ctxt->strm, Z_NO_FLUSH);
             bytes_read += orig_avail_in - ctxt->strm->avail_in;
 
             if (z_ret != Z_OK) break;
-        } while (ctxt->strm->avail_out > 0 && xmlNanoHTTPRecv(ctxt) > 0);
+	}
 
         ctxt->inrptr += bytes_read;
+	ctxt->strm->avail_in = ctxt->inptr - ctxt->inrptr;
         return(len - ctxt->strm->avail_out);
     }
 #endif