cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_global.h jk_lb_worker.c

2005-04-21 Thread mturk
mturk   2005/04/21 04:18:44

  Modified:jk/native/common jk_ajp_common.c jk_global.h jk_lb_worker.c
  Log:
  Make sure the returned status codes are the same for ajp and lb
  workers.
  Status 503 if connection to tomcat fails.
  Status 502 is returned if tomcat faild in the middle of request.
  Status 400 is returned if client made faulty request
  Status 413 is returned if the headers are too large.
  Status 500 is returned in case of any other error.
  
  Revision  ChangesPath
  1.97  +7 -6  
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.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- jk_ajp_common.c   11 Apr 2005 06:51:36 -  1.96
  +++ jk_ajp_common.c   21 Apr 2005 11:18:44 -  1.97
  @@ -1605,12 +1605,12 @@
   
   JK_TRACE_ENTER(l);
   
  +if (is_error)
  +*is_error = JK_HTTP_SERVER_ERROR;
  +
   if (e && e->endpoint_private && s && is_error) {
   ajp_endpoint_t *p = e->endpoint_private;
   op->request = jk_b_new(&(p->pool));
  -/* Presume there will be no errors */
  -*is_error = JK_HTTP_OK;
  -
   jk_b_set_buffer_size(op->request, DEF_BUFFER_SZ);
   jk_b_reset(op->request);
   
  @@ -1674,6 +1674,7 @@
   
   err = ajp_get_reply(e, s, l, p, op);
   if (err == JK_TRUE) {
  +*is_error = JK_HTTP_OK;
   /* Done with the request */
   JK_TRACE_EXIT(l);
   return JK_TRUE;
  @@ -1686,7 +1687,7 @@
* operation is no more recoverable
*/
   if (!op->recoverable) {
  -*is_error = JK_HTTP_SERVER_ERROR;
  +*is_error = JK_HTTP_BAD_GATEWAY;
   jk_log(l, JK_LOG_ERROR,
  "receiving reply from tomcat failed "
  "without recovery in send loop %d", i);
  @@ -1728,7 +1729,7 @@
   /* Get another connection from the pool and try again */
   ajp_next_connection(p, l);
   }
  -
  +*is_error = JK_HTTP_SERVER_BUSY;
   /* Log the error only once per failed request. */
   jk_log(l, JK_LOG_ERROR,
  "Error connecting to tomcat. Tomcat is probably not started "
  
  
  
  1.47  +9 -6  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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- jk_global.h   26 Mar 2005 09:28:56 -  1.46
  +++ jk_global.h   21 Apr 2005 11:18:44 -  1.47
  @@ -174,11 +174,14 @@
   /* HTTP Error codes
*/
   
  -#define JK_HTTP_OK  200
  -#define JK_HTTP_BAD_REQUEST 400
  -#define JK_REQUEST_TOO_LARGE413
  -#define JK_HTTP_SERVER_ERROR500
  -#define JK_HTTP_SERVER_BUSY 503
  +#define JK_HTTP_OK   200
  +#define JK_HTTP_BAD_REQUEST  400
  +#define JK_REQUEST_TOO_LARGE 413
  +#define JK_HTTP_SERVER_ERROR 500
  +#define JK_HTTP_NOT_IMPLEMENTED  501
  +#define JK_HTTP_BAD_GATEWAY  502
  +#define JK_HTTP_SERVER_BUSY  503
  +#define JK_HTTP_GATEWAY_TIME_OUT 504
   
   
   /*
  
  
  
  1.77  +3 -3  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.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- jk_lb_worker.c13 Apr 2005 12:40:03 -  1.76
  +++ jk_lb_worker.c21 Apr 2005 11:18:44 -  1.77
  @@ -668,7 +668,7 @@
   jk_log(l, JK_LOG_ERROR,
  "All tomcat instances failed, no more workers left");
   JK_TRACE_EXIT(l);
  -*is_error = JK_HTTP_SERVER_ERROR;
  +*is_error = JK_HTTP_SERVER_BUSY;
   return JK_FALSE;
   }
   --num_of_workers;
  @@ -677,7 +677,7 @@
   jk_log(l, JK_LOG_INFO,
  "All tomcat instances are busy or in error state");
   JK_TRACE_EXIT(l);
  -/* Set error to Server busy */
  +/* Set error to Timeout */
   *is_error = JK_HTTP_SERVER_BUSY;
   return JK_FALSE;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_global.h jk_lb_worker.c

2005-03-26 Thread mturk
mturk   2005/03/26 01:28:56

  Modified:jk/native/common jk_ajp_common.c jk_global.h jk_lb_worker.c
  Log:
  Use HTTP_REQUEST_ENTITY_TOO_LARGE when marshaling fails.
  
  Revision  ChangesPath
  1.95  +2 -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.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- jk_ajp_common.c   26 Mar 2005 08:42:14 -  1.94
  +++ jk_ajp_common.c   26 Mar 2005 09:28:56 -  1.95
  @@ -1634,7 +1634,7 @@
* We get here initial request (in reqmsg)
*/
   if (!ajp_marshal_into_msgb(op->request, s, l, p)) {
  -*is_error = JK_HTTP_BAD_REQUEST;
  +*is_error = JK_REQUEST_TOO_LARGE;
   jk_log(l, JK_LOG_INFO,
   "Creating AJP message failed, "
   "without recovery");
  
  
  
  1.46  +2 -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.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- jk_global.h   26 Mar 2005 08:41:04 -  1.45
  +++ jk_global.h   26 Mar 2005 09:28:56 -  1.46
  @@ -176,6 +176,7 @@
   
   #define JK_HTTP_OK  200
   #define JK_HTTP_BAD_REQUEST 400
  +#define JK_REQUEST_TOO_LARGE413
   #define JK_HTTP_SERVER_ERROR500
   #define JK_HTTP_SERVER_BUSY 503
   
  
  
  
  1.74  +1 -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.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- jk_lb_worker.c26 Mar 2005 08:44:11 -  1.73
  +++ jk_lb_worker.c26 Mar 2005 09:28:56 -  1.74
  @@ -633,7 +633,6 @@
   * Clent error !!!
   * Since this is bad request do not fail over.
   */
  -is_service_error = JK_HTTP_BAD_REQUEST;
   rec->s->errors++;
   rec->s->in_error_state = JK_FALSE;
   rec->s->in_recovering = JK_FALSE;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/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

2004-02-11 Thread hgomez
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  ChangesPath
  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 -   1.46
  +++ jk_ajp_common.c   11 Feb 2004 09:49:49 -  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 -   1.26
  +++ jk_global.h   11 Feb 2004 09:49:49 -  1.27
  @@ -163,6 +163,14 @@
   #endif
   
   /*
  + * RECO STATUS
  + */
  +
  +#define RECO_NONE0x00
  +#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.c6 Feb 2004 08:37:59 -   1.15
  +++ jk_lb_worker.c11 Feb 2004 09:49:49 -  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 -   1.14
  +++ jk_msg_buff.c 11 Feb 2004 09:49:49 -  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
  re