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

2004-08-02 Thread mturk
mturk   2004/08/02 09:36:29

  Modified:ajp/ajplib/test testajp.c
  Log:
  Use the parse_data for received body message.
  
  Revision  ChangesPath
  1.12  +2 -6  jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- testajp.c 30 Jul 2004 19:57:47 -  1.11
  +++ testajp.c 2 Aug 2004 16:36:28 -   1.12
  @@ -256,12 +256,8 @@
   ajp_msg_dump(msg, "");
   #endif
   {
  -/* XXX we will need a function for this */
  -apr_byte_t t;
  -/* Get Type */
  -ajp_msg_get_byte(msg, &t);
  -fprintf(stdout, "Message Len Type %d should be (SC_BODY_CHUNK 3)\n", t);
  -ajp_msg_get_string(msg, &buf);
  +apr_uint16_t blen;
  +ajp_parse_data(r, msg, &blen, &buf);
   fputs(buf, stdout);
   }
   /* 6. Release the connection*/
  
  
  

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



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

2004-07-30 Thread mturk
mturk   2004/07/30 12:18:59

  Modified:ajp/ajplib/test testajp.c
  Log:
  And finaly, read the returned data from the container.
  
  Revision  ChangesPath
  1.10  +25 -9 jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- testajp.c 30 Jul 2004 18:01:47 -  1.9
  +++ testajp.c 30 Jul 2004 19:18:59 -  1.10
  @@ -40,13 +40,12 @@
   #endif
   
   #define TEST_POST_DATA "This document is a proposal of evolution of the current " \
  -   "Apache JServ Protocol version 1.3, also known as ajp13. "
  +   "Apache JServ Protocol version 1.3, also known as ajp13. " \
  +   "I'll not cover here the full protocol but only the add-on 
from ajp13. " \
  +   "This nth pass include comments from the tomcat-dev list and 
" \
  +   "misses discovered during developpment."
   
  -//"I'll not cover here the full protocol but only the add-on from ajp13. " \
  -//   "This nth pass include comments from the tomcat-dev list 
and " \
  -//   "misses discovered during developpment."
  -
  -#define TEST_CASE_URL "http://localhost/servlets-examples/HelloWorldExample";
  +#define TEST_CASE_URL 
"http://localhost/servlets-examples/servlet/RequestHeaderExample";
   
   /* Main process */
   static process_rec *main_process;
  @@ -196,7 +195,7 @@
   /* 0. Fill in the request data  */
   if (ap_wrap_make_request(r, TEST_CASE_URL,
"POST",
  - "application/x-www-form-urlencoded",
  + NULL, //"application/x-www-form-urlencoded",
NULL,
sizeof(TEST_POST_DATA) - 1,
TEST_POST_DATA) != APR_SUCCESS) {
  @@ -223,6 +222,7 @@
   goto finished;
   }
   /* 3. Send AJP message  */
  +
   ajp_alloc_data_msg(r, &buf, &len, &msg);
   
   /* Send the initial POST BODY */
  @@ -234,9 +234,11 @@
   if (ap_should_client_block(r)) {
   len = ap_get_client_block(r, buf, len);
   }
  +else
  +len = ap_get_client_block(r, buf, len);
   
  -ajp_send_data_msg(sock, r, msg, len);
   
  +ajp_send_data_msg(sock, r, msg, len);
   
   /* 4. Read AJP response */
   if ((rc = ajp_read_header(sock, r, &msg)) != APR_SUCCESS) {
  @@ -245,9 +247,23 @@
   goto finished;
   }
   
  -/* 5. Display results   */
  +ajp_msg_create(r->pool, &msg);
  +ajp_msg_reset(msg);
  +ajp_ilink_receive(sock, msg);
   
  +/* 5. Display results   */
  +#if 1
   ajp_msg_dump(msg, "");
  +#endif
  +{
  +/* XXX we will need a function for this */
  +apr_byte_t t;
  +/* Get Type */
  +ajp_msg_get_byte(msg, &t);
  +fprintf(stdout, "Message Len Type %d should be (SC_BODY_CHUNK 3)\n", t);
  +ajp_msg_get_string(msg, &buf);
  +fputs(buf, stdout);
  +}
   /* 6. Release the connection*/
   
   
  
  
  

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



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

2004-07-30 Thread mturk
mturk   2004/07/30 11:01:48

  Modified:ajp/ajplib/test testajp.c
  Log:
  Send some post data to the backend
  
  Revision  ChangesPath
  1.9   +26 -7 jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- testajp.c 30 Jul 2004 09:00:22 -  1.8
  +++ testajp.c 30 Jul 2004 18:01:47 -  1.9
  @@ -40,10 +40,11 @@
   #endif
   
   #define TEST_POST_DATA "This document is a proposal of evolution of the current " \
  -   "Apache JServ Protocol version 1.3, also known as ajp13. " \
  -   "I'll not cover here the full protocol but only the add-on 
from ajp13. " \
  -   "This nth pass include comments from the tomcat-dev list and 
" \
  -   "misses discovered during developpment."
  +   "Apache JServ Protocol version 1.3, also known as ajp13. "
  +
  +//"I'll not cover here the full protocol but only the add-on from ajp13. " \
  +//   "This nth pass include comments from the tomcat-dev list 
and " \
  +//   "misses discovered during developpment."
   
   #define TEST_CASE_URL "http://localhost/servlets-examples/HelloWorldExample";
   
  @@ -163,6 +164,8 @@
   request_rec *r;
   apr_socket_t *sock;
   ajp_msg_t *msg;
  +char *buf;
  +apr_size_t len;
   
   apr_app_initialize(&argc, &argv, &env);
   
  @@ -192,9 +195,11 @@
   
   /* 0. Fill in the request data  */
   if (ap_wrap_make_request(r, TEST_CASE_URL,
  - "POST", NULL, NULL,
  - 0,
  - NULL) != APR_SUCCESS) {
  + "POST",
  + "application/x-www-form-urlencoded",
  + NULL,
  + sizeof(TEST_POST_DATA) - 1,
  + TEST_POST_DATA) != APR_SUCCESS) {
   goto finished;
   }
   /*
  @@ -218,6 +223,20 @@
   goto finished;
   }
   /* 3. Send AJP message  */
  +ajp_alloc_data_msg(r, &buf, &len, &msg);
  +
  +/* Send the initial POST BODY */
  +if (ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +   "Error ajp_marshal_into_msgb - "
  +   "Can't setting client block");
  +}
  +if (ap_should_client_block(r)) {
  +len = ap_get_client_block(r, buf, len);
  +}
  +
  +ajp_send_data_msg(sock, r, msg, len);
  +
   
   /* 4. Read AJP response */
   if ((rc = ajp_read_header(sock, r, &msg)) != APR_SUCCESS) {
  
  
  

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



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

2004-07-30 Thread mturk
mturk   2004/07/30 02:00:22

  Modified:ajp/ajplib/test testajp.c
  Log:
  Dump the message after receiving.
  
  Revision  ChangesPath
  1.8   +1 -0  jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- testajp.c 30 Jul 2004 08:53:31 -  1.7
  +++ testajp.c 30 Jul 2004 09:00:22 -  1.8
  @@ -228,6 +228,7 @@
   
   /* 5. Display results   */
   
  +ajp_msg_dump(msg, "");
   /* 6. Release the connection*/
   
   
  
  
  

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



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

2004-07-30 Thread mturk
mturk   2004/07/30 01:53:32

  Modified:ajp/ajplib/test testajp.c
  Log:
  Added simple post data and read_header.
  What we need is function to send the post data to the backend.
  
  Revision  ChangesPath
  1.7   +17 -4 jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- testajp.c 29 Jul 2004 08:12:57 -  1.6
  +++ testajp.c 30 Jul 2004 08:53:31 -  1.7
  @@ -39,6 +39,12 @@
   #include 
   #endif
   
  +#define TEST_POST_DATA "This document is a proposal of evolution of the current " \
  +   "Apache JServ Protocol version 1.3, also known as ajp13. " \
  +   "I'll not cover here the full protocol but only the add-on 
from ajp13. " \
  +   "This nth pass include comments from the tomcat-dev list and 
" \
  +   "misses discovered during developpment."
  +
   #define TEST_CASE_URL "http://localhost/servlets-examples/HelloWorldExample";
   
   /* Main process */
  @@ -78,7 +84,6 @@
   return APR_SUCCESS;
   }
   
  -
   #if APR_HAS_THREADS
   
   #define TEST_THREAD_COUNT   10
  @@ -157,6 +162,7 @@
   conn_rec *c, *con;
   request_rec *r;
   apr_socket_t *sock;
  +ajp_msg_t *msg;
   
   apr_app_initialize(&argc, &argv, &env);
   
  @@ -186,7 +192,9 @@
   
   /* 0. Fill in the request data  */
   if (ap_wrap_make_request(r, TEST_CASE_URL,
  - NULL, NULL, NULL, 0, NULL) != APR_SUCCESS) {
  + "POST", NULL, NULL,
  + 0,
  + NULL) != APR_SUCCESS) {
   goto finished;
   }
   /*
  @@ -198,20 +206,25 @@
   /* 1. Obtain a connection to backend*/
   if ((rc = connect_to_backend(&sock, &con, "127.0.0.1", 8009,
   main_server, r->pool)) != APR_SUCCESS) {
  -ap_log_error(APLOG_MARK, APLOG_INFO, rc, NULL, "connect_to_backend");
  +ap_log_error(APLOG_MARK, APLOG_ERR, rc, NULL, "connect_to_backend");
   rv = -1;
   goto finished;
   }
   
   /* 2. Create AJP message*/
   if ((rc = ajp_send_header(sock, r)) != APR_SUCCESS) {
  -ap_log_error(APLOG_MARK, APLOG_INFO, rc, NULL, "ajp_send_header");
  +ap_log_error(APLOG_MARK, APLOG_ERR, rc, NULL, "ajp_send_header");
   rv = -1;
   goto finished;
   }
   /* 3. Send AJP message  */
   
   /* 4. Read AJP response */
  +if ((rc = ajp_read_header(sock, r, &msg)) != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, rc, NULL, "ajp_read_header");
  +rv = -1;
  +goto finished;
  +}
   
   /* 5. Display results   */
   
  
  
  

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



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

2004-07-29 Thread jean-frederic clere
Mladen Turk wrote:
 
Hi,

Running testajp (ajp_send_header) I see in catalina console:
2004.07.29 09:58:23 org.apache.jk.common.HandlerRequest invoke
INFO: Unknown message 72
Something missing?
Yes, a ajp_msg_reset() was missing. I have committed the change.
MT.

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


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

2004-07-29 Thread jfclere
jfclere 2004/07/29 01:12:57

  Modified:ajp/ajplib/test testajp.c
  Log:
  Don't include httpd_wrap.h that is done in ajp.h.
  Conditionaly add APR_PROTO_TCP to apr_socket_create().
  
  Revision  ChangesPath
  1.6   +3 -1  jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- testajp.c 29 Jul 2004 07:57:10 -  1.5
  +++ testajp.c 29 Jul 2004 08:12:57 -  1.6
  @@ -30,7 +30,6 @@
   #include "apr_optional_hooks.h"
   #include "apr_buckets.h"
   
  -#include "httpd_wrap.h"
   #include "ajp.h"
   
   #if APR_HAVE_NETINET_IN_H
  @@ -61,6 +60,9 @@
   port, 0, pool)) != APR_SUCCESS)
   return rv;
   if ((rv = apr_socket_create(socket, remote_sa->family, SOCK_STREAM,
  +#if (APR_MAJOR_VERSION > 0)
  +APR_PROTO_TCP,
  +#endif
   pool)) != APR_SUCCESS)
   return rv;
   if ((rv = apr_socket_timeout_set(*socket,
  
  
  

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



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

2004-07-29 Thread Mladen Turk
 
Hi,

Running testajp (ajp_send_header) I see in catalina console:

2004.07.29 09:58:23 org.apache.jk.common.HandlerRequest invoke
INFO: Unknown message 72

Something missing?

MT.



smime.p7s
Description: S/MIME cryptographic signature


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

2004-07-29 Thread mturk
mturk   2004/07/29 00:57:10

  Modified:ajp/ajplib/test testajp.c
  Log:
  Wow, we are connected to TC from console app!
  
  Revision  ChangesPath
  1.5   +51 -3 jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testajp.c 28 Jul 2004 05:38:45 -  1.4
  +++ testajp.c 29 Jul 2004 07:57:10 -  1.5
  @@ -31,6 +31,7 @@
   #include "apr_buckets.h"
   
   #include "httpd_wrap.h"
  +#include "ajp.h"
   
   #if APR_HAVE_NETINET_IN_H
   #include 
  @@ -39,11 +40,43 @@
   #include 
   #endif
   
  +#define TEST_CASE_URL "http://localhost/servlets-examples/HelloWorldExample";
  +
   /* Main process */
   static process_rec *main_process;
   /* Default server */
   static server_rec *main_server;
   
  +/* This function is part of backend.
  + * The backend return connected socket and conn_rec
  + */
  +static apr_status_t connect_to_backend(apr_socket_t **socket, conn_rec **con,
  +   const char *host, apr_uint16_t port,
  +   server_rec *server, apr_pool_t *pool)
  +{
  +apr_status_t rv;
  +apr_sockaddr_t *remote_sa;
  +
  +if ((rv = apr_sockaddr_info_get(&remote_sa, host, APR_UNSPEC,
  +port, 0, pool)) != APR_SUCCESS)
  +return rv;
  +if ((rv = apr_socket_create(socket, remote_sa->family, SOCK_STREAM,
  +pool)) != APR_SUCCESS)
  +return rv;
  +if ((rv = apr_socket_timeout_set(*socket,
  +   apr_time_from_sec(3))) != APR_SUCCESS)  
  +return rv;
  +if ((rv = apr_socket_connect(*socket, remote_sa)) != APR_SUCCESS)
  +return rv;
  +
  +if (!(*con = ap_run_create_connection(pool, server, *socket,
  +  0, NULL, NULL)))
  +return APR_EGENERAL;
  +
  +return APR_SUCCESS;
  +}
  +
  +
   #if APR_HAS_THREADS
   
   #define TEST_THREAD_COUNT   10
  @@ -118,8 +151,10 @@
   int main(int argc, const char * const * argv, const char * const *env)
   {
   int rv = 0;
  -conn_rec *c;
  +apr_status_t rc;
  +conn_rec *c, *con;
   request_rec *r;
  +apr_socket_t *sock;
   
   apr_app_initialize(&argc, &argv, &env);
   
  @@ -148,7 +183,10 @@
   
   
   /* 0. Fill in the request data  */
  -
  +if (ap_wrap_make_request(r, TEST_CASE_URL,
  + NULL, NULL, NULL, 0, NULL) != APR_SUCCESS) {
  +goto finished;
  +}
   /*
* Up to here HTTPD created that for each request.
* From now on, we have a server_rec, conn_rec, and request_rec
  @@ -156,9 +194,19 @@
*/
   
   /* 1. Obtain a connection to backend*/
  +if ((rc = connect_to_backend(&sock, &con, "127.0.0.1", 8009,
  +main_server, r->pool)) != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_INFO, rc, NULL, "connect_to_backend");
  +rv = -1;
  +goto finished;
  +}
   
   /* 2. Create AJP message*/
  -
  +if ((rc = ajp_send_header(sock, r)) != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_INFO, rc, NULL, "ajp_send_header");
  +rv = -1;
  +goto finished;
  +}
   /* 3. Send AJP message  */
   
   /* 4. Read AJP response */
  
  
  

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



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

2004-07-27 Thread mturk
mturk   2004/07/27 22:38:45

  Modified:ajp/ajplib/test testajp.c
  Log:
  Make test case actually do something.
  
  Revision  ChangesPath
  1.4   +124 -12   jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- testajp.c 27 Jul 2004 17:28:31 -  1.3
  +++ testajp.c 28 Jul 2004 05:38:45 -  1.4
  @@ -39,38 +39,150 @@
   #include 
   #endif
   
  -int test_create_conn(apr_pool_t *pool)
  +/* Main process */
  +static process_rec *main_process;
  +/* Default server */
  +static server_rec *main_server;
  +
  +#if APR_HAS_THREADS
  +
  +#define TEST_THREAD_COUNT   10
  +static apr_thread_t *threads[TEST_THREAD_COUNT];
  +
  +static void * APR_THREAD_FUNC thread_worker_func(apr_thread_t *thd, void *data)
   {
  -conn_rec *c;
  +request_rec *r;
  +conn_rec *c = (conn_rec *)data;
  +
  +/* Create an empty request */
  +if (!(r = ap_wrap_create_request(c)))
  +goto cleanup;
  +
  +/* TODO: do something usefull */
  +apr_sleep(apr_time_from_sec(1));
  +
  +/* Clean up the request */
  +apr_pool_destroy(r->pool);
  +
  +apr_thread_exit(thd, APR_SUCCESS);
  +return NULL;
  +cleanup:
  +apr_thread_exit(thd, APR_EGENERAL);
  +return NULL;
  +}
  +
  +static int create_threads(server_rec *server)
  +{
  +int i;
  +apr_status_t rv;
  +
  +for (i = 0; i < TEST_THREAD_COUNT; i++) {
  +conn_rec *c;
  +/* Create a single client connection. The dummy one of course. */
  +if (!(c = ap_run_create_connection(server->process->pool, server,
  +   NULL, 0, NULL, NULL)))
  +return -1;
  +
  +if ((rv = apr_thread_create(&threads[i], NULL,
  +thread_worker_func, (void *)c,
  +server->process->pool)) != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_INFO, rv, NULL, "apr_create_thread 
failed");
  +return -1;
  +}
  +}
  +ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "Created %d worker threads", i);
   
  -if (!(c = ap_run_create_connection(pool, NULL, NULL,
  -   0, NULL, NULL)))
  -return -1;
  -ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "local ip %s:%d", 
  - c->local_ip, c->local_addr->port);
  -
   return 0;
   }
   
  +static int join_threads()
  +{
  +int i, rc = 0;
  +apr_status_t rv;
  +
  +for (i = 0; i < TEST_THREAD_COUNT; i++) {
  +apr_thread_join(&rv, threads[i]);
  +if (rv != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "Worker thread %d 
failed", i);
  +rc = -1;
  +}
  +}
  +
  +ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "All (%d) worker threads joined", 
i);
  +
  +return rc;
  +}
  +
  +#endif
   
   int main(int argc, const char * const * argv, const char * const *env)
   {
   int rv = 0;
  -apr_pool_t *ctx;
  +conn_rec *c;
  +request_rec *r;
  +
   apr_app_initialize(&argc, &argv, &env);
   
  -apr_pool_create(&ctx, NULL);
   /* This is done in httpd.conf using LogLevel debug directive.
* We are setting this directly.
*/
   ap_default_loglevel = APLOG_DEBUG;
   
   ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "Testing ajp...");
  -ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "create conn...");
  -if ((rv = test_create_conn(ctx)))
  +ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "Creating main server...");
  +
  +main_process = ap_wrap_create_process(argc, argv);
  +/* Create the main server_rec */
  +main_server  = ap_wrap_create_server(main_process, main_process->pool);
  +/* Create a single client connection. The dummy one of course. */
  +if (!(c = ap_run_create_connection(main_process->pool, main_server,
  +   NULL, 0, NULL, NULL))) {
  +rv = -1;
  +goto finished;
  +}
  +/* ... and a empty request */
  +if (!(r = ap_wrap_create_request(c))) {
  +rv = -1;
  +goto finished;
  +}
  +
  +
  +/* 0. Fill in the request data  */
  +
  +/*
  + * Up to here HTTPD created that for each request.
  + * From now on, we have a server_rec, conn_rec, and request_rec
  + * Who will ever need something else :)
  + */
  +
  +/* 1. Obtain a connection to backend*/
  +
  +/* 2. Create AJP message*/
  +
  +/* 3. Send AJP message  */
  +
  +/* 4. Read AJP response */
  +
  +/* 5. Display results   */
  +
  +/* 6. Release the connection*/

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

2004-07-27 Thread mturk
mturk   2004/07/27 10:28:31

  Modified:ajp/ajplib/test testajp.c httpd_wrap.c
  Log:
  Add create_connection test case. Rewrite create_connection, so if the
  socket is missing (we don't have a client) the address is set to localhost.
  
  Revision  ChangesPath
  1.3   +20 -2 jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- testajp.c 27 Jul 2004 12:09:12 -  1.2
  +++ testajp.c 27 Jul 2004 17:28:31 -  1.3
  @@ -39,20 +39,38 @@
   #include 
   #endif
   
  +int test_create_conn(apr_pool_t *pool)
  +{
  +conn_rec *c;
  +
  +if (!(c = ap_run_create_connection(pool, NULL, NULL,
  +   0, NULL, NULL)))
  +return -1;
  +ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "local ip %s:%d", 
  + c->local_ip, c->local_addr->port);
  +
  +return 0;
  +}
  +
  +
   int main(int argc, const char * const * argv, const char * const *env)
   {
   int rv = 0;
  -
  +apr_pool_t *ctx;
   apr_app_initialize(&argc, &argv, &env);
   
  +apr_pool_create(&ctx, NULL);
   /* This is done in httpd.conf using LogLevel debug directive.
* We are setting this directly.
*/
   ap_default_loglevel = APLOG_DEBUG;
   
   ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "Testing ajp...");
  +ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "create conn...");
  +if ((rv = test_create_conn(ctx)))
  +goto finished;
   
  -
  +finished:
   ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "%s", rv == 0 ? "OK" : "FAILED");
   apr_terminate();
   }
  
  
  
  1.5   +34 -15jakarta-tomcat-connectors/ajp/ajplib/test/httpd_wrap.c
  
  Index: httpd_wrap.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/httpd_wrap.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- httpd_wrap.c  27 Jul 2004 16:28:05 -  1.4
  +++ httpd_wrap.c  27 Jul 2004 17:28:31 -  1.5
  @@ -179,23 +179,42 @@
   c->notes = apr_table_make(ptrans, 5);
   
   c->pool = ptrans;
  -if ((rv = apr_socket_addr_get(&c->local_addr, APR_LOCAL, csd))
  -!= APR_SUCCESS) {
  -ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
  - "apr_socket_addr_get(APR_LOCAL)");
  -apr_socket_close(csd);
  -return NULL;
  -}
   
  -apr_sockaddr_ip_get(&c->local_ip, c->local_addr);
  -if ((rv = apr_socket_addr_get(&c->remote_addr, APR_REMOTE, csd))
  -!= APR_SUCCESS) {
  -ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
  - "apr_socket_addr_get(APR_REMOTE)");
  -apr_socket_close(csd);
  -return NULL;
  +/* Socket is used only for backend connections
  + * Since we don't have client socket skip the 
  + * creation of adresses. They will be default
  + * to 127.0.0.1:0 both local and remote
  + */
  +if (csd) {
  +if ((rv = apr_socket_addr_get(&c->local_addr, APR_LOCAL, csd))
  +!= APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
  +"apr_socket_addr_get(APR_LOCAL)");
  +apr_socket_close(csd);
  +return NULL;
  + }
  + if ((rv = apr_socket_addr_get(&c->remote_addr, APR_REMOTE, csd))
  +!= APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
  +"apr_socket_addr_get(APR_REMOTE)");
  +apr_socket_close(csd);
  +return NULL;
  + }
  +} 
  +else {
  +/* localhost should be reachable on all platforms */
  +if ((rv = apr_sockaddr_info_get(&c->local_addr, "localhost",
  +APR_UNSPEC, 0,
  +APR_IPV4_ADDR_OK, 
  +c->pool))
  +!= APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
  +"apr_sockaddr_info_get()");
  +return NULL;
  + }
  + c->remote_addr = c->local_addr;
   }
  -
  +apr_sockaddr_ip_get(&c->local_ip, c->local_addr);
   apr_sockaddr_ip_get(&c->remote_ip, c->remote_addr);
   c->base_server = server;
   
  
  
  

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



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

2004-07-27 Thread jean-frederic clere
Henri Gomez wrote:
Mladen Turk wrote:
 

Henri Gomez wrote:
Mladen what about commiting your work on mod_ajp.
Even if we didn't take any decisions yet, it will be usefull to have 
it save somewhere in ASF CVS ;)


It's on the apache web site, so it won't get lost, cause I have no 
intent to
remove it :)
Let's wait for a while on creating any new directories, cause they 
cannot be
erased once created.

It can wait, at least until we have a libajp+testajp capable of getting
HelloWorldExample servlet, thought
We won't have a SSL support for start, but IMO when we reach that phase
we'll have a clearer picture on the underlying framework.

Ok, I hope JFC could make us a configure/makefile for Unixes.
I have just committed a primitive Makefile to help testing on Unix.
I'm working on some ajp functions right now. I may commit them
before end of day.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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


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

2004-07-27 Thread Henri Gomez
Mladen Turk wrote:
 

Henri Gomez wrote:
Mladen what about commiting your work on mod_ajp.
Even if we didn't take any decisions yet, it will be usefull 
to have it save somewhere in ASF CVS ;)


It's on the apache web site, so it won't get lost, cause I have no intent to
remove it :)
Let's wait for a while on creating any new directories, cause they cannot be
erased once created.
It can wait, at least until we have a libajp+testajp capable of getting
HelloWorldExample servlet, thought
We won't have a SSL support for start, but IMO when we reach that phase
we'll have a clearer picture on the underlying framework.
Ok, I hope JFC could make us a configure/makefile for Unixes.
I'm working on some ajp functions right now. I may commit them
before end of day.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2004-07-27 Thread Mladen Turk
 

Henri Gomez wrote:
> 
> Mladen what about commiting your work on mod_ajp.
>
> Even if we didn't take any decisions yet, it will be usefull 
> to have it save somewhere in ASF CVS ;)
> 

It's on the apache web site, so it won't get lost, cause I have no intent to
remove it :)
Let's wait for a while on creating any new directories, cause they cannot be
erased once created.

It can wait, at least until we have a libajp+testajp capable of getting
HelloWorldExample servlet, thought
We won't have a SSL support for start, but IMO when we reach that phase
we'll have a clearer picture on the underlying framework.

MT.


smime.p7s
Description: S/MIME cryptographic signature


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

2004-07-27 Thread Henri Gomez
[EMAIL PROTECTED] wrote:
mturk   2004/07/27 05:09:12
Mladen what about commiting your work on mod_ajp.
Even if we didn't take any decisions yet, it will
be usefull to have it save somewhere in ASF CVS ;)
Regards
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2004-07-27 Thread mturk
mturk   2004/07/27 05:09:12

  Modified:ajp/ajplib/test testajp.c httpd_wrap.c
  Log:
  Forgot the loglevel. Quite rude and simple, but it will fulfill the needs.
  
  Revision  ChangesPath
  1.2   +6 -0  jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- testajp.c 27 Jul 2004 11:43:42 -  1.1
  +++ testajp.c 27 Jul 2004 12:09:12 -  1.2
  @@ -44,6 +44,12 @@
   int rv = 0;
   
   apr_app_initialize(&argc, &argv, &env);
  +
  +/* This is done in httpd.conf using LogLevel debug directive.
  + * We are setting this directly.
  + */
  +ap_default_loglevel = APLOG_DEBUG;
  +
   ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "Testing ajp...");
   
   
  
  
  
  1.2   +6 -1  jakarta-tomcat-connectors/ajp/ajplib/test/httpd_wrap.c
  
  Index: httpd_wrap.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/httpd_wrap.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- httpd_wrap.c  27 Jul 2004 11:42:57 -  1.1
  +++ httpd_wrap.c  27 Jul 2004 12:09:12 -  1.2
  @@ -33,6 +33,8 @@
   
   #include "httpd_wrap.h"
   
  +int AP_DECLARE_DATA ap_default_loglevel = DEFAULT_LOGLEVEL;
  +
   static const char *levels[] = {
   "emerg",
   "alert",
  @@ -52,7 +54,10 @@
   FILE *stream;
   char timstr[32];
   char errstr[MAX_STRING_LEN];
  -
  +
  +/* Skip the loging for lower levels */
  +if (level < 0 || level > ap_default_loglevel)
  +return;
   if (level < APLOG_WARNING)
   stream = stderr;
   else
  
  
  

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



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

2004-07-27 Thread mturk
mturk   2004/07/27 04:43:42

  Added:   ajp/ajplib/test testajp.c
  Log:
  Simple test case. Just write the log message and exit.
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-connectors/ajp/ajplib/test/testajp.c
  
  Index: testajp.c
  ===
  /* Copyright 2000-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 "apr.h"
  #include "apr_lib.h"
  #include "apr_strings.h"
  #include "apr_buckets.h"
  #include "apr_md5.h"
  #include "apr_network_io.h"
  #include "apr_pools.h"
  #include "apr_strings.h"
  #include "apr_uri.h"
  #include "apr_date.h"
  #include "apr_fnmatch.h"
  #define APR_WANT_STRFUNC
  #include "apr_want.h"
   
  #include "apr_hooks.h"
  #include "apr_optional_hooks.h"
  #include "apr_buckets.h"
  
  #include "httpd_wrap.h"
  
  #if APR_HAVE_NETINET_IN_H
  #include 
  #endif
  #if APR_HAVE_ARPA_INET_H
  #include 
  #endif
  
  int main(int argc, const char * const * argv, const char * const *env)
  {
  int rv = 0;
  
  apr_app_initialize(&argc, &argv, &env);
  ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "Testing ajp...");
  
  
  ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, "%s", rv == 0 ? "OK" : "FAILED");
  apr_terminate();
  }
  
  
  

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