From dev-return-81914-apmail-tomcat-dev-archive=tomcat.apache.org@tomcat.apache.org Tue Jun 19 16:36:56 2007 Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 11146 invoked from network); 19 Jun 2007 16:36:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Jun 2007 16:36:54 -0000 Received: (qmail 5577 invoked by uid 500); 19 Jun 2007 16:36:50 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 5525 invoked by uid 500); 19 Jun 2007 16:36:49 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 5509 invoked by uid 500); 19 Jun 2007 16:36:49 -0000 Delivered-To: apmail-jakarta-tomcat-dev@jakarta.apache.org Received: (qmail 5506 invoked by uid 99); 19 Jun 2007 16:36:49 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jun 2007 09:36:49 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jun 2007 09:36:44 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 9CAE61A981D; Tue, 19 Jun 2007 09:36:24 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r548791 - in /tomcat/connectors/trunk/jk: native/apache-1.3/ native/apache-2.0/ native/common/ native/iis/ native/netscape/ xdocs/miscellaneous/ Date: Tue, 19 Jun 2007 16:36:23 -0000 To: tomcat-dev@jakarta.apache.org From: rjung@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070619163624.9CAE61A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rjung Date: Tue Jun 19 09:36:22 2007 New Revision: 548791 URL: http://svn.apache.org/viewvc?view=rev&rev=548791 Log: Fix Bugzilla 42608: Handle Content-length as unsigned 64Bit to allow for huge up- and downloads. This still needs intensive testing in combination with the fixes of the jk connectors on the tomcat side! Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c tomcat/connectors/trunk/jk/native/common/jk_ajp12_worker.c tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c tomcat/connectors/trunk/jk/native/common/jk_service.h tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original) +++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Tue Jun 19 09:36:22 2007 @@ -477,17 +477,17 @@ } /* Return the content length associated with an Apache request structure */ -static int get_content_length(request_rec * r) +static jk_uint64_t get_content_length(request_rec * r) { if (r->clength > 0) { - return r->clength; + return (jk_uint64_t)r->clength; } else { char *lenp = (char *)ap_table_get(r->headers_in, "Content-Length"); if (lenp) { - int rc = atoi(lenp); - if (rc > 0) { + jk_uint64_t rc = 0; + if (sscanf(lenp, "%" JK_UINT64_T_FMT, &rc) > 0 && rc > 0) { return rc; } } Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original) +++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Tue Jun 19 09:36:22 2007 @@ -515,17 +515,17 @@ exit(1); } -static int get_content_length(request_rec * r) +static jk_uint64_t get_content_length(request_rec * r) { if (r->clength > 0) { - return (int)r->clength; + return (jk_uint64_t)r->clength; } else if (r->main == NULL || r->main == r) { char *lenp = (char *)apr_table_get(r->headers_in, "Content-Length"); if (lenp) { - int rc = atoi(lenp); - if (rc > 0) { + jk_uint64_t rc = 0; + if (sscanf(lenp, "%" JK_UINT64_T_FMT, &rc) > 0 && rc > 0) { return rc; } } Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp12_worker.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp12_worker.c?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_ajp12_worker.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_ajp12_worker.c Tue Jun 19 09:36:22 2007 @@ -457,17 +457,20 @@ if (s->content_length) { char buf[READ_BUF_SIZE]; - unsigned so_far = 0; + jk_uint64_t so_far = 0; jk_log(l, JK_LOG_DEBUG, "ajpv12_handle_request, sending the request body"); while (so_far < s->content_length) { unsigned this_time = 0; - unsigned to_read = s->content_length - so_far; - if (to_read > READ_BUF_SIZE) { + unsigned to_read; + if (s->content_length > so_far + READ_BUF_SIZE) { to_read = READ_BUF_SIZE; } + else { + to_read = s->content_length - so_far; + } if (!s->read(s, buf, to_read, &this_time)) { jk_log(l, JK_LOG_ERROR, @@ -488,7 +491,7 @@ } else if (this_time == 0) { jk_log(l, JK_LOG_ERROR, - "In ajpv12_handle_request, Error: short read. content length is %d, read %d", + "In ajpv12_handle_request, Error: short read. content length is %" JK_UINT64_T_FMT ", read %" JK_UINT64_T_FMT, s->content_length, so_far); return JK_FALSE; } Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Tue Jun 19 09:36:22 2007 @@ -909,7 +909,7 @@ if ((rc = jk_tcp_socket_sendfull(ae->sd, msg->buf, msg->len)) > 0) { - ae->endpoint.wr += msg->len; + ae->endpoint.wr += (jk_uint64_t)msg->len; JK_TRACE_EXIT(l); ae->last_errno = 0; return JK_TRUE; @@ -958,7 +958,7 @@ return JK_FALSE; } ae->last_errno = 0; - ae->endpoint.rd += rc; + ae->endpoint.rd += (jk_uint64_t)rc; header = ((unsigned int)head[0] << 8) | head[1]; if (ae->proto == AJP13_PROTO) { @@ -1036,7 +1036,7 @@ } } ae->last_errno = 0; - ae->endpoint.rd += rc; + ae->endpoint.rd += (jk_uint64_t)rc; if (ae->proto == AJP13_PROTO) { if (JK_IS_DEBUG_LEVEL(l)) @@ -1308,7 +1308,7 @@ if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "(%s) request body to send %d - request body to resend %d", + "(%s) request body to send %" JK_UINT64_T_FMT " - request body to resend %d", ae->worker->name, ae->left_bytes_to_send, op->reply->len - AJP_HEADER_LEN); @@ -1375,9 +1375,9 @@ */ if (ae->left_bytes_to_send > 0) { - int len = ae->left_bytes_to_send; - if (len > AJP13_MAX_SEND_BODY_SZ) { - len = AJP13_MAX_SEND_BODY_SZ; + int len = AJP13_MAX_SEND_BODY_SZ; + if (ae->left_bytes_to_send < (jk_uint64_t)AJP13_MAX_SEND_BODY_SZ) { + len = ae->left_bytes_to_send; } if ((len = ajp_read_into_msg_buff(ae, s, op->post, len, l)) < 0) { /* the browser stop sending data, no need to recover */ @@ -1392,7 +1392,7 @@ s->reco_status = RECO_FILLED; } - s->content_read = len; + s->content_read = (jk_uint64_t)len; if (ajp_connection_tcp_send_message(ae, op->post, l) != JK_TRUE) { /* Close the socket if unable to send request */ jk_close_socket(ae->sd); @@ -1489,13 +1489,13 @@ if (len > AJP13_MAX_SEND_BODY_SZ) { len = AJP13_MAX_SEND_BODY_SZ; } - if ((unsigned int)len > ae->left_bytes_to_send) { - len = ae->left_bytes_to_send; + 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 */ if ((len = ajp_read_into_msg_buff(ae, r, pmsg, len, l)) >= 0) { - r->content_read += len; + r->content_read += (jk_uint64_t)len; JK_TRACE_EXIT(l); return JK_AJP13_HAS_RESPONSE; } @@ -1706,7 +1706,7 @@ else if (JK_AJP13_ERROR == rc) { /* * Tomcat has send invalid AJP message. - * Locadbalancer if present will decide if + * Loadbalancer if present will decide if * failover is possible. */ JK_TRACE_EXIT(l); @@ -1740,7 +1740,7 @@ else if (JK_SERVER_ERROR == rc) { /* * Tomcat has stop talking to us, so get out. - * Locadbalancer if present will decide if + * Loadbalancer if present will decide if * failover is possible. */ JK_TRACE_EXIT(l); Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h (original) +++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h Tue Jun 19 09:36:22 2007 @@ -313,7 +313,7 @@ jk_endpoint_t endpoint; - unsigned int left_bytes_to_send; + jk_uint64_t left_bytes_to_send; /* time of the last request handled by this endpoint */ Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Tue Jun 19 09:36:22 2007 @@ -979,8 +979,8 @@ } else { int service_stat = -1; - size_t rd = 0; - size_t wr = 0; + jk_uint64_t rd = 0; + jk_uint64_t wr = 0; /* Reset endpoint read and write sizes for * this request. */ Modified: tomcat/connectors/trunk/jk/native/common/jk_service.h URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_service.h?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_service.h (original) +++ tomcat/connectors/trunk/jk/native/common/jk_service.h Tue Jun 19 09:36:22 2007 @@ -133,11 +133,11 @@ const char *server_name; unsigned server_port; char *server_software; - unsigned content_length; /* integer that represents the content */ + jk_uint64_t content_length; /* 64 bit integer that represents the content */ /* length should be 0 if unknown. */ unsigned is_chunked; /* 1 if content length is unknown (chunked rq) */ unsigned no_more_chunks; /* 1 if last chunk has been read */ - unsigned content_read; /* number of bytes read */ + jk_uint64_t content_read; /* number of bytes read */ /* * SSL information @@ -312,8 +312,8 @@ */ struct jk_endpoint { - size_t rd; - size_t wr; + jk_uint64_t rd; + jk_uint64_t wr; /* * A 'this' pointer which is used by the subclasses of this class to Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original) +++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Tue Jun 19 09:36:22 2007 @@ -1966,7 +1966,7 @@ GET_SERVER_VARIABLE_VALUE_INT("SERVER_PORT_SECURE", s->is_ssl, 0); s->method = private_data->lpEcb->lpszMethod; - s->content_length = private_data->lpEcb->cbTotalBytes; + s->content_length = (jk_uint64_t)private_data->lpEcb->cbTotalBytes; s->ssl_cert = NULL; s->ssl_cert_len = 0; Modified: tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c (original) +++ tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c Tue Jun 19 09:36:22 2007 @@ -401,7 +401,7 @@ &tmp, private_data->sn, private_data->rq); if ((rc != REQ_ABORTED) && tmp) { - s->content_length = atoi(tmp); + sscanf(tmp, "%" JK_UINT64_T_FMT, &(s->content_length)); } s->method = pblock_findval("method", private_data->rq->reqpb); Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=548791&r1=548790&r2=548791 ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Tue Jun 19 09:36:22 2007 @@ -27,6 +27,10 @@
+ + 42608: Handle Content-length as unsigned 64Bit + to allow for huge up- and downloads. (rjung) + Apache: Add forwarding uri to debug log. (rjung) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org