cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp14.c jk_ajp14.h
hgomez 01/06/29 07:53:14 Modified:jk/native/common jk_ajp14.c jk_ajp14.h Log: Autoconf works in progress in Ajp14 protocol handler The key of contexts is the virtual server, we should/could handle N contexts by M vrituals servers Revision ChangesPath 1.10 +138 -83 jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c Index: jk_ajp14.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- jk_ajp14.c2001/06/22 08:33:56 1.9 +++ jk_ajp14.c2001/06/29 14:53:13 1.10 @@ -58,7 +58,7 @@ /*** * Description: Next generation bi-directional protocol handler. * * Author: Henri Gomez [EMAIL PROTECTED] * - * Version: $Revision: 1.9 $ * + * Version: $Revision: 1.10 $ * ***/ @@ -399,89 +399,104 @@ * The Autoconf feature of AJP14, let us know which URL/URI could * be handled by the servlet-engine * - * +---+-++---+ - * | CONTEXT INFO CMD (1 byte) | VIRTUAL HOST NAME (CString (*)) | CONTEXT NAME (CString (*)) | URL1 [\n] URL2 [\n] URL3 [\n] | - * +---+-++---+ - * + * +---+-++---+---+ + * | CONTEXT INFO CMD (1 byte) | VIRTUAL HOST NAME (CString (*)) | CONTEXT NAME (CString (*)) | URL1 [\n] URL2 [\n] URL3 [\n] | NEXT CTX. | + * +---+-++---+---+ */ int ajp14_unmarshal_context_info(jk_msg_buf_t *msg, - jk_context_t *context, + jk_context_t *c, jk_logger_t *l) { -char *sname; - /* char *old; unused */ +char *vname; +char *cname; +char *uri; int i; -sname = (char *)jk_b_get_string(msg); +vname = (char *)jk_b_get_string(msg); -if (! sname) { +if (! vname) { jk_log(l, JK_LOG_ERROR, Error ajp14_unmarshal_context_info - can't get virtual hostname\n); return JK_FALSE; } -if (context-virtual) /* take care of removing previously allocated data */ -free(context-virtual); +/* Check if we get the correct virtual host */ +if (strcmp(c-virtual, vname)) { +/* set the virtual name, better to add to a virtual list ? */ + +if (context_set_virtual(c, vname) == JK_FALSE) { +jk_log(l, JK_LOG_ERROR, Error ajp14_unmarshal_context_info - can't malloc virtual hostname\n); +return JK_FALSE; +} +} -context-virtual = strdup(sname); +for (;;) { + +cname = (char *)jk_b_get_string(msg); -if (! context-virtual) { -jk_log(l, JK_LOG_ERROR, Error ajp14_unmarshal_context_info - can't malloc virtual hostname\n); -return JK_FALSE; -} +if (! cname) { +jk_log(l, JK_LOG_ERROR, Error ajp14_unmarshal_context_info - can't get context\n); +return JK_FALSE; +} -sname = (char *)jk_b_get_string(msg); +/* grab all contexts up to empty one which indicate end of contexts */ +if (! strlen(cname)) +break; -if (! sname) { -jk_log(l, JK_LOG_ERROR, Error ajp14_unmarshal_context_info - can't get context\n); -return JK_FALSE; -} +/* create new context base (if needed) */ -if (context-cbase) /* take care of removing previously allocated data */ -free(context-cbase); +if (context_add_base(c, cname) == JK_FALSE) { +jk_log(l, JK_LOG_ERROR, Error ajp14_unmarshal_context_info - can't add/set context %s\n, cname); +return JK_FALSE; +} -context-cbase = strdup(sname); - -if (! context-cbase) { -jk_log(l, JK_LOG_ERROR, Error ajp14_unmarshal_context_info - can't malloc context\n); -return JK_FALSE; -} + for (;;) { - for (i = 1;; i++) { +uri = (char *)jk_b_get_string(msg); - sname =
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp14.c jk_ajp14.h jk_ajp14_worker.c
hgomez 01/06/11 23:28:52 Modified:jk/native/common jk_ajp14.c jk_ajp14.h jk_ajp14_worker.c Log: Continuation on AJP14. The works is now on the Logon Phase Revision ChangesPath 1.5 +1 -2 jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c Index: jk_ajp14.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- jk_ajp14.c2001/06/07 14:35:44 1.4 +++ jk_ajp14.c2001/06/12 06:28:51 1.5 @@ -56,7 +56,7 @@ /*** * Description: Next generation bi-directional protocol handler. * * Author: Henri Gomez [EMAIL PROTECTED] * - * Version: $Revision: 1.4 $ * + * Version: $Revision: 1.5 $ * ***/ @@ -131,7 +131,6 @@ int ajp14_unmarshal_login_seed(jk_msg_buf_t *msg, jk_login_service_t *s, - jk_pool_t *p, jk_logger_t *l) { if (jk_b_get_bytes(msg, s-entropy, AJP14_ENTROPY_SEED_LEN) 0) { 1.4 +2 -3 jakarta-tomcat-connectors/jk/native/common/jk_ajp14.h Index: jk_ajp14.h === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_ajp14.h2001/06/07 14:35:46 1.3 +++ jk_ajp14.h2001/06/12 06:28:51 1.4 @@ -56,7 +56,7 @@ /*** * Description: Next generation bi-directional protocol handler. * * Author: Henri Gomez [EMAIL PROTECTED] * - * Version: $Revision: 1.3 $ * + * Version: $Revision: 1.4 $ * ***/ #ifndef JK_AJP14_H #define JK_AJP14_H @@ -71,7 +71,7 @@ #define AJP14_PROTO 14 #define AJP14_WS_HEADER 0x1235 -#define AJP14_SW_HEADER 0x4143 /* 'AC' */ +#define AJP14_SW_HEADER 0x1235 /* AJP14 use now the same header in both directions */ #define AJP14_DEF_HOST (localhost) #define AJP14_DEF_PORT (8011) @@ -299,7 +299,6 @@ int ajp14_unmarshal_login_seed(jk_msg_buf_t *msg, jk_login_service_t *s, -jk_pool_t *p, jk_logger_t *l); int ajp14_marshal_login_comp_into_msgb(jk_msg_buf_t *msg, 1.3 +122 -14 jakarta-tomcat-connectors/jk/native/common/jk_ajp14_worker.c Index: jk_ajp14_worker.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14_worker.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_ajp14_worker.c 2001/06/07 14:36:46 1.2 +++ jk_ajp14_worker.c 2001/06/12 06:28:51 1.3 @@ -56,7 +56,7 @@ /*** * Description: AJP14 next generation Bi-directional protocol. * * Author: Henri Gomez [EMAIL PROTECTED] * - * Version: $Revision: 1.2 $ * + * Version: $Revision: 1.3 $ * ***/ #include jk_context.h @@ -65,12 +65,13 @@ /* Method */ static int JK_METHOD validate(jk_worker_t *pThis, jk_map_t*props, + jk_worker_env_t *we, jk_logger_t *l) { ajp_worker_t *aw; char * secret_key; -if (ajp_validate(pThis, props, l, AJP14_PROTO) == JK_FALSE) +if (ajp_validate(pThis, props, we, l, AJP14_PROTO) == JK_FALSE) return JK_FALSE; aw = pThis-worker_private; @@ -85,20 +86,49 @@ return JK_TRUE; } +static int JK_METHOD get_endpoint(jk_worker_t*pThis, + jk_endpoint_t **pend, +