You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2013/09/14 22:03:22 UTC

[Bug 55558] New: mod_proxy_fcgi+mod_deflate error with header-only output stream record

https://issues.apache.org/bugzilla/show_bug.cgi?id=55558

            Bug ID: 55558
           Summary: mod_proxy_fcgi+mod_deflate error with header-only
                    output stream record
           Product: Apache httpd-2
           Version: 2.4-HEAD
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: mod_proxy_fcgi
          Assignee: bugs@httpd.apache.org
          Reporter: jim@riggs.me

Created attachment 30840
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30840&action=edit
Do not pass empty brigades to output filters in mod_proxy_fcgi.

OK...this one took me forever to track down. We are using mod_proxy_fcgi to
proxy to Wordpress instances processed via php-fpm. There are certain pages on
three of our sites that return gzip-encoded data without a Content-Encoding
header. I hadn't been able to track down the issue, so I just disabled gzip for
those URLs. On the new site we are setting up now, almost every URL on the site
was displaying this behavior. After spending much time stepping through the
code in gdb, I finally found the issue:

If the first fcgi response (STDOUT) stream record contains all of the headers
and ONLY the headers (no response data), the call to
ap_scan_script_header_err_brigade_ex() on lines 744-745 empties the brigade.
The subsequent call to ap_pass_brigade() on line 775 passes an empty brigade to
the output filters. When mod_deflate receives an empty brigade, it skips
processing, so the Vary and Content-Encoding headers are not set, and the
existing headers are passed through in the response.

When subsequent fcgi response stream records are received, the brigades are not
empty, and are properly passed to the output filters. Mod_deflate
processes/compresses the brigades, and the Vary and Content-Encoding headers
are set in r->headers_out; however, the headers have already been buffered or
sent down the line, so the client does not see them.

The result is that the client receives a gzip-encoded response without the
necessary Content-Encoding header set.

The extremely simple attached patch simply bypasses the ap_pass_brigade() call
on the first stream record if the output brigade has been emptied by
ap_scan_script_header_err_brigade_ex(). Apparently this is a fairly common
occurrence...at least with php-fpm.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55558] mod_proxy_fcgi+mod_deflate error with header-only output stream record

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55558

Jeff Trawick <tr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Jeff Trawick <tr...@apache.org> ---
This was released in 2.4.10.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55558] mod_proxy_fcgi+mod_deflate error with header-only output stream record

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55558

Jeff Trawick <tr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55558] mod_proxy_fcgi+mod_deflate error with header-only output stream record

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55558

Jim Riggs <ji...@riggs.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jim@riggs.me

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55558] mod_proxy_fcgi+mod_deflate error with header-only output stream record

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55558

--- Comment #1 from Jeff Trawick <tr...@apache.org> ---
Committed to trunk as r1585824...  Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55558] mod_proxy_fcgi+mod_deflate error with header-only output stream record

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55558

Jim Riggs <ji...@riggs.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #30840|0                           |1
           is patch|                            |

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 55558] mod_proxy_fcgi+mod_deflate error with header-only output stream record

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55558

--- Comment #2 from Jeff Trawick <tr...@apache.org> ---
proposed for backport to 2.4.x branch...

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org