tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Seguin <seg...@motive.com>
Subject [j-t-c] problem in ajp_process_callback (in jk_ajp_common.c)
Date Thu, 06 Dec 2001 23:16:18 GMT
in ajp_process_callback, here is the block of code that handles sending the
next chunk of data from the webserver to tomcat:

--- snip ---
        case JK_AJP13_GET_BODY_CHUNK:
            {
		unsigned len = (unsigned)jk_b_get_int(msg);
                jk_log(l, JK_LOG_DEBUG, "received JK_AJP13_GET_BODY_CHUNK,
len=%d\n", len);

                if(len > AJP13_MAX_SEND_BODY_SZ) {
                    len = AJP13_MAX_SEND_BODY_SZ;
                }
                if(len > ae->left_bytes_to_send) {
                    jk_log(l, JK_LOG_DEBUG, "len > ae->left_bytes_to_send
(%d > %d)\n",
                           len, ae->left_bytes_to_send);
                    len = ae->left_bytes_to_send;
                }
		if(len < 0) {
		    len = 0;
		}

		/* the right place to add file storage for upload */
		if ((len = ajp_read_into_msg_buff(ae, r, msg, len, l)) >= 0)
{
		    r->content_read += len;
		    return JK_AJP13_HAS_RESPONSE;
		}                  

		jk_log(l, JK_LOG_ERROR, "Error ajp_process_callback -
ajp_read_into_msg_buff failed\n");
		return JK_INTERNAL_ERROR;	    
            }
	    break;
--- end snip ---

in this line:

		if ((len = ajp_read_into_msg_buff(ae, r, msg, len, l)) >= 0)
{

shouldn't pmsg (the post message) be read into, not msg?  i think you only
run into this situation when the posted data doesn't fit into the first
message to tomcat, or a handling servlet doesn't make use of content-length
and tries to read more bytes than are available.  i'm not sure though...
the code is a little hard to follow :)

anyway, i was running into a problem with an infinite loop in the ajp layer.
when i made this change, the problem went away.

can someone who knows this code better than i take a look?  thanks in
advance.

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message