conflicts between mod_fastcgi and mod_deflate

Yutaka OIWA <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hello developers,
  Thanks for developing an invaluable solution for web services.
  It greatly reduces an load on my web server.

By the way,
At least on Apache 2.0.52, mod_fastcgi conflicts with mod_deflate,
which provides gzip compression for encoding-capable browsers.
When mod_deflate is enabled via SetOutputFilter directive,
and if a response from FCGI script contains an Content-Length header,
the communication fails with broken HTTP protocol.
This is because the Apache returns the size of *uncompressed*
response for clients as it was contained in the original FCGI response,
although clients expect the size of compressed response.
Original mod_cgi module in the Apache distribution correctly works
under this setting.

My quick observation comparing mod_cgi and mod_fastcgi implementations
revealed that mod_fastcgi incorrectly stores the content of 
the Content-Length header into "headers_err_out" table,
which should be in "headers_out" table.  Mod_deflate removes (and rewrites)
the Content-Length header in the latter table only, but leaves ones
in the former table as-is.

I have implemented a dirty-hack for this problem
<http://www.yl.is.s.u-tokyo.ac.jp/~oiwa/pub/unix/fastcgi-content-length.patch>.
It moves Content-Length to headers_out table, 
in the same way that mod_fastcgi does for the Content-type header.

However, there seems to be more headers which require the
same sort of handling.
Mod_cgi uses a helper function ap_scan_script_header_err_brigade,
which knows the exact set of such special headers.
It seems better to use that helper also in mod_fastcgi.
However, I cannot find out the quick way to incorporate it into
mod_fastcgi with my current limited observation on mod_fastcgi sources,
because the mod_fastcgi handles roles other than "Responders" as well.
I hope someone can do a better job than my dirty patch.

-- 
Yutaka OIWA                   Yonezawa Lab., Dept. of Computer Science,
           Graduate School of Information Sci. & Tech., Univ. of Tokyo.
         Mail addresses: <[email protected]>, <[email protected]>
PGP fingerprints: (1) C9 8D 5C B8 86 ED D8 07  EA 59 34 D8 F4 65 53 61
                  (2) 3C21 17D0 D953 77D3 02D7 4FEC 4754 40C1 995D D3E1

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.