tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1555413 - in /tomcat/jk/trunk/native/common: jk_ajp13.h jk_ajp_common.c
Date Sat, 04 Jan 2014 20:06:27 GMT
Author: rjung
Date: Sat Jan  4 20:06:26 2014
New Revision: 1555413

URL: http://svn.apache.org/r1555413
Log:
Use max_packet_size also when forwarding request
bodies. Until now it was only used for the request
header packet and for response packets.

Modified:
    tomcat/jk/trunk/native/common/jk_ajp13.h
    tomcat/jk/trunk/native/common/jk_ajp_common.c

Modified: tomcat/jk/trunk/native/common/jk_ajp13.h
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp13.h?rev=1555413&r1=1555412&r2=1555413&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_ajp13.h (original)
+++ tomcat/jk/trunk/native/common/jk_ajp13.h Sat Jan  4 20:06:26 2014
@@ -51,7 +51,6 @@ extern "C"
 #define JK_REPLY_TIMEOUT            (-10)
 #define JK_AJP_PROTOCOL_ERROR       (-11)
 
-#define AJP13_MAX_SEND_BODY_SZ      (AJP13_DEF_PACKET_SIZE - 6)
 #define AJP13_DEF_TIMEOUT           (0) /* Idle timout for pooled connections */
 
 /*

Modified: tomcat/jk/trunk/native/common/jk_ajp_common.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp_common.c?rev=1555413&r1=1555412&r2=1555413&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_ajp_common.c (original)
+++ tomcat/jk/trunk/native/common/jk_ajp_common.c Sat Jan  4 20:06:26 2014
@@ -1467,6 +1467,7 @@ static int ajp_read_into_msg_buff(ajp_en
                                   jk_msg_buf_t *msg, int len, jk_logger_t *l)
 {
     unsigned char *read_buf = msg->buf;
+    int maxlen;
 
     JK_TRACE_ENTER(l);
 
@@ -1474,11 +1475,15 @@ static int ajp_read_into_msg_buff(ajp_en
 
     read_buf += AJP_HEADER_LEN;    /* leave some space for the buffer headers */
     read_buf += AJP_HEADER_SZ_LEN; /* leave some space for the read length */
+    maxlen = ae->worker->max_packet_size - AJP_HEADER_LEN - AJP_HEADER_SZ_LEN;
 
     /* Pick the max size since we don't know the content_length
      */
-    if (r->is_chunked && len == 0) {
-        len = AJP13_MAX_SEND_BODY_SZ;
+    if ((r->is_chunked && len == 0) || len < 0 || len > maxlen) {
+        len = maxlen;
+    }
+    if ((jk_uint64_t)len > ae->left_bytes_to_send) {
+        len = (int)ae->left_bytes_to_send;
     }
 
     if ((len = ajp_read_fully_from_server(r, l, read_buf, len)) < 0) {
@@ -1781,11 +1786,8 @@ static int ajp_send_request(jk_endpoint_
          * Note that chunking will continue to work - using the normal read.
          */
         if (ae->left_bytes_to_send > 0) {
-            int len = AJP13_MAX_SEND_BODY_SZ;
-            if (ae->left_bytes_to_send < (jk_uint64_t)AJP13_MAX_SEND_BODY_SZ) {
-                len = (int)ae->left_bytes_to_send;
-            }
-            if ((len = ajp_read_into_msg_buff(ae, s, op->post, len, l)) <= 0) {
+            int len;
+            if ((len = ajp_read_into_msg_buff(ae, s, op->post, -1, l)) <= 0) {
                 if (JK_IS_DEBUG_LEVEL(l))
                     jk_log(l, JK_LOG_DEBUG,
                            "(%s) browser stop sending data, no need to recover",
@@ -2009,12 +2011,6 @@ static int ajp_process_callback(jk_msg_b
             if (len < 0) {
                 len = 0;
             }
-            if (len > AJP13_MAX_SEND_BODY_SZ) {
-                len = AJP13_MAX_SEND_BODY_SZ;
-            }
-            if ((jk_uint64_t)len > ae->left_bytes_to_send) {
-                len = (int)ae->left_bytes_to_send;
-            }
 
             /* the right place to add file storage for upload
              */



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


Mime
View raw message