You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by GOMEZ Henri <hg...@slib.fr> on 2001/07/24 08:07:32 UTC

RE: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp 13.h jk_ajp_common.c jk_ajp_common.h

Thanks Mike :)

-
Henri Gomez                 ___[_]____
EMAIL : hgomez@slib.fr        (. .)                     
PGP KEY : 697ECEDD    ...oOOo..(_)..oOOo...
PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6 



>-----Original Message-----
>From: mmanders@apache.org [mailto:mmanders@apache.org]
>Sent: Monday, July 23, 2001 11:03 PM
>To: jakarta-tomcat-connectors-cvs@apache.org
>Subject: cvs commit: jakarta-tomcat-connectors/jk/native/common
>jk_ajp13.h jk_ajp_common.c jk_ajp_common.h
>
>
>mmanders    01/07/23 14:02:43
>
>  Modified:    jk/native/common jk_ajp13.h jk_ajp_common.c 
>jk_ajp_common.h
>  Log:
>  Ported fixes for AJP13 wrong response from Tomcat 3.3 branch.
>  
>  Revision  Changes    Path
>  1.5       +2 -1      
>jakarta-tomcat-connectors/jk/native/common/jk_ajp13.h
>  
>  Index: jk_ajp13.h
>  ===================================================================
>  RCS file: 
>/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp13.h,v
>  retrieving revision 1.4
>  retrieving revision 1.5
>  diff -u -r1.4 -r1.5
>  --- jk_ajp13.h	2001/06/18 14:15:18	1.4
>  +++ jk_ajp13.h	2001/07/23 21:02:43	1.5
>  @@ -58,7 +58,7 @@
>   
>/**************************************************************
>*************
>    * Description: Experimental bi-directionl protocol 
>handler.               *
>    * Author:      Gal Shachor <sh...@il.ibm.com>            
>               *
>  - * Version:     $Revision: 1.4 $                            
>               *
>  + * Version:     $Revision: 1.5 $                            
>               *
>    
>***************************************************************
>************/
>   #ifndef JK_AJP13_H
>   #define JK_AJP13_H
>  @@ -78,6 +78,7 @@
>   #define AJP13_READ_BUF_SIZE         (8*1024)
>   #define AJP13_DEF_CACHE_SZ          (1)
>   #define JK_INTERNAL_ERROR       	(-2)
>  +#define JK_FATAL_ERROR              (-3)
>   #define AJP13_MAX_SEND_BODY_SZ      (DEF_BUFFER_SZ - 6)
>   
>   /*
>  
>  
>  
>  1.6       +22 -9     
>jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c
>  
>  Index: jk_ajp_common.c
>  ===================================================================
>  RCS file: 
>/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v
>  retrieving revision 1.5
>  retrieving revision 1.6
>  diff -u -r1.5 -r1.6
>  --- jk_ajp_common.c	2001/06/22 08:33:56	1.5
>  +++ jk_ajp_common.c	2001/07/23 21:02:43	1.6
>  @@ -59,7 +59,7 @@
>    * Description: common stuff for bi-directional protocols 
>ajp13/ajp14.     *
>    * Author:      Gal Shachor <sh...@il.ibm.com>            
>               *
>    * Author:      Henri Gomez <hg...@slib.fr>                
>               *
>  - * Version:     $Revision: 1.5 $                            
>               *
>  + * Version:     $Revision: 1.6 $                            
>               *
>    
>***************************************************************
>************/
>   
>   
>  @@ -68,8 +68,9 @@
>   #include "jk_ajp13.h"
>   #include "jk_ajp14.h"
>   #include "jk_ajp_common.h"
>  -#include "jk_connect.h"
>  +#include "jk_connect.h"
>   
>  +
>   const char *response_trans_headers[] = {
>       "Content-Type", 
>       "Content-Language", 
>  @@ -801,8 +802,8 @@
>   	 * We send here the first part of data which was sent 
>previously to the
>   	 * remote Tomcat
>   	 */
>  -	if (jk_b_get_len(op->reply) > AJP_HEADER_LEN) {
>  -		if(!ajp_connection_tcp_send_message(ae, op->reply, l)) {
>  +	if (jk_b_get_len(op->post) > AJP_HEADER_LEN) {
>  +		if(!ajp_connection_tcp_send_message(ae, op->post, l)) {
>   			jk_log(l, JK_LOG_ERROR, "Error 
>resending request body\n");
>   			return JK_FALSE;
>   		}
>  @@ -818,7 +819,7 @@
>   			unsigned len = ae->left_bytes_to_send;
>   			if (len > AJP13_MAX_SEND_BODY_SZ) 
>   				len = AJP13_MAX_SEND_BODY_SZ;
>  -            		if (! 
>ajp_read_into_msg_buff(ae, s, op->reply, len, l)) {
>  +            		if (! 
>ajp_read_into_msg_buff(ae, s, op->post, len, l)) {
>   				/* the browser stop sending 
>data, no need to recover */
>   				op->recoverable = JK_FALSE;
>   				return JK_FALSE;
>  @@ -838,6 +839,7 @@
>    */
>   
>   static int ajp_process_callback(jk_msg_buf_t *msg, 
>  +                                jk_msg_buf_t *pmsg,
>                                   ajp_endpoint_t *ae,
>                                   jk_ws_service_t *r, 
>                                   jk_logger_t *l) 
>  @@ -859,7 +861,7 @@
>                                          (const char * const 
>*)res.header_values,
>                                          res.num_headers)) {
>                       jk_log(l, JK_LOG_ERROR, "Error 
>ajp_process_callback - start_response failed\n");
>  -                    return JK_INTERNAL_ERROR;
>  +                    return JK_FATAL_ERROR;
>                   }
>               }
>   	    break;
>  @@ -869,7 +871,7 @@
>   	            unsigned len = (unsigned)jk_b_get_int(msg);
>                   if(!r->write(r, jk_b_get_buff(msg) + 
>jk_b_get_pos(msg), len)) {
>                       jk_log(l, JK_LOG_ERROR, "Error 
>ajp_process_callback - write failed\n");
>  -                    return JK_INTERNAL_ERROR;
>  +                    return JK_FATAL_ERROR;
>                   }
>               }
>   	    break;
>  @@ -950,7 +952,7 @@
>   			return JK_FALSE;
>   		}
>   
>  -		rc = ajp_process_callback(op->reply, p, s, l);
>  +		rc = ajp_process_callback(op->reply, op->post, p, s, l);
>   
>   		/* no more data to be sent, fine we have finish here */
>          		if(JK_AJP13_END_RESPONSE == rc)
>  @@ -966,11 +968,18 @@
>           	 * data to file and replay for it
>           	 */
>    			op->recoverable = JK_FALSE; 
>  -			rc = ajp_connection_tcp_send_message(p, 
>op->reply, l);
>  +			rc = ajp_connection_tcp_send_message(p, 
>op->post, l);
>           		if (rc < 0) {
>   				jk_log(l, JK_LOG_ERROR, "Error 
>sending request data %d\n", rc);
>                  	 		return JK_FALSE;
>   			}
>  +        } else if(JK_FATAL_ERROR == rc) {
>  +          /*
>  +           * we won't be able to gracefully recover from this so
>  +           * set recoverable to false and get out.
>  +           */
>  +            op->recoverable = JK_FALSE;
>  +            return JK_FALSE;
>   		} else if(rc < 0) {
>   			return (JK_FALSE); /* XXX error */
>   		}
>  @@ -1006,6 +1015,10 @@
>   		op->reply = jk_b_new(&(p->pool));
>   		jk_b_set_buffer_size(op->reply, DEF_BUFFER_SZ);
>   		jk_b_reset(op->reply); 
>  +		
>  +		op->post = jk_b_new(&(p->pool));
>  +		jk_b_set_buffer_size(op->post, DEF_BUFFER_SZ);
>  +		jk_b_reset(op->post); 
>   		
>   		op->recoverable = JK_TRUE;
>   		op->uploadfd	 = -1;		/* not yet 
>used, later ;) */
>  
>  
>  
>  1.5       +2 -1      
>jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.h
>  
>  Index: jk_ajp_common.h
>  ===================================================================
>  RCS file: 
>/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.h,v
>  retrieving revision 1.4
>  retrieving revision 1.5
>  diff -u -r1.4 -r1.5
>  --- jk_ajp_common.h	2001/06/18 14:15:32	1.4
>  +++ jk_ajp_common.h	2001/07/23 21:02:43	1.5
>  @@ -59,7 +59,7 @@
>    * Description: common stuff for bi-directional protocol 
>ajp13/ajp14.      *
>    * Author:      Gal Shachor <sh...@il.ibm.com>            
>               *
>    * Author:      Henri Gomez <hg...@slib.fr>                
>               *
>  - * Version:     $Revision: 1.4 $                            
>               *
>  + * Version:     $Revision: 1.5 $                            
>               *
>    
>***************************************************************
>************/
>   
>   #ifndef JK_AJP_COMMON_H
>  @@ -281,6 +281,7 @@
>   struct ajp_operation {
>       jk_msg_buf_t    *request;   /* original request storage */
>       jk_msg_buf_t    *reply;     /* reply storage (chuncked 
>by ajp13 */
>  +    jk_msg_buf_t    *post;      /* small post data storage area */
>       int     uploadfd;           /* future persistant storage id */
>       int     recoverable;        /* if exchange could be 
>conducted on another TC */
>   };
>  
>  
>  
>