You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kevin Seguin <se...@motive.com> on 2001/12/07 00:16:18 UTC

[j-t-c] problem in ajp_process_callback (in jk_ajp_common.c)

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>