larryi 02/05/09 17:44:09 Modified: jk/native/netscape jk_nsapi_plugin.c Log: Finally port the input chunking changes from Tomcat 3.3.x Revision Changes Path 1.8 +34 -7 jakarta-tomcat-connectors/jk/native/netscape/jk_nsapi_plugin.c Index: jk_nsapi_plugin.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/netscape/jk_nsapi_plugin.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- jk_nsapi_plugin.c 29 Nov 2001 20:02:44 -0000 1.7 +++ jk_nsapi_plugin.c 10 May 2002 00:44:09 -0000 1.8 @@ -58,7 +58,7 @@ /*************************************************************************** * Description: NSAPI plugin for Netscape servers * * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Version: $Revision: 1.7 $ * + * Version: $Revision: 1.8 $ * ***************************************************************************/ @@ -478,6 +478,8 @@ static int setup_http_headers(nsapi_private_data_t *private_data, jk_ws_service_t *s) { + int need_content_length_header = (s->content_length == 0) ? JK_TRUE : JK_FALSE; + pblock *headers_jar = private_data->rq->headers; int cnt; int i; @@ -490,9 +492,13 @@ } } + s->headers_names = NULL; + s->headers_values = NULL; + s->num_headers = cnt; if(cnt) { - s->headers_names = jk_pool_alloc(&private_data->p, cnt * sizeof(char *)); - s->headers_values = jk_pool_alloc(&private_data->p, cnt * sizeof(char *)); + /* allocate an extra header slot in case we need to add a content-length header */ + s->headers_names = jk_pool_alloc(&private_data->p, (cnt + 1) * sizeof(char *)); + s->headers_values = jk_pool_alloc(&private_data->p, (cnt + 1) * sizeof(char *)); if(s->headers_names && s->headers_values) { for(i = 0, cnt = 0 ; i < headers_jar->hsize ; i++) { @@ -500,18 +506,39 @@ while(h && h->param) { s->headers_names[cnt] = h->param->name; s->headers_values[cnt] = h->param->value; + if(need_content_length_header && + !strncmp(h->param->name,"content-length",14)) { + need_content_length_header = JK_FALSE; + } cnt++; h = h->next; } } + /* Add a content-length = 0 header if needed. + * Ajp13 assumes an absent content-length header means an unknown, + * but non-zero length body. + */ + if(need_content_length_header) { + s->headers_names[cnt] = "content-length"; + s->headers_values[cnt] = "0"; + cnt++; + } s->num_headers = cnt; return JK_TRUE; } } else { - s->num_headers = cnt; - s->headers_names = NULL; - s->headers_values = NULL; - return JK_TRUE; + if (need_content_length_header) { + s->headers_names = jk_pool_alloc(&private_data->p, sizeof(char *)); + s->headers_values = jk_pool_alloc(&private_data->p, sizeof(char *)); + if(s->headers_names && s->headers_values) { + s->headers_names[0] = "content-length"; + s->headers_values[0] = "0"; + s->num_headers++; + return JK_TRUE; + } + } + else + return JK_TRUE; } return JK_FALSE;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>