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

--- Comment #5 from Rainer Jung <[email protected]> ---
Some more information:

1) Reproduction
===============

I can easily reproduce with 2.4.x head using

Listen 9080
ProxyPass / http://localhost:8080/
CacheRoot /some/existing/path/cache
CacheEnable disk  /

and loading mod_proxy, mod_proxy_http, mod_cache and mod_cache_disk. I had many
more modules loaded but hope they don't interfere.

On port 8080 there was a Tomcat running.

To reproduce, start Tomcat and retrieve some CSS from Tomcat, e.g. the
tomcat.css from the default Tomcat ROOT context:

curl -v -D - http://localhost:9080/tomcat.css

Part of the response headers will be

Content-Type: text/css

Now stop tomcat and send the same request with the additional Header

Cache-Control: max-age=0

curl -v -D - -H 'Cache-Control: max-age=0' http://localhost:9080/tomcat.css

You will get

Content-Type: text/html; charset=iso-8859-1


2) Partial analysis
===================

I added some log outputs to check where the wrong content type is set.

- proxy_util fails to connect to the stopped Tomcat

[Wed Aug 15 10:55:37.446443 2012] [proxy:error] [pid 13963:tid 27]
(146)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8080
(localhost) failed

- proxy_util disables the worker

[Wed Aug 15 10:55:37.446559 2012] [proxy:error] [pid 13963:tid 27] AH00959:
ap_proxy_connect_backend disabling worker for (localhost) for 60s

- mod_proxy_http notices the failure, the proxy handler will return with
HTTP_SERVICE_UNAVAILABLE

[Wed Aug 15 10:55:37.446582 2012] [proxy_http:error] [pid 13963:tid 27] [client
127.0.0.1:38783] AH01114: HTTP: failed to make connection to backend: localhost

- cleanup in proxy_util

[Wed Aug 15 10:55:37.446602 2012] [proxy:debug] [pid 13963:tid 27]
proxy_util.c(1991): AH00943: HTTP: has released connection for (localhost)

- process_async_request calls ap_die() (log statement added)

[Wed Aug 15 10:55:37.446663 2012] [http:error] [pid 13963:tid 27] [client
127.0.0.1:38783] AH99999: Calling ap_die for 503 from process_async_request

- ap_die() calls ap_send_ap_send_error_response() (log statement added)

[Wed Aug 15 10:55:37.446707 2012] [http:error] [pid 13963:tid 27] [client
127.0.0.1:38783] AH99999: Calling ap_send_error_response from ap_die

- ap_send_error_response() calls ap_run_insert_error_filter() (log statement
added)

[Wed Aug 15 10:55:37.446739 2012] [http:error] [pid 13963:tid 27] [client
127.0.0.1:38783] AH99999: In ap_send_error_response calling
ap_run_insert_error_filter

- mod_cache sets correct Content-Type text/css (log statement added)

[Wed Aug 15 10:55:37.446762 2012] [cache:error] [pid 13963:tid 27] [client
127.0.0.1:38783] AH99999: Setting Content-Type to text/css

- end of ap_run_insert_error_filter() (log statement added)

[Wed Aug 15 10:55:37.446821 2012] [http:error] [pid 13963:tid 27] [client
127.0.0.1:38783] AH99999: In ap_send_error_response done
ap_run_insert_error_filter
- ap_send_error_response() sets wrong Content-Type text/html in "if
(!r->assbackwards) ..." branch around line 1230 in modules/http/http_protocol.c

[Wed Aug 15 10:55:37.446875 2012] [http:error] [pid 13963:tid 27] [client
127.0.0.1:38783] AH99999: Setting Content-Type in protocol to text/html;
charset=iso-8859-1

- Finally some more cache activity but no more calls to ap_set_content_type()
(the cache had already set its content type early)

[Wed Aug 15 10:55:37.446994 2012] [cache:debug] [pid 13963:tid 27]
mod_cache.c(564): [client 127.0.0.1:38783] AH00763: cache: running CACHE_OUT
filter
[Wed Aug 15 10:55:37.447037 2012] [cache:debug] [pid 13963:tid 27]
mod_cache.c(586): [client 127.0.0.1:38783] AH00764: cache: serving /tomcat.css

I do not know how to proceed from here, e.g. whether we should have not entered
ap_send_error_response() or the overwriting of the content type there needs to
be conditional, possibly suppressed by some env var or similar.

Any hints?

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to