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_r201374149
 
 

 ##########
 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. Manually cp'ing third_party/libpng/src/scripts/pnglibconf.h.prebuilt to 
third_party/libpng/src/pnglibconf.h should work.
   
   This happens because a build execution step isn't always executed timely. I 
run make with `-j8`  which seems to mask the problem. But with -j1 the problem 
does show on my system.
   
   
   In https://github.com/apache/incubator-pagespeed-mod/pull/1739 I backed out 
two commits that attempted to fix that to avoid conflicting with Ashish his 
work:
   - 
https://github.com/apache/incubator-pagespeed-mod/pull/1739/commits/2b4ae6032986654dc73ceee48e9f70de9267a9ad
   - 
https://github.com/apache/incubator-pagespeed-mod/pull/1739/commits/f72e2111070dc07030e0390dfe07f7ae65d78826
   
   Let me try with those again to see if they fix the problem.
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to