hgomez 2004/02/11 01:49:49 Modified: jk/native/common jk_ajp_common.c jk_global.h jk_lb_worker.c jk_msg_buff.c jk_msg_buff.h jk_service.h Log: Fix the POST recovery in LB mode. Revision Changes Path 1.47 +22 -2 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.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- jk_ajp_common.c 6 Feb 2004 08:37:46 -0000 1.46 +++ jk_ajp_common.c 11 Feb 2004 09:49:49 -0000 1.47 @@ -1091,7 +1091,20 @@ } else jk_log(l, JK_LOG_DEBUG, "Resent the request body (%d)\n", postlen); - + } + else if (s->reco_status == RECO_FILLED) + { + /* Recovery in LB MODE */ + postlen = jk_b_get_len(s->reco_buf); + + if (postlen > AJP_HEADER_LEN) { + if(!ajp_connection_tcp_send_message(ae, s->reco_buf, l)) { + jk_log(l, JK_LOG_ERROR, "Error resending request body (lb mode) (%d)\n", postlen); + return JK_FALSE; + } + } + else + jk_log(l, JK_LOG_DEBUG, "Resent the request body (lb mode) (%d)\n", postlen); } else { /* We never sent any POST data and we check if we have to send at @@ -1117,6 +1130,13 @@ op->recoverable = JK_FALSE; return JK_CLIENT_ERROR; } + + /* If a RECOVERY buffer is available in LB mode, fill it */ + if (s->reco_status == RECO_INITED) { + jk_b_copy(op->post, s->reco_buf); + s->reco_status = RECO_FILLED; + } + s->content_read = len; if (!ajp_connection_tcp_send_message(ae, op->post, l)) { jk_log(l, JK_LOG_ERROR, "Error sending request body\n"); 1.27 +9 -1 jakarta-tomcat-connectors/jk/native/common/jk_global.h Index: jk_global.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_global.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- jk_global.h 5 Jan 2004 22:41:53 -0000 1.26 +++ jk_global.h 11 Feb 2004 09:49:49 -0000 1.27 @@ -163,6 +163,14 @@ #endif /* + * RECO STATUS + */ + +#define RECO_NONE 0x00 +#define RECO_INITED 0x01 +#define RECO_FILLED 0x02 + +/* * JK options */ 1.16 +6 -2 jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c Index: jk_lb_worker.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- jk_lb_worker.c 6 Feb 2004 08:37:59 -0000 1.15 +++ jk_lb_worker.c 11 Feb 2004 09:49:49 -0000 1.16 @@ -323,7 +323,11 @@ /* you can not recover on another load balancer */ *is_recoverable_error = JK_FALSE; - + /* set the recovery post, for LB mode */ + s->reco_buf = jk_b_new(s->pool); + jk_b_set_buffer_size(s->reco_buf, DEF_BUFFER_SZ); + jk_b_reset(s->reco_buf); + s->reco_status = RECO_INITED; while(1) { worker_record_t *rec = get_most_suitable_worker(p->worker, s, attempt++); int rc; 1.15 +17 -1 jakarta-tomcat-connectors/jk/native/common/jk_msg_buff.c Index: jk_msg_buff.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_msg_buff.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- jk_msg_buff.c 5 Nov 2003 09:15:39 -0000 1.14 +++ jk_msg_buff.c 11 Feb 2004 09:49:49 -0000 1.15 @@ -476,3 +476,19 @@ #endif } + +int jk_b_copy(jk_msg_buf_t *smsg, + jk_msg_buf_t *dmsg) +{ + if (smsg == NULL || dmsg == NULL) + return (-1); + + if (dmsg->maxlen < smsg->len) + return (-2); + + memcpy(dmsg->buf, smsg->buf, smsg->len); + dmsg->len = smsg->len; + + return (smsg->len); +} + 1.8 +6 -1 jakarta-tomcat-connectors/jk/native/common/jk_msg_buff.h Index: jk_msg_buff.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_msg_buff.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- jk_msg_buff.h 5 Nov 2003 09:15:39 -0000 1.7 +++ jk_msg_buff.h 11 Feb 2004 09:49:49 -0000 1.8 @@ -227,6 +227,11 @@ char * what, jk_msg_buf_t * msg); +/** Copy a msg buf into another one + */ +int jk_b_copy(jk_msg_buf_t *smsg, + jk_msg_buf_t *dmsg); + #ifdef __cplusplus } #endif /* __cplusplus */ 1.16 +8 -1 jakarta-tomcat-connectors/jk/native/common/jk_service.h Index: jk_service.h =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_service.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- jk_service.h 5 Nov 2003 09:15:39 -0000 1.15 +++ jk_service.h 11 Feb 2004 09:49:49 -0000 1.16 @@ -74,6 +74,7 @@ #include "jk_logger.h" #include "jk_pool.h" #include "jk_uri_worker_map.h" +#include "jk_msg_buff.h" #ifdef __cplusplus extern "C" { @@ -241,6 +242,12 @@ * essentially a 'this' pointer. All return JK_TRUE on success * and JK_FALSE on failure. */ + + /* + * Area to get POST data for fail-over recovery in POST + */ + jk_msg_buf_t *reco_buf; + int reco_status; /* * Send the response headers to the browser.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]