Bug 713480 - Compressed entries stored as files are padded with zero bytes to the length of uncompressed size
☠☠ backed out by 4f2f486f898f ☠ ☠
authorMichal Novotny <michal.novotny@gmail.com>
Tue, 10 Jan 2012 15:22:42 +0100
changeset 85347 a76df5ba3dc224c9856ef98718781ccaae74de48
parent 85346 0f5d650bf2eb72bb6b3dbab80bd1435e20f4d3bf
child 85348 d58132b4ecc400ab71e5971d606775eba3a732cf
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs713480
milestone12.0a1
Bug 713480 - Compressed entries stored as files are padded with zero bytes to the length of uncompressed size
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3222,16 +3222,20 @@ nsHttpChannel::InstallCacheListener(PRUi
          mResponseHead->ContentType().EqualsLiteral(APPLICATION_JAVASCRIPT) ||
          mResponseHead->ContentType().EqualsLiteral(APPLICATION_ECMASCRIPT) ||
          mResponseHead->ContentType().EqualsLiteral(APPLICATION_XJAVASCRIPT) ||
          mResponseHead->ContentType().EqualsLiteral(APPLICATION_XHTML_XML))) {
         rv = mCacheEntry->SetMetaDataElement("uncompressed-len", "0"); 
         if (NS_FAILED(rv)) {
             LOG(("unable to mark cache entry for compression"));
         }
+
+        // Predicted datasize is unknown in case of compression
+        rv = mCacheEntry->SetPredictedDataSize(-1);
+        if (NS_FAILED(rv)) return rv;
     } 
       
     nsCOMPtr<nsIOutputStream> out;
     rv = mCacheEntry->OpenOutputStream(offset, getter_AddRefs(out));
     if (NS_FAILED(rv)) return rv;
 
     // XXX disk cache does not support overlapped i/o yet
 #if 0