You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/04/27 00:31:45 UTC

DO NOT REPLY [Bug 42269] New: - Content-Length header is removed on HEAD requests

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=42269>.
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=42269

           Summary: Content-Length header is removed on HEAD requests
           Product: Tomcat 5
           Version: Unknown
          Platform: HP
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Native:JK
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: sameergn@yahoo.com


If we set 

JkOptions -FlushHeader
JkOptions +FlushPackets 

then Content-Length header is removed from HEAD requests.
The HEAD request is served by the tomcat in this case and it
sends the content-length header to mod-jk. The header is 
apparently removed because ws_flush() is not called from 
tomcat-connectors-1.2.21-src\native\common\jk_ajp_common.c
ajp_process_callback() due to following conditions.
(See code marked with ==> <==)

case JK_AJP13_SEND_HEADERS:
        {
            jk_res_data_t res;
            if (!ajp_unmarshal_response(msg, &res, ae, l)) {
                jk_log(l, JK_LOG_ERROR,
                       "ajp_unmarshal_response failed");
                JK_TRACE_EXIT(l);
                return JK_AJP13_ERROR;
            }
            r->start_response(r, res.status, res.msg,
                              (const char *const *)res.header_names,
                              (const char *const *)res.header_values,
                              res.num_headers);
            if (r->flush && r->flush_header) /** ==> JkOptions -FlushHeader <== **/
                r->flush(r);
            r->http_response_status = res.status;
        }
        return JK_AJP13_SEND_HEADERS;

case JK_AJP13_END_RESPONSE:
        ae->reuse = (int)jk_b_get_byte(msg);
        if (!ae->reuse) {
            /*
             * AJP13 protocol reuse flag set to false.
             * Tomcat will close its side of the connection.
             */
            jk_log(l, JK_LOG_WARNING, "AJP13 protocol: Reuse is set to false");
        }
        else if (r->disable_reuse) {
            if (JK_IS_DEBUG_LEVEL(l)) {
                jk_log(l, JK_LOG_DEBUG, "AJP13 protocol: Reuse is disabled");
            }
            ae->reuse = JK_FALSE;
        }
        else {
            /* Reuse in all cases */
            if (JK_IS_DEBUG_LEVEL(l)) {
                jk_log(l, JK_LOG_DEBUG, "AJP13 protocol: Reuse is OK");
            }
            ae->reuse = JK_TRUE;
        }
        /* Flush after the last write */
        if (r->flush && !r->flush_packets) /** ==> JkOptions +FlushPackets <== **/
            r->flush(r);

        JK_TRACE_EXIT(l);
        return JK_AJP13_END_RESPONSE;
        break;

>From the source code, I can see that flush_packets is added since mod_jk 1.2.14
and flush_headers is added since 1.2.20. So prior to version 1.2.14,
content-length was missing in HEAD requests. After 1.2.14, it started working
because flush_packets parameter was false by default.

-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 42269] - Content-Length header is removed on HEAD requests

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=42269>.
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=42269


rainer.jung@kippdata.de changed:

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




------- Additional Comments From rainer.jung@kippdata.de  2007-08-06 08:13 -------
Seems to be working in the dev snapshot of 1.2.25.

-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org