cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-08-01 Thread jfclere
jfclere 2004/08/01 09:50:27

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Arrange uri handling.
  
  Revision  ChangesPath
  1.24  +12 -1 jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ajp_header.c  1 Aug 2004 15:23:23 -   1.23
  +++ ajp_header.c  1 Aug 2004 16:50:27 -   1.24
  @@ -210,6 +210,7 @@
   apr_uint32_t i, num_headers = 0;
   apr_byte_t is_ssl;
   char *remote_host;
  +char *uri;
   
   
   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  @@ -229,14 +230,24 @@
   const apr_array_header_t *t = apr_table_elts(r->headers_in);
   num_headers = t->nelts;
   }
  +
   remote_host = (char *)ap_get_remote_host(r->connection, r->per_dir_config, 
REMOTE_HOST, NULL);
   
  +uri = apr_pstrdup(r->pool, r->uri);
  +if (uri != NULL) {
  +char *query_str = strchr(uri, '?');
  +if (query_str != NULL) {
  +*query_str = 0;
  +}
  +}
  +
  +
   ajp_msg_reset(msg);
   
   if (ajp_msg_append_uint8(msg, CMD_AJP13_FORWARD_REQUEST) ||
   ajp_msg_append_uint8(msg, method)||
   ajp_msg_append_string(msg, r->protocol)  ||
  -ajp_msg_append_string(msg, r->uri)   ||
  +ajp_msg_append_string(msg, uri)  ||
   ajp_msg_append_string(msg, r->connection->remote_ip) ||
   ajp_msg_append_string(msg, remote_host)  ||
   ajp_msg_append_string(msg, ap_get_server_name(r))||
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-08-01 Thread mturk
mturk   2004/08/01 08:23:23

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Use CMD_AJP13_SEND_HEADERS instead hard coded number.
  
  Revision  ChangesPath
  1.23  +1 -1  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ajp_header.c  1 Aug 2004 14:54:10 -   1.22
  +++ ajp_header.c  1 Aug 2004 15:23:23 -   1.23
  @@ -623,7 +623,7 @@
  "ajp_parse_headers: ajp_msg_get_byte failed");
   return rc;
   }
  -if (result != 4) {
  +if (result != CMD_AJP13_SEND_HEADERS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_parse_headers: wrong type %02x", result);
   return APR_EGENERAL;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-08-01 Thread mturk
mturk   2004/08/01 07:54:10

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Use CMD_AJP13.
  
  Revision  ChangesPath
  1.22  +1 -1  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ajp_header.c  1 Aug 2004 13:28:02 -   1.21
  +++ ajp_header.c  1 Aug 2004 14:54:10 -   1.22
  @@ -233,7 +233,7 @@
   
   ajp_msg_reset(msg);
   
  -if (ajp_msg_append_uint8(msg, AJP13_FORWARD_REQUEST) ||
  +if (ajp_msg_append_uint8(msg, CMD_AJP13_FORWARD_REQUEST) ||
   ajp_msg_append_uint8(msg, method)||
   ajp_msg_append_string(msg, r->protocol)  ||
   ajp_msg_append_string(msg, r->uri)   ||
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-08-01 Thread mturk
mturk   2004/08/01 06:28:02

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Removed sc_for_req_method function, cause not needed.
  We have sc_for_req_method_by_id. The current can be made using
  sc_for_req_method_by_id(ap_method_number_of(method)).
  
  Revision  ChangesPath
  1.21  +4 -179jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ajp_header.c  30 Jul 2004 19:26:37 -  1.20
  +++ ajp_header.c  1 Aug 2004 13:28:02 -   1.21
  @@ -44,175 +44,6 @@
   
   #define UNKNOWN_METHOD (-1)
   
  -static int sc_for_req_method(const char *method)
  -{
  -apr_ssize_t len = strlen(method);
  -
  -switch (len)
  -{
  -case 3:
  -switch (method[0])
  -{
  -case 'P':
  -return (method[1] == 'U'
  -&& method[2] == 'T'
  -? SC_M_PUT : UNKNOWN_METHOD);
  -case 'G':
  -return (method[1] == 'E'
  -&& method[2] == 'T'
  -? SC_M_GET : UNKNOWN_METHOD);
  -case 'A':
  -return (method[1] == 'C'
  -&& method[2] == 'L'
  -? SC_M_ACL : UNKNOWN_METHOD);
  -default:
  -return UNKNOWN_METHOD;
  -}
  -
  -case 4:
  -switch (method[0])
  -{
  -case 'H':
  -return (method[1] == 'E'
  -&& method[2] == 'A'
  -&& method[3] == 'D'
  -? SC_M_HEAD : UNKNOWN_METHOD);
  -case 'P':
  -return (method[1] == 'O'
  -&& method[2] == 'S'
  -&& method[3] == 'T'
  -? SC_M_POST : UNKNOWN_METHOD);
  -case 'M':
  -return (method[1] == 'O'
  -&& method[2] == 'V'
  -&& method[3] == 'E'
  -? SC_M_MOVE : UNKNOWN_METHOD);
  -case 'L':
  -return (method[1] == 'O'
  -&& method[2] == 'C'
  -&& method[3] == 'K'
  -? SC_M_LOCK : UNKNOWN_METHOD);
  -case 'C':
  -return (method[1] == 'O'
  -&& method[2] == 'P'
  -&& method[3] == 'Y'
  -? SC_M_COPY : UNKNOWN_METHOD);
  -default:
  -return UNKNOWN_METHOD;
  -}
  -
  -case 5:
  -switch (method[2])
  -{
  -case 'R':
  -return (memcmp(method, "MERGE", 5) == 0
  -? SC_M_MERGE : UNKNOWN_METHOD);
  -case 'C':
  -return (memcmp(method, "MKCOL", 5) == 0
  -? SC_M_MKCOL : UNKNOWN_METHOD);
  -case 'B':
  -return (memcmp(method, "LABEL", 5) == 0
  -? SC_M_LABEL : UNKNOWN_METHOD);
  -case 'A':
  -return (memcmp(method, "TRACE", 5) == 0
  -? SC_M_TRACE : UNKNOWN_METHOD);
  -default:
  -return UNKNOWN_METHOD;
  -}
  -
  -case 6:
  -switch (method[0])
  -{
  -case 'U':
  -switch (method[5])
  -{
  -case 'K':
  -return (memcmp(method, "UNLOCK", 6) == 0
  -? SC_M_UNLOCK : UNKNOWN_METHOD);
  -case 'E':
  -return (memcmp(method, "UPDATE", 6) == 0
  -? SC_M_UPDATE : UNKNOWN_METHOD);
  -default:
  -return UNKNOWN_METHOD;
  -}
  -case 'R':
  -return (memcmp(method, "REPORT", 6) == 0
  -? SC_M_REPORT : UNKNOWN_METHOD);
  -case 'D':
  -return (memcmp(method, "DELETE", 6) == 0
  -? SC_M_DELETE : UNKNOWN_METHOD);
  -case 'S':
  -return (memcmp(method, "SEARCH", 6) == 0
  -? SC_M_SEARCH : UNKNOWN_METHOD);
  -default:
  -return UNKNOWN_METHOD;
  -}
  -
  -case 7:
  -switch (method[1])
  -{
  -case 'P':
  -return (memcmp(method, "OPTIONS", 7) == 0
  -? SC_M_OPTIONS : UNKNOWN_METHOD);
  -case 'H':
  -return (memcmp(method, "CHECKIN", 7) == 0
  -? SC_M_CHECKIN : UNKNOWN_METHOD);
  -default:
  -return UNKNOWN_METHOD;
  -}
  -
  -case 8:
  -switch (method[0])
  -{
  -case 'P':
  -return (memcmp(method, "PROPFIND", 8) == 0
  -? SC_M_PROPFIND : UNKNOWN_METHOD);
  -case 'C':
  -return (memcmp(method, "CHECKOUT", 8) == 0
  -   

cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-30 Thread mturk
mturk   2004/07/30 12:26:37

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Fix naming confusion. It is method not header
  
  Revision  ChangesPath
  1.20  +6 -6  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ajp_header.c  30 Jul 2004 17:06:19 -  1.19
  +++ ajp_header.c  30 Jul 2004 19:26:37 -  1.20
  @@ -301,7 +301,7 @@
   }
   
   /* Apache method number to SC methods transform table */
  -static const unsigned char sc_for_req_header_table[] = {
  +static const unsigned char sc_for_req_method_table[] = {
   SC_M_GET,
   SC_M_PUT,
   SC_M_POST,
  @@ -331,13 +331,13 @@
   0   /* M_INVALID */
   };
   
  -static int sc_for_req_header_by_id(int method_id)
  +static int sc_for_req_method_by_id(int method_id)
   {
   if (method_id < 0 || method_id > M_INVALID)
   return UNKNOWN_METHOD;
   else
  -return sc_for_req_header_table[method_id] ?
  -   sc_for_req_header_table[method_id] : UNKNOWN_METHOD;
  +return sc_for_req_method_table[method_id] ?
  +   sc_for_req_method_table[method_id] : UNKNOWN_METHOD;
   }
   
   /*
  @@ -384,7 +384,7 @@
   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"Into ajp_marshal_into_msgb");
   
  -if ((method = sc_for_req_header_by_id(r->method_number)) == UNKNOWN_METHOD) { 
  +if ((method = sc_for_req_method_by_id(r->method_number)) == UNKNOWN_METHOD) { 
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "Error ajp_marshal_into_msgb - No such method %s",
  r->method);
  @@ -571,7 +571,7 @@
  "Error appending the message end");
   return APR_EGENERAL;
   }
  -
  +
   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  "ajp_marshal_into_msgb - Done");
   return APR_SUCCESS;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-30 Thread jfclere
jfclere 2004/07/30 10:06:20

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Add logic to process what is after the headers ;-)
  
  Revision  ChangesPath
  1.19  +51 -0 jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ajp_header.c  30 Jul 2004 10:21:06 -  1.18
  +++ ajp_header.c  30 Jul 2004 17:06:19 -  1.19
  @@ -827,3 +827,54 @@
   *ptr = (char *)&(msg->buf[msg->pos]);
   return APR_SUCCESS;
   }
  +
  +/*
  + * Allocate a msg to send data
  + */
  +apr_status_t  ajp_alloc_data_msg(request_rec *r, char **ptr, apr_size_t *len,
  + void **data)
  +{
  +apr_status_t rc;
  +ajp_msg_t **msg;
  +
  +msg = data;
  +rc = ajp_msg_create(r->pool, msg);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_alloc_data_msg: ajp_msg_create failed");
  +return rc;
  +}
  +ajp_msg_reset(*msg);
  +*ptr = (char *)&((*msg)->buf[6]);
  +*len = AJP_MSG_BUFFER_SZ-6;
  +
  +return APR_SUCCESS;
  +}
  +
  +/*
  + * Send the data message
  + */
  +apr_status_t  ajp_send_data_msg(apr_socket_t *sock, request_rec  *r,
  + void *data, apr_size_t len)
  +{
  +apr_status_t rc;
  +ajp_msg_t *msg;
  +
  +msg = data;
  +msg->buf[4] = (apr_byte_t)((len >> 8) & 0xFF);
  +msg->buf[5] = (apr_byte_t)(len & 0xFF);
  +
  +msg->len += len + 2; /* + 1  where is '\0' */
  +
  +ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +   "ajp_send_data_msg: sending %d", len);
  +
  +rc = ajp_ilink_send(sock, msg);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_send_data_msg: ajp_ilink_send failed");
  +return rc;
  +}
  +
  +return APR_SUCCESS;
  +}
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-30 Thread jean-frederic clere
Mladen Turk wrote:
 

[EMAIL PROTECTED] commited:
 Log:
 Arrange small things and temporaly modify ajp_read_header().

I really don't understand why is unacceptable to include ajp.h in mod_proxy.
For example my compiler is complaining about missing prototypes in
proxy_ajp.
So either we'll make another header or just use the ajp.h
BTW there is nothing in the ajp.h that would brake the proxy_ajp thought.
Also I don't think that we need to hide msg using abstraction since we will
not use the .so for libajp inside proxy or we will?
I had the idea to hide msg because we probably need to store 2 msgs to be able 
to retry sending when it fails.

MT.

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


RE: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-30 Thread Mladen Turk
 

[EMAIL PROTECTED] commited:
>   Log:
>   Arrange small things and temporaly modify ajp_read_header().
>

I really don't understand why is unacceptable to include ajp.h in mod_proxy.
For example my compiler is complaining about missing prototypes in
proxy_ajp.

So either we'll make another header or just use the ajp.h
BTW there is nothing in the ajp.h that would brake the proxy_ajp thought.
Also I don't think that we need to hide msg using abstraction since we will
not use the .so for libajp inside proxy or we will?

MT.


smime.p7s
Description: S/MIME cryptographic signature


cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-30 Thread jfclere
jfclere 2004/07/30 03:21:06

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Add a trace.
  
  Revision  ChangesPath
  1.18  +3 -0  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ajp_header.c  30 Jul 2004 10:16:29 -  1.17
  +++ ajp_header.c  30 Jul 2004 10:21:06 -  1.18
  @@ -447,6 +447,9 @@
  "Error appending the header value");
   return APR_EGENERAL;
   }
  +ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +   "ajp_marshal_into_msgb: Header[%d] [%s] = [%s]",
  +   i, elts[i].key, elts[i].val);
   }
   
   /*  need to figure out how to do this
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-30 Thread mturk
mturk   2004/07/30 03:16:30

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Few typos.
  
  Revision  ChangesPath
  1.17  +5 -5  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ajp_header.c  30 Jul 2004 09:50:00 -  1.16
  +++ ajp_header.c  30 Jul 2004 10:16:29 -  1.17
  @@ -240,9 +240,9 @@
   p += 6;
   if (memcmp(p, "CHARSET", 7) == 0)
   return SC_ACCEPT_CHARSET;
  -else if (memcmp(p,  "ENCODING", 8))
  +else if (memcmp(p,  "ENCODING", 8) == 0)
   return SC_ACCEPT_ENCODING;
  -else if (memcmp(p, "LANGUAGE", 8))
  +else if (memcmp(p, "LANGUAGE", 8) == 0)
   return SC_ACCEPT_LANGUAGE;
   else
   return UNKNOWN_METHOD;
  @@ -260,9 +260,9 @@
   return SC_COOKIE;
   else if(memcmp(p, "ONNECTION", 9) == 0)
   return SC_CONNECTION;
  -else if(memcmp(p, "ONTENT_TYPE", 11) == 0)
  +else if(memcmp(p, "ONTENT-TYPE", 11) == 0)
   return SC_CONTENT_TYPE;
  -else if(memcmp(p, "ONTENT_LENGTH", 13) == 0)
  +else if(memcmp(p, "ONTENT-LENGTH", 13) == 0)
   return SC_CONTENT_LENGTH;
   else if(memcmp(p, "OOKIE2", 6) == 0)
   return SC_COOKIE2;
  @@ -288,7 +288,7 @@
   return UNKNOWN_METHOD;
   break;
   case 'U':
  -if(memcmp(p, "SER_AGENT", 9) == 0)
  +if(memcmp(p, "SER-AGENT", 9) == 0)
   return SC_USER_AGENT;
   else
   return UNKNOWN_METHOD;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-30 Thread jfclere
jfclere 2004/07/30 02:50:00

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Arrange small things and temporaly modify ajp_read_header().
  
  Revision  ChangesPath
  1.16  +21 -10jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ajp_header.c  30 Jul 2004 06:32:54 -  1.15
  +++ ajp_header.c  30 Jul 2004 09:50:00 -  1.16
  @@ -34,6 +34,7 @@
   static const char *long_res_header_for_sc(int sc) 
   {
   const char *rc = NULL;
  +sc = sc & 0X00FF;
   if(sc <= SC_RES_HEADERS_NUM && sc > 0) {
   rc = response_trans_headers[sc - 1];
   }
  @@ -503,7 +504,7 @@
   ajp_msg_append_string(msg, s->ssl_cert)) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "Error ajp_marshal_into_msgb - "
  -   "Error appending the SSL certificates\n");
  +   "Error appending the SSL certificates");
   return APR_EGENERAL;
   }
   }
  @@ -619,7 +620,7 @@
   
   rc = ajp_msg_get_string(msg, &ptr);
   if (rc == APR_SUCCESS) {
  -r->status_line = apr_pstrdup(r->connection->pool, ptr);
  +r->status_line =  apr_psprintf(r->pool, "%d %s", status, ptr);
   #if defined(AS400) || defined(_OSD_POSIX)
   ap_xlate_proto_from_ascii(r->status_line, strlen(r->status_line));
   #endif
  @@ -653,17 +654,16 @@
   
   if ((name & 0XFF00) == 0XA000) {
   ajp_msg_peek_uint16(msg, &name);
  -name = name & 0X00FF;
  -if (name <= SC_RES_HEADERS_NUM) {
  -stringname = (char *)long_res_header_for_sc(name);
  -} else {
  +stringname = (char *)long_res_header_for_sc(name);
  +if (stringname == NULL) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "Error ajp_unmarshal_response - "
  -   "No such sc (%d)",
  +   "No such sc (%08x)",
  name);
   return APR_EGENERAL;
   }
   } else {
  +name = 0;
   rc = ajp_msg_get_string(msg, &stringname);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  @@ -687,10 +687,19 @@
   #if defined(AS400) || defined(_OSD_POSIX)
   ap_xlate_proto_from_ascii(value, strlen(value));
   #endif
  -ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  -   "ajp_unmarshal_response: Header[%d] [%s] = [%s]\n", 
  +ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +   "ajp_unmarshal_response: Header[%d] [%s] = [%s]", 
  i, stringname, value);
   apr_table_add(r->headers_out, stringname, value);
  +
  +/* Content-type needs an additional handling */
  +if (memcmp(stringname, "Content-Type",12) == 0) {
  +char *ptr;
  +ptr = apr_pstrdup(r->pool, value);
  +ap_set_content_type(r, ptr); /* add corresponding filter */
  +ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +   "ajp_unmarshal_response: ap_set_content_type done");
  +}
   }
   
   return APR_SUCCESS;
  @@ -734,11 +743,13 @@
*/
   apr_status_t ajp_read_header(apr_socket_t *sock,
request_rec  *r,
  - ajp_msg_t **msg)
  + void **data)
   {
   apr_byte_t result;
   apr_status_t rc;
  +ajp_msg_t **msg;
   
  +msg = data;
   rc = ajp_msg_create(r->pool, msg);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  
  
  

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



RE: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c ajp.h

2004-07-30 Thread Mladen Turk
 

jean-frederic clere wrote: 
> > 
> > But the ajp.h is a public API for libajp, so, it should be 
> included in 
> > any project using it.
> > It has defined
> 
> OK but I want to keep the AJP things as headen as possible in 
> the proxy_ajp.c so
>   we need another include.
>

Sure thing.
Only the ajp.h will be needed.

MT.


smime.p7s
Description: S/MIME cryptographic signature


Re: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c ajp.h

2004-07-30 Thread jean-frederic clere
Mladen Turk wrote:
 


-Original Message-
From: jean-frederic clere 

The ideas was to prevent including of ajp.h in proxy_ajp.c 
Now ajp_header.c doesn't compile:

But the ajp.h is a public API for libajp, so, it should be included in any
project using it.
It has defined 
OK but I want to keep the AJP things as headen as possible in the proxy_ajp.c so 
 we need another include.

MT.

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


RE: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c ajp.h

2004-07-30 Thread Mladen Turk
 

> -Original Message-
> From: jean-frederic clere 
> 
> The ideas was to prevent including of ajp.h in proxy_ajp.c 
> Now ajp_header.c doesn't compile:


But the ajp.h is a public API for libajp, so, it should be included in any
project using it.
It has defined 

MT.


smime.p7s
Description: S/MIME cryptographic signature


Re: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c ajp.h

2004-07-30 Thread jean-frederic clere
[EMAIL PROTECTED] wrote:
mturk   2004/07/29 23:32:54
  Modified:ajp/ajplib/test ajp_header.c ajp.h
  Log:
  Change the casting from void* to msg*. We don't need that, cause
  the ajp_msg_t is public.
The ideas was to prevent including of ajp.h in proxy_ajp.c
Now ajp_header.c doesn't compile:
+++
ajp_header.c:738: error: conflicting types for `ajp_read_header'
ajp.h:360: error: previous declaration of `ajp_read_header'
make: *** [ajp_header.lo] Error 1
+++
Cheers
Jean-Frederic
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c ajp.h

2004-07-29 Thread mturk
mturk   2004/07/29 23:32:54

  Modified:ajp/ajplib/test ajp_header.c ajp.h
  Log:
  Change the casting from void* to msg*. We don't need that, cause
  the ajp_msg_t is public.
  
  Revision  ChangesPath
  1.15  +8 -16 jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ajp_header.c  30 Jul 2004 06:27:57 -  1.14
  +++ ajp_header.c  30 Jul 2004 06:32:54 -  1.15
  @@ -734,38 +734,34 @@
*/
   apr_status_t ajp_read_header(apr_socket_t *sock,
request_rec  *r,
  - void **data)
  + ajp_msg_t **msg)
   {
   apr_byte_t result;
  -ajp_msg_t *msg;
   apr_status_t rc;
   
  -rc = ajp_msg_create(r->pool, &msg);
  +rc = ajp_msg_create(r->pool, msg);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_read_header: ajp_msg_create failed");
   return rc;
   }
  -ajp_msg_reset(msg);
  -rc = ajp_ilink_receive(sock, msg);
  +ajp_msg_reset(*msg);
  +rc = ajp_ilink_receive(sock, *msg);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_read_header: ajp_ilink_receive failed");
   return rc;
   }
  -rc = ajp_msg_peek_byte(msg, &result);
  +rc = ajp_msg_peek_byte(*msg, &result);
   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  "ajp_read_header: ajp_ilink_received %02x", result);
  -*data = msg;
   return APR_SUCCESS;
   }
   
   /* parse the msg to read the type */
  -int ajp_parse_type(request_rec  *r, void *data)
  +int ajp_parse_type(request_rec  *r, ajp_msg_t *msg)
   {
   apr_byte_t result;
  -ajp_msg_t *msg;
  -msg = (ajp_msg_t *)data;
   ajp_msg_peek_byte(msg, &result);
   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  "ajp_parse_type: got %02x", result);
  @@ -773,13 +769,11 @@
   }
   
   /* parse the headers */
  -apr_status_t ajp_parse_headers(request_rec  *r, void *data)
  +apr_status_t ajp_parse_headers(request_rec  *r, ajp_msg_t *msg)
   {
  -ajp_msg_t *msg;
   apr_byte_t result;
   apr_status_t rc;
   
  -msg = (ajp_msg_t *)data;
   rc = ajp_msg_get_byte(msg, &result);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  @@ -795,14 +789,12 @@
   }
   
   /* parse the header and return data address and length */
  -apr_status_t  ajp_parse_data(request_rec  *r, void *data, apr_uint16_t *len,
  +apr_status_t  ajp_parse_data(request_rec  *r, ajp_msg_t *msg, apr_uint16_t *len,
char **ptr)
   {
  -ajp_msg_t *msg;
   apr_byte_t result;
   apr_status_t rc;
   
  -msg = (ajp_msg_t *)data;
   rc = ajp_msg_get_byte(msg, &result);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  
  
  
  1.17  +2 -2  jakarta-tomcat-connectors/ajp/ajplib/test/ajp.h
  
  Index: ajp.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ajp.h 30 Jul 2004 06:27:09 -  1.16
  +++ ajp.h 30 Jul 2004 06:32:54 -  1.17
  @@ -352,12 +352,12 @@
* Read the ajp message and return the type of the message.
* @param sock  backend socket
* @param r current request
  - * @param data  return data
  + * @param msg   returned AJP message
* @return  APR_SUCCESS or error
*/
   apr_status_t ajp_read_header(apr_socket_t *sock,
request_rec  *r,
  - void **data);
  + void **msg);
   
   #endif /* AJP_H */
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-29 Thread mturk
mturk   2004/07/29 23:27:57

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  cast msg->buf cause it is unsigned char.
  
  Revision  ChangesPath
  1.14  +8 -4  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ajp_header.c  29 Jul 2004 15:04:20 -  1.13
  +++ ajp_header.c  30 Jul 2004 06:27:57 -  1.14
  @@ -733,8 +733,8 @@
* Read the ajp message and return the type of the message.
*/
   apr_status_t ajp_read_header(apr_socket_t *sock,
  -  request_rec  *r,
  -  void **data)
  + request_rec  *r,
  + void **data)
   {
   apr_byte_t result;
   ajp_msg_t *msg;
  @@ -759,6 +759,7 @@
   *data = msg;
   return APR_SUCCESS;
   }
  +
   /* parse the msg to read the type */
   int ajp_parse_type(request_rec  *r, void *data)
   {
  @@ -770,6 +771,7 @@
  "ajp_parse_type: got %02x", result);
   return (int) result;
   }
  +
   /* parse the headers */
   apr_status_t ajp_parse_headers(request_rec  *r, void *data)
   {
  @@ -791,8 +793,10 @@
   }
   return ajp_unmarshal_response(msg, r);
   }
  +
   /* parse the header and return data address and length */
  -apr_status_t  ajp_parse_data(request_rec  *r, void *data, apr_uint16_t *len, char 
**ptr)
  +apr_status_t  ajp_parse_data(request_rec  *r, void *data, apr_uint16_t *len,
  + char **ptr)
   {
   ajp_msg_t *msg;
   apr_byte_t result;
  @@ -814,6 +818,6 @@
   if (rc != APR_SUCCESS) {
   return APR_EGENERAL;
   }
  -*ptr = &(msg->buf[msg->pos]);
  +*ptr = (char *)&(msg->buf[msg->pos]);
   return APR_SUCCESS;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-29 Thread jfclere
jfclere 2004/07/29 08:04:20

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Typo.
  
  Revision  ChangesPath
  1.13  +1 -1  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ajp_header.c  29 Jul 2004 14:38:18 -  1.12
  +++ ajp_header.c  29 Jul 2004 15:04:20 -  1.13
  @@ -814,6 +814,6 @@
   if (rc != APR_SUCCESS) {
   return APR_EGENERAL;
   }
  -*ptr = msg->buf[msg->pos];
  +*ptr = &(msg->buf[msg->pos]);
   return APR_SUCCESS;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-29 Thread jfclere
jfclere 2004/07/29 07:38:18

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Add routines to read the response.
  
  Revision  ChangesPath
  1.12  +60 -2 jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ajp_header.c  29 Jul 2004 09:58:48 -  1.11
  +++ ajp_header.c  29 Jul 2004 14:38:18 -  1.12
  @@ -740,22 +740,80 @@
   ajp_msg_t *msg;
   apr_status_t rc;
   
  -ajp_msg_reset(msg);
   rc = ajp_msg_create(r->pool, &msg);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_read_header: ajp_msg_create failed");
   return rc;
   }
  +ajp_msg_reset(msg);
   rc = ajp_ilink_receive(sock, msg);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_read_header: ajp_ilink_receive failed");
   return rc;
   }
  -rc = ajp_msg_peek_byte(msg,&result);
  +rc = ajp_msg_peek_byte(msg, &result);
   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  "ajp_read_header: ajp_ilink_received %02x", result);
   *data = msg;
  +return APR_SUCCESS;
  +}
  +/* parse the msg to read the type */
  +int ajp_parse_type(request_rec  *r, void *data)
  +{
  +apr_byte_t result;
  +ajp_msg_t *msg;
  +msg = (ajp_msg_t *)data;
  +ajp_msg_peek_byte(msg, &result);
  +ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +   "ajp_parse_type: got %02x", result);
  +return (int) result;
  +}
  +/* parse the headers */
  +apr_status_t ajp_parse_headers(request_rec  *r, void *data)
  +{
  +ajp_msg_t *msg;
  +apr_byte_t result;
  +apr_status_t rc;
  +
  +msg = (ajp_msg_t *)data;
  +rc = ajp_msg_get_byte(msg, &result);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_parse_headers: ajp_msg_get_byte failed");
  +return rc;
  +}
  +if (result != 4) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_parse_headers: wrong type %02x", result);
  +return APR_EGENERAL;
  +}
  +return ajp_unmarshal_response(msg, r);
  +}
  +/* parse the header and return data address and length */
  +apr_status_t  ajp_parse_data(request_rec  *r, void *data, apr_uint16_t *len, char 
**ptr)
  +{
  +ajp_msg_t *msg;
  +apr_byte_t result;
  +apr_status_t rc;
  +
  +msg = (ajp_msg_t *)data;
  +rc = ajp_msg_get_byte(msg, &result);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_parse_data: ajp_msg_get_byte failed");
  +return rc;
  +}
  +if (result != 3) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_parse_data: wrong type %02x", result);
  +return APR_EGENERAL;
  +}
  +rc = ajp_msg_get_uint16(msg, len);
  +if (rc != APR_SUCCESS) {
  +return APR_EGENERAL;
  +}
  +*ptr = msg->buf[msg->pos];
   return APR_SUCCESS;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-29 Thread jfclere
jfclere 2004/07/29 02:58:48

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Add a read routine... It returns the message to reuse it.
  
  Revision  ChangesPath
  1.11  +31 -0 jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ajp_header.c  29 Jul 2004 08:23:42 -  1.10
  +++ ajp_header.c  29 Jul 2004 09:58:48 -  1.11
  @@ -728,3 +728,34 @@
   
   return APR_SUCCESS;
   }
  +
  +/*
  + * Read the ajp message and return the type of the message.
  + */
  +apr_status_t ajp_read_header(apr_socket_t *sock,
  +  request_rec  *r,
  +  void **data)
  +{
  +apr_byte_t result;
  +ajp_msg_t *msg;
  +apr_status_t rc;
  +
  +ajp_msg_reset(msg);
  +rc = ajp_msg_create(r->pool, &msg);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_read_header: ajp_msg_create failed");
  +return rc;
  +}
  +rc = ajp_ilink_receive(sock, msg);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_read_header: ajp_ilink_receive failed");
  +return rc;
  +}
  +rc = ajp_msg_peek_byte(msg,&result);
  +ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +   "ajp_read_header: ajp_ilink_received %02x", result);
  +*data = msg;
  +return APR_SUCCESS;
  +}
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-29 Thread jfclere
jfclere 2004/07/29 01:23:42

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Add missng ajp_msg_reset().
  
  Revision  ChangesPath
  1.10  +2 -0  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ajp_header.c  29 Jul 2004 06:53:44 -  1.9
  +++ ajp_header.c  29 Jul 2004 08:23:42 -  1.10
  @@ -399,6 +399,8 @@
   }
   remote_host = (char *)ap_get_remote_host(r->connection, r->per_dir_config, 
REMOTE_HOST, NULL);
   
  +ajp_msg_reset(msg);
  +
   if (ajp_msg_append_uint8(msg, AJP13_FORWARD_REQUEST) ||
   ajp_msg_append_uint8(msg, method)||
   ajp_msg_append_string(msg, r->protocol)  ||
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread mturk
mturk   2004/07/28 23:53:44

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Added sc_for_req_header_by_id instead sc_for_req_header.
  Apache already parses method for us, so there is no need to parse it again
  
  Revision  ChangesPath
  1.9   +43 -2 jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ajp_header.c  28 Jul 2004 19:20:50 -  1.8
  +++ ajp_header.c  29 Jul 2004 06:53:44 -  1.9
  @@ -209,7 +209,9 @@
   /* NOTREACHED */
   } 
   
  -
  +/* XXX: since we already have a method_number in request_rec
  + * we don't need this function
  + */
   static int sc_for_req_header(const char *header_name)
   {
   char header[16];
  @@ -297,6 +299,45 @@
   /* NOTREACHED */
   }
   
  +/* Apache method number to SC methods transform table */
  +static const unsigned char sc_for_req_header_table[] = {
  +SC_M_GET,
  +SC_M_PUT,
  +SC_M_POST,
  +SC_M_DELETE,
  +0,  /* M_DELETE */
  +SC_M_OPTIONS,
  +SC_M_TRACE,
  +0,  /* M_PATCH  */
  +SC_M_PROPFIND,
  +SC_M_PROPPATCH,
  +SC_M_MKCOL,
  +SC_M_COPY,
  +SC_M_MOVE,
  +SC_M_LOCK,
  +SC_M_UNLOCK,
  +SC_M_VERSION_CONTROL,
  +SC_M_CHECKOUT,
  +SC_M_UNCHECKOUT,
  +SC_M_CHECKIN,
  +SC_M_UPDATE,
  +SC_M_LABEL,
  +SC_M_REPORT,
  +SC_M_MKWORKSPACE,
  +SC_M_MKACTIVITY,
  +SC_M_BASELINE_CONTROL,
  +SC_M_MERGE,   
  +0   /* M_INVALID */
  +};
  +
  +static int sc_for_req_header_by_id(int method_id)
  +{
  +if (method_id < 0 || method_id > M_INVALID)
  +return UNKNOWN_METHOD;
  +else
  +return sc_for_req_header_table[method_id] ?
  +   sc_for_req_header_table[method_id] : UNKNOWN_METHOD;
  +}
   
   /*
* Message structure
  @@ -342,7 +383,7 @@
   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"Into ajp_marshal_into_msgb");
   
  -if ((method = sc_for_req_method(r->method)) == UNKNOWN_METHOD) { 
  +if ((method = sc_for_req_header_by_id(r->method_number)) == UNKNOWN_METHOD) { 
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "Error ajp_marshal_into_msgb - No such method %s",
  r->method);
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread mturk
mturk   2004/07/28 12:20:50

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Rewrite sc_for_req_header using apr and a little bit smarter comparision,
  using memcmp instead strcasecmp.
  
  Revision  ChangesPath
  1.8   +4 -4  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ajp_header.c  28 Jul 2004 19:16:21 -  1.7
  +++ ajp_header.c  28 Jul 2004 19:20:50 -  1.8
  @@ -210,17 +210,17 @@
   } 
   
   
  -static apr_status_t sc_for_req_header(const char *header_name)
  +static int sc_for_req_header(const char *header_name)
   {
  -char header[24];
  +char header[16];
   apr_size_t len = strlen(header_name);
   const char *p = header_name;
   int i = 0;
   
  -/* ACCEPT-CONTENT_LENGTH is the longest headeer
  +/* ACCEPT-LANGUAGE is the longest headeer
* that is of interest.
*/
  -if (len < 4 || len > 21)
  +if (len < 4 || len > 15)
   return UNKNOWN_METHOD;
   
   while (*p)
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread mturk
mturk   2004/07/28 12:16:21

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Rewrite sc_for_req_header using apr and a little bit smarter comparision,
  using memcmp instead strcasecmp.
  
  Revision  ChangesPath
  1.7   +83 -82jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ajp_header.c  28 Jul 2004 17:25:22 -  1.6
  +++ ajp_header.c  28 Jul 2004 19:16:21 -  1.7
  @@ -210,91 +210,91 @@
   } 
   
   
  -static apr_status_t sc_for_req_header(const char *header_name,
  -  apr_uint16_t *sc) 
  +static apr_status_t sc_for_req_header(const char *header_name)
   {
  -switch((tolower(header_name[0]))) {
  -case 'a':
  -if('c' ==tolower(header_name[1]) &&
  -   'c' ==tolower(header_name[2]) &&
  -   'e' ==tolower(header_name[3]) &&
  -   'p' ==tolower(header_name[4]) &&
  -   't' ==tolower(header_name[5])) {
  -if ('-' == header_name[6]) {
  -if(!strcasecmp(header_name + 7, "charset")) {
  -*sc = SC_ACCEPT_CHARSET;
  -} else if(!strcasecmp(header_name + 7, "encoding")) {
  -*sc = SC_ACCEPT_ENCODING;
  -} else if(!strcasecmp(header_name + 7, "language")) {
  -*sc = SC_ACCEPT_LANGUAGE;
  -} else {
  -return APR_EGENERAL;
  -}
  -} else if ('\0' == header_name[6]) {
  -*sc = SC_ACCEPT;
  -} else {
  -return APR_EGENERAL;
  +char header[24];
  +apr_size_t len = strlen(header_name);
  +const char *p = header_name;
  +int i = 0;
  +
  +/* ACCEPT-CONTENT_LENGTH is the longest headeer
  + * that is of interest.
  + */
  +if (len < 4 || len > 21)
  +return UNKNOWN_METHOD;
  +
  +while (*p)
  +header[i++] = apr_toupper(*p++);
  +header[i] = '\0';
  +p = &header[1];
  +
  +switch (header[0]) {
  +case 'A':
  +if (memcmp(p, "CCEPT", 5) == 0) {
  +if (!header[6])
  +return SC_ACCEPT;
  +else if (header[6] == '-') {
  +p += 6;
  +if (memcmp(p, "CHARSET", 7) == 0)
  +return SC_ACCEPT_CHARSET;
  +else if (memcmp(p,  "ENCODING", 8))
  +return SC_ACCEPT_ENCODING;
  +else if (memcmp(p, "LANGUAGE", 8))
  +return SC_ACCEPT_LANGUAGE;
  +else
  +return UNKNOWN_METHOD;
   }
  -} else if (!strcasecmp(header_name, "authorization")) {
  -*sc = SC_AUTHORIZATION;
  -} else {
  -return APR_EGENERAL;
  -}
  -break;
  -
  -case 'c':
  -if(!strcasecmp(header_name, "cookie")) {
  -*sc = SC_COOKIE;
  -} else if(!strcasecmp(header_name, "connection")) {
  -*sc = SC_CONNECTION;
  -} else if(!strcasecmp(header_name, "content-type")) {
  -*sc = SC_CONTENT_TYPE;
  -} else if(!strcasecmp(header_name, "content-length")) {
  -*sc = SC_CONTENT_LENGTH;
  -} else if(!strcasecmp(header_name, "cookie2")) {
  -*sc = SC_COOKIE2;
  -} else {
  -return APR_EGENERAL;
  +else
  +return UNKNOWN_METHOD;
   }
  +else if (memcmp(p, "UTHORIZATION", 12) == 0)
  +return SC_AUTHORIZATION;
  +else
  +return UNKNOWN_METHOD;
  +break;
  +case 'C':
  +if (memcmp(p, "OOKIE", 5) == 0)
  +return SC_COOKIE;
  +else if(memcmp(p, "ONNECTION", 9) == 0)
  +return SC_CONNECTION;
  +else if(memcmp(p, "ONTENT_TYPE", 11) == 0)
  +return SC_CONTENT_TYPE;
  +else if(memcmp(p, "ONTENT_LENGTH", 13) == 0)
  +return SC_CONTENT_LENGTH;
  +else if(memcmp(p, "OOKIE2", 6) == 0)
  +return SC_COOKIE2;
  +else
  +return UNKNOWN_METHOD;
  +break;
  +case 'H':
  +if(memcmp(p, "OST", 3) == 0)
  +return SC_HOST;
  +else
  +return UNKNOWN_METHOD;
  +break;
  +case 'P':
  +if(memcmp(p, "RAGMA", 5) == 0)
  +return SC_PRAGMA;
  + 

cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread jfclere
jfclere 2004/07/28 10:25:22

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Fix the coding style errors and the extra ajp_ilink_send. Thanks!!!
  
  Revision  ChangesPath
  1.6   +11 -12jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ajp_header.c  28 Jul 2004 16:57:25 -  1.5
  +++ ajp_header.c  28 Jul 2004 17:25:22 -  1.6
  @@ -564,7 +564,7 @@
   apr_uint16_t  num_headers;
   int i;
   
  -rc = ajp_msg_get_uint16(msg,&status);
  +rc = ajp_msg_get_uint16(msg, &status);
   
   if (rc != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  @@ -573,9 +573,9 @@
   }
   r->status = status;
   
  -rc = ajp_msg_get_string(msg,&ptr);
  +rc = ajp_msg_get_string(msg, &ptr);
   if (rc == APR_SUCCESS) {
  -r->status_line = apr_pstrdup(r->connection->pool,ptr);
  +r->status_line = apr_pstrdup(r->connection->pool, ptr);
   #if defined(AS400) || defined(_OSD_POSIX)
   ap_xlate_proto_from_ascii(r->status_line, strlen(r->status_line));
   #endif
  @@ -586,9 +586,9 @@
   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  "ajp_unmarshal_response: status = %d", status);
   
  -rc = ajp_msg_get_uint16(msg,&num_headers);
  +rc = ajp_msg_get_uint16(msg, &num_headers);
   if (rc == APR_SUCCESS) {
  -r->headers_out = apr_table_make(r->pool,num_headers);
  +r->headers_out = apr_table_make(r->pool, num_headers);
   } else {
   r->headers_out = NULL;
   num_headers = 0;
  @@ -620,7 +620,7 @@
   return APR_EGENERAL;
   }
   } else {
  -rc = ajp_msg_get_string(msg,&stringname);
  +rc = ajp_msg_get_string(msg, &stringname);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "Error ajp_unmarshal_response - "
  @@ -632,7 +632,7 @@
   #endif
   }
   
  -rc = ajp_msg_get_string(msg,&value);
  +rc = ajp_msg_get_string(msg, &value);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "Error ajp_unmarshal_response - "
  @@ -641,7 +641,7 @@
   }
   
   #if defined(AS400) || defined(_OSD_POSIX)
  -ap_xlate_proto_from_ascii(value,strlen(value));
  +ap_xlate_proto_from_ascii(value, strlen(value));
   #endif
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_unmarshal_response: Header[%d] [%s] = [%s]\n", 
  @@ -661,27 +661,26 @@
   ajp_msg_t *msg;
   apr_status_t rc;
   
  -rc = ajp_msg_create(r->pool,&msg);
  +rc = ajp_msg_create(r->pool, &msg);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_send_header: ajp_msg_create failed");
   return rc;
   }
   
  -rc = ajp_marshal_into_msgb(msg,r);
  +rc = ajp_marshal_into_msgb(msg, r);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_send_header: ajp_marshal_into_msgb failed");
   return rc;
   }
   
  -rc = ajp_ilink_send(sock,msg);
  +rc = ajp_ilink_send(sock, msg);
   if (rc != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_send_header: ajp_ilink_send failed");
   return rc;
   }
   
  -rc = ajp_ilink_send(sock,msg);
   return APR_SUCCESS;
   }
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread jean-frederic clere
jean-frederic clere wrote:
[EMAIL PROTECTED] wrote:
mturk   2004/07/28 09:34:22
  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Modify sc_for_req_method. It is exactly the same as Apache's
  lookup_builtin_method with added SC_M_SEARCH

Thanks. Mine was telling:
+++
[Wed Jul 28 18:43:56 2004] [debug] ajp_header.c(239): Into 
ajp_marshal_into_msgb[Wed Jul 28 18:43:56 2004] [error] Error 
ajp_marshal_into_msgb - No such method GET
[Wed Jul 28 18:43:56 2004] [error] ajp_send_header: 
ajp_marshal_into_msgb failed
+++

It goes little futher but:
+++
[Wed Jul 28 18:47:38 2004] [debug] ajp_header.c(342): Into 
ajp_marshal_into_msgb[Wed Jul 28 18:47:39 2004] [notice] child pid 3072 
exit signal Segmentation fault (11), possible coredump in 
/home/apache20/apache20
+++
Something wrong in ajp_msg.c?
Yes and now  I think I have fixed it ;-)
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread jean-frederic clere
Mladen Turk wrote:
 

[EMAIL PROTECTED]
jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c
 +rc = ajp_msg_create(r->pool,msg);

Can we use Apache coding convention having one space after comma in function
params?
Oops, I have done lot of those... I will fix them tomorrow.
It won't IMO have a chance to get into httpd tree otherwise.
I wanted to do that for JK2, but was always shut up, with the explanation
that it doesn't matter at the moment :)
MT.

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


Re: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread jean-frederic clere
[EMAIL PROTECTED] wrote:
mturk   2004/07/28 09:34:22
  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Modify sc_for_req_method. It is exactly the same as Apache's
  lookup_builtin_method with added SC_M_SEARCH
Thanks. Mine was telling:
+++
[Wed Jul 28 18:43:56 2004] [debug] ajp_header.c(239): Into 
ajp_marshal_into_msgb[Wed Jul 28 18:43:56 2004] [error] Error 
ajp_marshal_into_msgb - No such method GET
[Wed Jul 28 18:43:56 2004] [error] ajp_send_header: ajp_marshal_into_msgb failed
+++

It goes little futher but:
+++
[Wed Jul 28 18:47:38 2004] [debug] ajp_header.c(342): Into 
ajp_marshal_into_msgb[Wed Jul 28 18:47:39 2004] [notice] child pid 3072 exit 
signal Segmentation fault (11), possible coredump in /home/apache20/apache20
+++
Something wrong in ajp_msg.c?
+++
#0  0x08074bfd in ap_log_rerror (
file=0x402bcb00 "ajp_msg_append_uint8(): BufferOverflowException %d %d",
line=1076611840, level=3, status=1076611840, r=0x0,
fmt=0x402bcb00 "ajp_msg_append_uint8(): BufferOverflowException %d %d")
at log.c:576
#1  0x402bb047 in ajp_msg_append_uint8 (msg=0x831cbf8, value=2 '\002')
at ajp_msg.c:223
#2  0x402b9ebc in ajp_marshal_into_msgb (msg=0x831cbf8, r=0x83224a8)
at ajp_header.c:361
#3  0x402ba73f in ajp_send_header (sock=0x831cd78, r=0x83224a8)
at ajp_header.c:671
#4  0x402b82ef in ap_proxy_ajp_request (p=0x831c458, r=0x83224a8,
p_conn=0x831cbf8, origin=0x831cf10, conf=0x8286598, uri=0x831cbc8,
url=0x831cd68 "/examples/", server_portstr=0xb4e0 ":7779")
at proxy_ajp.c:489
#5  0x402b943b in ap_proxy_ajp_handler (r=0x83224a8, conf=0x8286598,
url=0x831cd68 "/examples/", proxyname=0x0, proxyport=0) at proxy_ajp.c:1101
#6  0x4029d7e4 in proxy_run_scheme_handler (r=0x83224a8, conf=0x8286598,
url=0x83237c6 "ajp://pgtr0327.mch.fsc.net:8009/examples/", proxyhost=0x0,
proxyport=0) at mod_proxy.c:1239
+++

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


RE: cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread Mladen Turk
 

[EMAIL PROTECTED]
> jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c
>
>   +rc = ajp_msg_create(r->pool,msg);

Can we use Apache coding convention having one space after comma in function
params?
It won't IMO have a chance to get into httpd tree otherwise.

I wanted to do that for JK2, but was always shut up, with the explanation
that it doesn't matter at the moment :)


MT.



smime.p7s
Description: S/MIME cryptographic signature


cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread jfclere
jfclere 2004/07/28 09:39:19

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Add the routine that builds and sends the header using informations from
  the request_rec structure.
  
  Revision  ChangesPath
  1.4   +34 -0 jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ajp_header.c  28 Jul 2004 16:34:22 -  1.3
  +++ ajp_header.c  28 Jul 2004 16:39:19 -  1.4
  @@ -651,3 +651,37 @@
   
   return APR_SUCCESS;
   }
  +
  +/*
  + * Build the ajp header message and send it
  + */
  +apr_status_t ajp_send_header(apr_socket_t *sock,
  +  request_rec  *r)
  +{
  +ajp_msg_t *msg;
  +apr_status_t rc;
  +
  +rc = ajp_msg_create(r->pool,msg);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_send_header: ajp_msg_create failed");
  +return rc;
  +}
  +
  +rc = ajp_marshal_into_msgb(msg,r);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_send_header: ajp_marshal_into_msgb failed");
  +return rc;
  +}
  +
  +rc = ajp_ilink_send(sock,msg);
  +if (rc != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "ajp_send_header: ajp_ilink_send failed");
  +return rc;
  +}
  +
  +rc = ajp_ilink_send(sock,msg);
  +return APR_SUCCESS;
  +}
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread mturk
mturk   2004/07/28 09:34:22

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Modify sc_for_req_method. It is exactly the same as Apache's
  lookup_builtin_method with added SC_M_SEARCH
  
  Revision  ChangesPath
  1.3   +166 -63   jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ajp_header.c  28 Jul 2004 16:11:27 -  1.2
  +++ ajp_header.c  28 Jul 2004 16:34:22 -  1.3
  @@ -41,71 +41,174 @@
   return rc;
   }
   
  +#define UNKNOWN_METHOD (-1)
   
  -static apr_status_t sc_for_req_method(const char *method,
  -  unsigned char *sc) 
  +static int sc_for_req_method(const char *method)
   {
  -apr_status_t rc = APR_SUCCESS;
  -if(0 == strcmp(method, "GET")) {
  -*sc = SC_M_GET;
  -} else if(0 == strcmp(method, "POST")) {
  -*sc = SC_M_POST;
  -} else if(0 == strcmp(method, "HEAD")) {
  -*sc = SC_M_HEAD;
  -} else if(0 == strcmp(method, "PUT")) {
  -*sc = SC_M_PUT;
  -} else if(0 == strcmp(method, "DELETE")) {
  -*sc = SC_M_DELETE;
  -} else if(0 == strcmp(method, "OPTIONS")) {
  -*sc = SC_M_OPTIONS;
  -} else if(0 == strcmp(method, "TRACE")) {
  -*sc = SC_M_TRACE;
  -} else if(0 == strcmp(method, "PROPFIND")) {
  -*sc = SC_M_PROPFIND;
  -} else if(0 == strcmp(method, "PROPPATCH")) {
  -*sc = SC_M_PROPPATCH;
  -} else if(0 == strcmp(method, "MKCOL")) {
  -*sc = SC_M_MKCOL;
  -} else if(0 == strcmp(method, "COPY")) {
  -*sc = SC_M_COPY;
  -} else if(0 == strcmp(method, "MOVE")) {
  -*sc = SC_M_MOVE;
  -} else if(0 == strcmp(method, "LOCK")) {
  -*sc = SC_M_LOCK;
  -} else if(0 == strcmp(method, "UNLOCK")) {
  -*sc = SC_M_UNLOCK;
  -} else if(0 == strcmp(method, "ACL")) {
  -*sc = SC_M_ACL;
  -} else if(0 == strcmp(method, "REPORT")) {
  -*sc = SC_M_REPORT;
  -} else if(0 == strcmp(method, "VERSION-CONTROL")) {
  -*sc = SC_M_VERSION_CONTROL;
  -} else if(0 == strcmp(method, "CHECKIN")) {
  -*sc = SC_M_CHECKIN;
  -} else if(0 == strcmp(method, "CHECKOUT")) {
  -*sc = SC_M_CHECKOUT;
  -} else if(0 == strcmp(method, "UNCHECKOUT")) {
  -*sc = SC_M_UNCHECKOUT;
  -} else if(0 == strcmp(method, "SEARCH")) {
  -*sc = SC_M_SEARCH;
  -} else if(0 == strcmp(method, "MKWORKSPACE")) {
  -*sc = SC_M_MKWORKSPACE;
  -} else if(0 == strcmp(method, "UPDATE")) {
  -*sc = SC_M_UPDATE;
  -} else if(0 == strcmp(method, "LABEL")) {
  -*sc = SC_M_LABEL;
  -} else if(0 == strcmp(method, "MERGE")) {
  -*sc = SC_M_MERGE;
  -} else if(0 == strcmp(method, "BASELINE-CONTROL")) {
  -*sc = SC_M_BASELINE_CONTROL;
  -} else if(0 == strcmp(method, "MKACTIVITY")) {
  -*sc = SC_M_MKACTIVITY;
  -} else {
  -rc = APR_EGENERAL;
  +apr_ssize_t len = strlen(method);
  +
  +switch (len)
  +{
  +case 3:
  +switch (method[0])
  +{
  +case 'P':
  +return (method[1] == 'U'
  +&& method[2] == 'T'
  +? SC_M_PUT : UNKNOWN_METHOD);
  +case 'G':
  +return (method[1] == 'E'
  +&& method[2] == 'T'
  +? SC_M_GET : UNKNOWN_METHOD);
  +case 'A':
  +return (method[1] == 'C'
  +&& method[2] == 'L'
  +? SC_M_ACL : UNKNOWN_METHOD);
  +default:
  +return UNKNOWN_METHOD;
  +}
  +
  +case 4:
  +switch (method[0])
  +{
  +case 'H':
  +return (method[1] == 'E'
  +&& method[2] == 'A'
  +&& method[3] == 'D'
  +? SC_M_HEAD : UNKNOWN_METHOD);
  +case 'P':
  +return (method[1] == 'O'
  +&& method[2] == 'S'
  +&& method[3] == 'T'
  +? SC_M_POST : UNKNOWN_METHOD);
  +case 'M':
  +return (method[1] == 'O'
  +&& method[2] == 'V'
  +&& method[3] == 'E'
  +? SC_M_MOVE : UNKNOWN_METHOD);
  +case 'L':
  +return (method[1] == 'O'
  +&& method[2] == 'C'
  +&& method[3] == 'K'
  +? SC_M_LOCK : UNKNOWN_METHOD);
  +case 'C':
  +return (method[1] == 'O'
  +&& method[2] == 'P'
  +&& method[3] == 'Y'
  +? SC_M_COPY : UNKNOWN_METHOD);
  +default:
  +return UNKNOWN_

cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c

2004-07-28 Thread mturk
mturk   2004/07/28 09:11:27

  Modified:ajp/ajplib/test ajp_header.c
  Log:
  Use apr types.
  Fix ajp_msg_peek settng wrong param
  
  Revision  ChangesPath
  1.2   +10 -11jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ajp_header.c  28 Jul 2004 14:43:46 -  1.1
  +++ ajp_header.c  28 Jul 2004 16:11:27 -  1.2
  @@ -42,8 +42,8 @@
   }
   
   
  -static apr_status_t sc_for_req_method(const char*method,
  - unsigned char *sc) 
  +static apr_status_t sc_for_req_method(const char *method,
  +  unsigned char *sc) 
   {
   apr_status_t rc = APR_SUCCESS;
   if(0 == strcmp(method, "GET")) {
  @@ -107,8 +107,8 @@
   return rc;
   }
   
  -static apr_status_t sc_for_req_header(const char *header_name,
  - unsigned short *sc) 
  +static apr_status_t sc_for_req_header(const char *header_name,
  +  apr_uint16_t *sc) 
   {
   switch((tolower(header_name[0]))) {
   case 'a':
  @@ -231,9 +231,8 @@
request_rec *r)
   {
   unsigned char method;
  -unsigned i;
  +apr_uint32_t i, num_headers = 0;
   apr_byte_t is_ssl;
  -short num_headers=0;
   char *remote_host;
   
   
  @@ -274,7 +273,7 @@
   }
   
   for (i = 0 ; i < num_headers ; i++) {
  -unsigned short sc;
  +apr_uint16_t sc;
   const apr_array_header_t *t = apr_table_elts(r->headers_in);
   const apr_table_entry_t *elts = (apr_table_entry_t *)t->elts;
   
  @@ -500,13 +499,13 @@
   apr_uint16_t name;
   char *stringname;
   char *value;
  -rc  = ajp_msg_peek_int(msg,&value);
  +rc  = ajp_msg_peek_uint16(msg, &name);
   if (rc != APR_SUCCESS) {
   return APR_EGENERAL;
   }
   
   if ((name & 0XFF00) == 0XA000) {
  -ajp_msg_peek_int(msg,&value);
  +ajp_msg_peek_uint16(msg, &name);
   name = name & 0X00FF;
   if (name <= SC_RES_HEADERS_NUM) {
   stringname = (char *)long_res_header_for_sc(name);
  @@ -543,8 +542,8 @@
   #endif
   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  "ajp_unmarshal_response: Header[%d] [%s] = [%s]\n", 
  -   i, name, value);
  -ap_table_add(r->headers_out, name, value);
  +   i, stringname, value);
  +apr_table_add(r->headers_out, stringname, value);
   }
   
   return APR_SUCCESS;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_header.c ajp_header.h Makefile ajp.h

2004-07-28 Thread jfclere
jfclere 2004/07/28 07:43:46

  Modified:ajp/ajplib/test Makefile ajp.h
  Added:   ajp/ajplib/test ajp_header.c ajp_header.h
  Log:
  Add the building/reading of the headers.
  
  Revision  ChangesPath
  1.3   +6 -3  jakarta-tomcat-connectors/ajp/ajplib/test/Makefile
  
  Index: Makefile
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/Makefile,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile  27 Jul 2004 15:23:19 -  1.2
  +++ Makefile  28 Jul 2004 14:43:46 -  1.3
  @@ -1,27 +1,30 @@
   #
   # You need an installed httpd-2.x to use this Makefile
   #
  +
   APACHE_DIR=/home2/apache20/apache20
   APR_DIR=$(APACHE_DIR)
   APU_DIR=$(APACHE_DIR)
   
  +include $(APR_DIR)/build/config_vars.mk
  +
   # in httpd-2.x sources...
   #APR_DIR=$(APACHE_DIR)/srclib/apr
   #APU_DIR=$(APACHE_DIR)/srclib/apr-util
   
   APR_INCLUDE=$(APR_DIR)/include
   APU_INCLUDE=$(APU_DIR)/include
  +APA_INCLUDE=$(APACHE_DIR)/include
   
   SRC_DIR=.
   INCLUDE=.
  -AJP_OBJECTS = ajp_link.lo  ajp_msg.lo  httpd_wrap.lo
  +AJP_OBJECTS = ajp_link.lo  ajp_msg.lo  httpd_wrap.lo ajp_header.lo
   AJP_PROGRAM = testajp.lo
   AJP_LIB = lib_ajp.la
   
  -INCLUDES = -I $(INCLUDE) -I $(APR_INCLUDE) -I $(APU_INCLUDE)
  +INCLUDES = -I $(INCLUDE) -I $(APR_INCLUDE) -I $(APU_INCLUDE) -I $(APA_INCLUDE)
   
   include $(APR_DIR)/build/apr_rules.mk
  -include $(APR_DIR)/build/config_vars.mk
   
   all: testajp
   
  
  
  
  1.6   +8 -0  jakarta-tomcat-connectors/ajp/ajplib/test/ajp.h
  
  Index: ajp.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ajp.h 28 Jul 2004 07:44:43 -  1.5
  +++ ajp.h 28 Jul 2004 14:43:46 -  1.6
  @@ -55,6 +55,14 @@
   
   #ifdef AJP_USE_HTTPD_WRAP
   #include "httpd_wrap.h"
  +#else
  +#include "httpd.h"
  +#include "http_config.h"
  +#include "http_request.h"
  +#include "http_core.h"
  +#include "http_protocol.h"
  +#include "http_main.h"
  +#include "http_log.h"
   #endif
   
   struct ajp_msg
  
  
  
  1.1  jakarta-tomcat-connectors/ajp/ajplib/test/ajp_header.c
  
  Index: ajp_header.c
  ===
  /*
   *  Copyright 1999-2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *  http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  
  #include "ajp_header.h"
  #include "ajp.h"
  
  static const char *response_trans_headers[] = {
  "Content-Type", 
  "Content-Language", 
  "Content-Length", 
  "Date", 
  "Last-Modified", 
  "Location", 
  "Set-Cookie", 
  "Set-Cookie2", 
  "Servlet-Engine", 
  "Status", 
  "WWW-Authenticate"
  };
  
  static const char *long_res_header_for_sc(int sc) 
  {
  const char *rc = NULL;
  if(sc <= SC_RES_HEADERS_NUM && sc > 0) {
  rc = response_trans_headers[sc - 1];
  }
  
  return rc;
  }
  
  
  static apr_status_t sc_for_req_method(const char*method,
   unsigned char *sc) 
  {
  apr_status_t rc = APR_SUCCESS;
  if(0 == strcmp(method, "GET")) {
  *sc = SC_M_GET;
  } else if(0 == strcmp(method, "POST")) {
  *sc = SC_M_POST;
  } else if(0 == strcmp(method, "HEAD")) {
  *sc = SC_M_HEAD;
  } else if(0 == strcmp(method, "PUT")) {
  *sc = SC_M_PUT;
  } else if(0 == strcmp(method, "DELETE")) {
  *sc = SC_M_DELETE;
  } else if(0 == strcmp(method, "OPTIONS")) {
  *sc = SC_M_OPTIONS;
  } else if(0 == strcmp(method, "TRACE")) {
  *sc = SC_M_TRACE;
  } else if(0 == strcmp(method, "PROPFIND")) {
  *sc = SC_M_PROPFIND;
  } else if(0 == strcmp(method, "PROPPATCH")) {
  *sc = SC_M_PROPPATCH;
  } else if(0 == strcmp(method, "MKCOL")) {
  *sc = SC_M_MKCOL;
  } else if(0 == strcmp(method, "COPY")) {
  *sc = SC_M_COPY;
  } else if(0 == strcmp(method, "MOVE")) {
  *sc = SC_M_MOVE;
  } else if(0 == strcmp(method, "LOCK")) {
  *sc = SC_M_LOCK;
  } else if(0 == strcmp(method, "UNLOCK")) {
  *sc = SC_M_UNLOCK;
  } else if(0 == strcmp(method, "ACL")) {
  *sc = SC_M_ACL;
  } else if(