* if we fail to compress, don't add gzip header and logwarn + backtrace
authorWilfried Göesgens <willi@citadel.org>
Tue, 21 Jul 2009 22:11:30 +0000 (22:11 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 21 Jul 2009 22:11:30 +0000 (22:11 +0000)
webcit/tcp_sockets.c

index 15a1c1c6998200697a708adcc23c62fb3e68abfc..02515306be01435b324767c9e3ab87de76e2021f 100644 (file)
@@ -602,9 +602,14 @@ long end_burst(void)
         fd_set wset;
         int fdflags;
 
-       if (!DisableGzip && (WCC->Hdr->HR.gzip_ok) && CompressBuffer(WCC->WBuf))
+       if (!DisableGzip && (WCC->Hdr->HR.gzip_ok))
        {
-               hprintf("Content-encoding: gzip\r\n");
+               if (CompressBuffer(WCC->WBuf) > 0)
+                       hprintf("Content-encoding: gzip\r\n");
+               else {
+                       lprintf(CTDL_ALERT, "Compression failed: %d [%s] sending uncompressed\n", errno, strerror(errno));
+                       wc_backtrace();
+               }
        }
 
        if (WCC->Hdr->HR.prohibit_caching)