httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Riggs <apache-li...@riggs.me>
Subject mod_proxy_ajp: ignoring flush before headers (again)
Date Tue, 02 Aug 2011 16:02:49 GMT
For some (old 2007) context, see:

http://markmail.org/message/btwcnbl2i7ftwj4n

https://community.jivesoftware.com/message/201787


I am proxying an app via AJP to Tomcat 6/7.  In certain circumstances, it appears that the
app (or possibly Tomcat) is erroneously sending a flush before the headers have been sent.
 In r579999, Jim added an exception to handle this situation with the intention of ignoring
the flush.  I'm not sure it's working quite right, though, as the brigade is still getting
passed through the filter chain.  So, ap_headers_output_filter() is getting called too soon,
I think.  (I am no expert in the httpd code, so I'm not sure this is really the problem.)

Can any of you who ARE experts in the code tell me what you think of the issue and how we
can fix it?  I'm thinking that if we are ignoring a flush at mod_proxy_ajp.c:448 (in 2.2.x),
we should not be calling ap_pass_brigade() at line 472, but I don't know if there are any
ramifications of that.

The symptom is that when this issue happens, the user gets prompted to save a file (Content-Type
returned by httpd is 'text/plain' even though Tomcat is returning 'text/html;charset=utf-8').
 Below is some debug output showing correct and incorrect behavior:

Correct:

[Tue Aug 02 09:34:50 2011] [debug] mod_proxy_ajp.c(266): proxy: APR_BUCKET_IS_EOS
[Tue Aug 02 09:34:50 2011] [debug] mod_proxy_ajp.c(271): proxy: data to read (max 8186 at
4)
[Tue Aug 02 09:34:50 2011] [debug] mod_proxy_ajp.c(286): proxy: got 0 bytes of data
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(687): ajp_read_header: ajp_ilink_received
04
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(697): ajp_parse_type: got 04
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(516): ajp_unmarshal_response: status = 200
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(537): ajp_unmarshal_response: Number of headers
is = 5
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[0] [Pragma]
= [No-cache]
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[1] [Cache-Control]
= [no-cache]
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[2] [Expires]
= [Wed, 31 Dec 1969 18:00:00 CST]
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[4] [Content-Type]
= [text/html;charset=utf-8]
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(609): ajp_unmarshal_response: ap_set_content_type
done
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(687): ajp_read_header: ajp_ilink_received
03
[Tue Aug 02 09:34:50 2011] [debug] ajp_header.c(697): ajp_parse_type: got 03
[Tue Aug 02 09:34:50 2011] [debug] mod_headers.c(756): headers: ap_headers_output_filter()


Incorrect (notice how ap_headers_output_filter() is called before the headers are received):

[Tue Aug 02 09:32:18 2011] [debug] mod_proxy_ajp.c(266): proxy: APR_BUCKET_IS_EOS
[Tue Aug 02 09:32:18 2011] [debug] mod_proxy_ajp.c(271): proxy: data to read (max 8186 at
4)
[Tue Aug 02 09:32:18 2011] [debug] mod_proxy_ajp.c(286): proxy: got 0 bytes of data
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(687): ajp_read_header: ajp_ilink_received
03
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(697): ajp_parse_type: got 03
[Tue Aug 02 09:32:18 2011] [debug] mod_proxy_ajp.c(452): Ignoring flush message received before
headers
[Tue Aug 02 09:32:18 2011] [debug] mod_headers.c(756): headers: ap_headers_output_filter()
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(687): ajp_read_header: ajp_ilink_received
03
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(697): ajp_parse_type: got 03
[Tue Aug 02 09:32:18 2011] [debug] mod_proxy_ajp.c(452): Ignoring flush message received before
headers
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(687): ajp_read_header: ajp_ilink_received
04
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(697): ajp_parse_type: got 04
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(516): ajp_unmarshal_response: status = 200
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(537): ajp_unmarshal_response: Number of headers
is = 5
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[0] [Pragma]
= [No-cache]
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[1] [Cache-Control]
= [no-cache]
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[2] [Expires]
= [Wed, 31 Dec 1969 18:00:00 CST]
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[3] [Set-Cookie]
= [JSESSIONID=39968855F543CA08A440E6136EA6FC28.app1; Path=/tomcat-manager; Secure; HttpOnly]
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(599): ajp_unmarshal_response: Header[4] [Content-Type]
= [text/html;charset=utf-8]
[Tue Aug 02 09:32:18 2011] [debug] ajp_header.c(609): ajp_unmarshal_response: ap_set_content_type
done


Mime
View raw message