oschaaf commented on a change in pull request #1785: Fix mismatch between 
decompression and headers
URL: 
https://github.com/apache/incubator-pagespeed-mod/pull/1785#discussion_r209076280
 
 

 ##########
 File path: net/instaweb/rewriter/resource.cc
 ##########
 @@ -269,17 +270,38 @@ void Resource::LinkFallbackValue(HTTPValue* value) {
 }
 
 StringPiece Resource::ExtractUncompressedContents() const {
-  ResponseHeaders headers;
-  if (!extracted_ && value_.ExtractHeaders(&headers, NULL)) {
-    if (headers.IsGzipped()) {
-      StringWriter inflate_writer(&extracted_contents_);
-      if (GzipInflater::Inflate(raw_contents(), GzipInflater::kGzip,
-                                &inflate_writer)) {
-        extracted_ = true;
-      }
+  bool use_extracted = EnsureExtractedIfNeeded();
+  return use_extracted ? extracted_contents_ : raw_contents();
+}
+
+const ResponseHeaders* Resource::UncompressedHeaders() const {
+  bool use_extracted = EnsureExtractedIfNeeded();
+  return use_extracted ? extracted_headers_.get() : response_headers();
+}
+
+bool Resource::EnsureExtractedIfNeeded() const {
+  if (extracted_state_ == kExtractNotComputed) {
 
 Review comment:
   Ugh, I'm having a real problem fixing the problem with libpng failing on 
single-threaded builds. I have been at it all day, but no luck yet.
   
   Apparently there is an ordering issue that gets masked when using -j in 
make. The problem is that the dependency declarations for libpng look good to 
me, yet somehow the action [1] responsible for copying a required header file 
isn't always running timely when it ought to.
   
   [1] 
https://github.com/apache/incubator-pagespeed-mod/blob/master/third_party/libpng/libpng.gyp#L27
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to