Sure. Here are the diffs again with -u -b.
-David
--- Ajp13ConnectorRequest.orig Tue Aug 28 07:16:10 2001
+++ Ajp13ConnectorRequest.java Tue Aug 28 07:43:54 2001
@@ -231,8 +231,11 @@
contentLength = headers.getIntHeader("content-length");
contentType = headers.getHeader("content-type");
- ((BufferedServletInputStream)this.in).setLimit(contentLength);
+
+
if(contentLength > 0) {
+ ((BufferedServletInputStream)this.in).setLimit(contentLength);
+ }
/* Read present data */
int err = con.receive(msg);
if(err < 0) {
@@ -241,7 +244,6 @@
blen = msg.peekInt();
msg.getBytes(bodyBuff);
- }
return 0;
}
@@ -314,9 +316,13 @@
}
blen = msg.peekInt();
+ if (blen > 0) {
pos = 0;
msg.getBytes(bodyBuff);
-
+ } else {
+ pos = 0;
+ msg.getBytes(bodyBuff);
+ }
return (blen > 0);
}
}
--- jk_ajp13_worker.orig Thu Jan 4 18:39:26 2001
+++ jk_ajp13_worker.c Tue Aug 28 07:12:35 2001
@@ -108,12 +108,20 @@
int reuse;
jk_endpoint_t endpoint;
- unsigned left_bytes_to_send;
+ int left_bytes_to_send;
+ int had_content_length;
+
+ unsigned char readbuf[READ_BUF_SIZE];
+ unsigned left;
+ unsigned int current;
+
};
static void reset_endpoint(ajp13_endpoint_t *ep)
{
ep->reuse = JK_FALSE;
+ ep->left = 0;
+ ep->current = 0;
jk_reset_pool(&(ep->pool));
}
@@ -233,22 +241,37 @@
return JK_TRUE;
}
-static int read_fully_from_server(jk_ws_service_t *s,
+
+static int read_fully_from_server(ajp13_endpoint_t *ep,
+ jk_ws_service_t *s,
unsigned char *buf,
- unsigned len)
+ unsigned len,
+ jk_logger_t *l)
{
unsigned rdlen = 0;
+ unsigned this_time;
while(rdlen < len) {
- unsigned this_time = 0;
- if(!s->read(s, buf + rdlen, len - rdlen, &this_time)) {
+
+ if (ep->left <= 0) {
+ if(!s->read(s, ep->readbuf, (unsigned)READ_BUF_SIZE,
&(ep->left))) {
+ jk_log(l, JK_LOG_DEBUG, "read_fully says -1\n");
return -1;
}
+ ep->current = 0;
+ }
+
+ this_time = (ep->left < (len - rdlen)) ? ep->left : (len-rdlen);
+ memcpy(buf+rdlen, (ep->readbuf)+ep->current, this_time);
+ ep->left -= this_time;
+ ep->current += this_time;
if(0 == this_time) {
break;
}
+
rdlen += this_time;
+
}
return (int)rdlen;
@@ -261,19 +284,27 @@
unsigned len)
{
unsigned char *read_buf = jk_b_get_buff(msg);
-
+ int just_got = 0;
jk_b_reset(msg);
read_buf += 4; /* leave some space for the buffer headers */
read_buf += 2; /* leave some space for the read length */
- if(read_fully_from_server(r, read_buf, len) < 0) {
+ if((just_got = read_fully_from_server(ep, r, read_buf, len, l)) < 0) {
+ if (ep->had_content_length == 0) {
+ ep->left_bytes_to_send = -1;
+ return JK_TRUE;
+ } else {
jk_log(l, JK_LOG_ERROR,
"read_into_msg_buff: Error - read_fully_from_server
failed\n");
return JK_FALSE;
}
+ }
- ep->left_bytes_to_send -= len;
+ if ((ep->had_content_length == 0) && (just_got != len)) {
+ ep->left_bytes_to_send = -1;/* we are done */
+ len = just_got;
+ }
if(0 != jk_b_append_int(msg, (unsigned short)len)) {
jk_log(l, JK_LOG_ERROR,
@@ -333,12 +364,21 @@
{
unsigned len = (unsigned)jk_b_get_int(msg);
+ if (ep->left_bytes_to_send < 0) {
+ read_into_msg_buff(ep, r, msg, l, 0);
+ return JK_AJP13_HAS_RESPONSE;
+ }
+
if(len > MAX_SEND_BODY_SZ) {
len = MAX_SEND_BODY_SZ;
}
+
+ if (ep->had_content_length) {
if(len > ep->left_bytes_to_send) {
len = ep->left_bytes_to_send;
}
+ }
+
if(len < 0) {
len = 0;
}
@@ -545,7 +585,13 @@
jk_b_set_buffer_size( msg, DEF_BUFFER_SZ);
jk_b_reset(msg);
+ if (s->content_length > 0) {
+ p->had_content_length = 1;
p->left_bytes_to_send = s->content_length;
+ } else {
+ p->had_content_length = 0;
+ p->left_bytes_to_send = MAX_SEND_BODY_SZ;
+ }
p->reuse = JK_FALSE;
*is_recoverable_error = JK_TRUE;
@@ -595,7 +641,6 @@
*/
*is_recoverable_error = JK_FALSE;
-
if(p->left_bytes_to_send > 0) {
unsigned len = p->left_bytes_to_send;
if(len > MAX_SEND_BODY_SZ) {
@@ -622,7 +667,6 @@
"Error reading request\n");
return JK_FALSE;
}
-
rc = ajp13_process_callback(msg, p, s, l);
if(JK_AJP13_END_RESPONSE == rc) {
return JK_TRUE;
@@ -681,6 +725,8 @@
if(ep) {
ep->sd = -1;
ep->reuse = JK_FALSE;
+ ep->left = 0;
+ ep->current = 0;
jk_open_pool(&ep->pool, ep->buf, sizeof(ep->buf));
ep->worker = pThis->worker_private;
ep->endpoint.endpoint_private = ep;
--- mod_jk.orig Tue Aug 28 07:09:33 2001
+++ mod_jk.c Tue Aug 28 07:10:29 2001
@@ -221,6 +221,7 @@
unsigned l,
unsigned *a)
{
+
if(s && s->ws_private && b && a) {
apache_private_data_t *p = s->ws_private;
if(!p->read_body_started) {
@@ -232,10 +233,11 @@
}
if(p->read_body_started) {
- *a = ap_get_client_block(p->r, b, l);
+ *a = (unsigned) ap_get_client_block(p->r, b, l);
return JK_TRUE;
}
}
+
return JK_FALSE;
}
-----Original Message-----
From: Keith Wannamaker [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 28, 2001 8:29 AM
To: [EMAIL PROTECTED]
Subject: RE: cvs commit:
jakarta-tomcat/src/share/org/apache/tomcat/util/testHeader.java
HttpRequest.java
Heh, you beat me to it. I'd like to compare notes.
Can you resend the diff with -u -b?
Keith
| -----Original Message-----
| From: Schreibman, David [mailto:[EMAIL PROTECTED]]
| Sent: Tuesday, August 28, 2001 11:17 AM
| To: '[EMAIL PROTECTED]'
| Subject: RE: cvs commit:
| jakarta-tomcat/src/share/org/apache/tomcat/util/testHeader.java
| HttpRequest.java
|
|
| For whatever it's worth, here are some changes I made to the 3.2.2 code
base
| to add support for chunked requests. I just did the work a few days ago
and
| am still in the process of moving them to 3.3. Still, since the topic
came