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 2007/08/08 15:37:38 UTC
DO NOT REPLY [Bug 43060] New: - mod_proxy_ajp: HEAD requests sent as GET
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43060>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43060
Summary: mod_proxy_ajp: HEAD requests sent as GET
Product: Apache httpd-2
Version: 2.3-HEAD
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: mod_proxy
AssignedTo: bugs@httpd.apache.org
ReportedBy: jim@apache.org
The situation is as follows (you might include this in the bug description):
Apache httpd decodes HTTP methods as method_number. HTTP HEAD and GET get the same
method_number. To make HEAD distinguishable form GET, adiitionally header_only gets set for a HEAD
request.
mod_proxy_ajp only decodes the method_number and doesn't check the header_only flag. So every
HEAD request gets forwarded as a GET request.
In order to fix the forwarding, one has to improve ajp_marshal_into_msgb() in ajp_header.c and also
ap_proxy_ajp_request(9 in mod_proxy_ajp.c. A patch against 2.2.4 could be close to the following (I
didn't test, I didn't even compile it):
Index: mod_proxy_ajp.c
===============================================================
====
--- mod_proxy_ajp.c (revision 563796)
+++ mod_proxy_ajp.c (working copy)
@@ -313,6 +313,16 @@
break;
case CMD_AJP13_SEND_BODY_CHUNK:
/* AJP13_SEND_BODY_CHUNK: piece of data */
+ if (r->header_only) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "proxy: header only");
+ isok = 0;
+ /* Pass EOS bucket down the filter chain. */
+ e = apr_bucket_eos_create(r->connection->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(output_brigade, e);
+ apr_brigade_cleanup(output_brigade);
+ break;
+ }
status = ajp_parse_data(r, conn->data, &size, &buff);
if (status == APR_SUCCESS) {
if (size == 0) {
Index: ajp_header.c
===============================================================
====
--- ajp_header.c (revision 563796)
+++ ajp_header.c (working copy)
@@ -224,6 +224,9 @@
r->method);
return AJP_EBAD_METHOD;
}
+ if ((method == SC_M_GET) && r->header_only) {
+ method = SC_M_HEAD;
+ }
is_ssl = (apr_byte_t) ap_proxy_conn_is_https(r->connection);
Regards,
Rainer
Chad Scholes wrote:
I am using Apache 2.2.3 and Tomcat 5.0. I use ProxyPass to ajp to
send Servlet requests from Apache to Tomcat and for some reason all
HEAD requests are being sent to my servlets as GET requests. I
probably don't have something setup correctly but I don't know what
would affect the HEAD request.
My Apache configuration for ProxyPass is set like:
Alias /qfsearch "/var/lib/qfsearch/docs" <Location "/qfsearch"> Allow
from all </Location> ProxyPass /qfsearch
ajp://localhost:9009/qfsearch
mod_proxy and mod_rewrite are setup as:
<IfModule mod_proxy.c> <Proxy *> Order deny,allow Deny from all </Proxy> ProxyRequests Off </
IfModule>
<IfModule mod_rewrite.c> RewriteEngine On RewriteLog
/var/log/apache2/rewrite_log RewriteLogLevel 1 </IfModule>
In the apache access log the request is getting to apache as a "HEAD"
request: 137.65.79.137 - - [06/Aug/2007:14:33:45 -0600] "HEAD
/qfsearch/ClusterServlet?
server=qfsearch3.provo.novell.com&type=index&putname=duh&putsubname=qfind.idx&idxdatetime=
1186176509000&idxlocation=%2Fvar%2Flib%2Fqfsearch%2FSites%2Fdefault%2Findexes%2Fduh%
2F2007-08-03%3B
+15.28.29&put=qfind.idx&filesize=11709498&datetime=1186176509000&do=canput
HTTP/1.1" 503 - "-" "Java/1.5.0"
However, I have a servlet that overrides the service function and in
that call request.getMethod() and it is now returning "GET" not
"HEAD".
If I call Tomcat directly then everything works fine
(request.getMethod() returns "HEAD"). This particular section of code
has been working for years with the JKMount command but now that we
have changed to the ProxyPass it is not working. If you have any
ideas what could be wrong I would appreciate the help!
Thanks you!! Chad
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 43060] - mod_proxy_ajp: HEAD requests sent as GET
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43060>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43060
------- Additional Comments From rpluem@apache.org 2007-09-12 00:42 -------
Proposed for backport as r574823.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 43060] - mod_proxy_ajp: HEAD requests sent as GET
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43060>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43060
------- Additional Comments From rpluem@apache.org 2007-12-11 05:14 -------
Backported to 2.2.x
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 43060] - mod_proxy_ajp: HEAD requests sent as GET
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43060>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43060
jim@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From jim@apache.org 2007-09-09 09:22 -------
in trunk (r574024)
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 43060] - mod_proxy_ajp: HEAD requests sent as GET
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43060>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43060
jorton@redhat.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jim@apache.org
AssignedTo|jim@apache.org |bugs@httpd.apache.org
------- Additional Comments From jorton@redhat.com 2007-08-09 03:22 -------
[changing the bug assignment field means that the bugs@ mailing list never gets
copies -- fixed]
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 43060] - mod_proxy_ajp: HEAD requests sent as GET
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43060>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43060
------- Additional Comments From rpluem@apache.org 2007-08-13 04:01 -------
I think the fix to ajp_header is sufficient as for header_only requests response
bodys get discarded by http_filters.c:ap_http_header_filter.
Furthermore I think that
Index: modules/proxy/ajp_header.c
===================================================================
--- modules/proxy/ajp_header.c (revision 563471)
+++ modules/proxy/ajp_header.c (working copy)
@@ -218,7 +218,11 @@
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"Into ajp_marshal_into_msgb");
- if ((method = sc_for_req_method_by_id(r->method_number)) == UNKNOWN_METHOD) {
+ if (r->header_only) {
+ method = SC_M_HEAD;
+ }
+ else if ((method = sc_for_req_method_by_id(r->method_number))
+ == UNKNOWN_METHOD) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"ajp_marshal_into_msgb - No such method %s",
r->method);
should be sufficient as header only is only set for HEAD requests.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 43060] - mod_proxy_ajp: HEAD requests sent as GET
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43060>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43060
jim@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|bugs@httpd.apache.org |jim@apache.org
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org