Lines 60-66
Link Here
|
60 |
* Description: Apache 2 plugin for Jakarta/Tomcat * |
60 |
* Description: Apache 2 plugin for Jakarta/Tomcat * |
61 |
* Author: Gal Shachor <shachor@il.ibm.com> * |
61 |
* Author: Gal Shachor <shachor@il.ibm.com> * |
62 |
* Henri Gomez <hgomez@slib.fr> * |
62 |
* Henri Gomez <hgomez@slib.fr> * |
63 |
* Version: $Revision: 1.70 $ * |
63 |
* Version: $Revision: 1.70.2.1 $ * |
64 |
***************************************************************************/ |
64 |
***************************************************************************/ |
65 |
|
65 |
|
66 |
/* |
66 |
/* |
Lines 314-320
Link Here
|
314 |
#ifdef AS400 |
314 |
#ifdef AS400 |
315 |
int long rv = OK; |
315 |
int long rv = OK; |
316 |
if (rv = ap_change_request_body_xlate(p->r, 65535, 65535)) /* turn off request body translation*/ |
316 |
if (rv = ap_change_request_body_xlate(p->r, 65535, 65535)) /* turn off request body translation*/ |
317 |
{ |
317 |
{ |
318 |
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, |
318 |
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, |
319 |
"mod_jk: Error on ap_change_request_body_xlate, rc=%d \n", |
319 |
"mod_jk: Error on ap_change_request_body_xlate, rc=%d \n", |
320 |
rv); |
320 |
rv); |
Lines 384-390
Link Here
|
384 |
} |
384 |
} |
385 |
#ifdef AS400 |
385 |
#ifdef AS400 |
386 |
rc = ap_change_response_body_xlate(p->r, 65535, 65535); /* turn off response body translation*/ |
386 |
rc = ap_change_response_body_xlate(p->r, 65535, 65535); /* turn off response body translation*/ |
387 |
if(rc){ |
387 |
if(rc){ |
388 |
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, |
388 |
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, |
389 |
"mod_jk: Error on ap_change_response_body_xlate, rc=%d \n", rc); |
389 |
"mod_jk: Error on ap_change_response_body_xlate, rc=%d \n", rc); |
390 |
return JK_FALSE; |
390 |
return JK_FALSE; |
Lines 453-459
Link Here
|
453 |
static int get_content_length(request_rec *r) |
453 |
static int get_content_length(request_rec *r) |
454 |
{ |
454 |
{ |
455 |
if(r->clength > 0) { |
455 |
if(r->clength > 0) { |
456 |
return r->clength; |
456 |
return (int)r->clength; |
457 |
} else if(r->main == NULL || r->main == r) { |
457 |
} else if(r->main == NULL || r->main == r) { |
458 |
char *lenp = (char *)apr_table_get(r->headers_in, "Content-Length"); |
458 |
char *lenp = (char *)apr_table_get(r->headers_in, "Content-Length"); |
459 |
|
459 |
|
Lines 507-519
Link Here
|
507 |
/* get server name */ |
507 |
/* get server name */ |
508 |
/* s->server_name= (char *)(r->hostname ? r->hostname : r->server->server_hostname); */ |
508 |
/* s->server_name= (char *)(r->hostname ? r->hostname : r->server->server_hostname); */ |
509 |
/* XXX : à la jk2 */ |
509 |
/* XXX : à la jk2 */ |
510 |
s->server_name = (char *)ap_get_server_name(r); |
510 |
s->server_name = (char *)ap_get_server_name(r); |
511 |
|
511 |
|
512 |
/* get the real port (otherwise redirect failed) */ |
512 |
/* get the real port (otherwise redirect failed) */ |
513 |
apr_sockaddr_port_get(&port,r->connection->local_addr); |
513 |
apr_sockaddr_port_get(&port,r->connection->local_addr); |
514 |
s->server_port = port; |
514 |
s->server_port = port; |
515 |
/* XXX : à la jk2 ???*/ |
515 |
/* XXX : à la jk2 ???*/ |
516 |
/* s->server_port = ap_get_server_port(r); */ |
516 |
/* s->server_port = ap_get_server_port(r); */ |
517 |
|
517 |
|
518 |
s->server_software = (char *)ap_get_server_version(); |
518 |
s->server_software = (char *)ap_get_server_version(); |
519 |
|
519 |
|
Lines 806-814
Link Here
|
806 |
const char *value) |
806 |
const char *value) |
807 |
{ |
807 |
{ |
808 |
server_rec *s = cmd->server; |
808 |
server_rec *s = cmd->server; |
809 |
struct stat statbuf; |
|
|
810 |
char *oldv; |
809 |
char *oldv; |
811 |
int rc; |
|
|
812 |
|
810 |
|
813 |
jk_server_conf_t *conf = |
811 |
jk_server_conf_t *conf = |
814 |
(jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module); |
812 |
(jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module); |
Lines 950-957
Link Here
|
950 |
return cp ? cp : "-"; |
948 |
return cp ? cp : "-"; |
951 |
} |
949 |
} |
952 |
|
950 |
|
953 |
static int request_log_transaction(request_rec *r, |
951 |
static void request_log_transaction(request_rec *r, |
954 |
jk_server_conf_t *conf) |
952 |
jk_server_conf_t *conf) |
955 |
{ |
953 |
{ |
956 |
request_log_format_item *items; |
954 |
request_log_format_item *items; |
957 |
char *str, *s; |
955 |
char *str, *s; |
Lines 978-983
Link Here
|
978 |
*s = 0; |
976 |
*s = 0; |
979 |
|
977 |
|
980 |
jk_log(conf->log, JK_LOG_REQUEST, "%s", str); |
978 |
jk_log(conf->log, JK_LOG_REQUEST, "%s", str); |
|
|
979 |
|
981 |
} |
980 |
} |
982 |
|
981 |
|
983 |
/***************************************************************** |
982 |
/***************************************************************** |
Lines 1080-1086
Link Here
|
1080 |
return "-"; |
1079 |
return "-"; |
1081 |
} |
1080 |
} |
1082 |
else { |
1081 |
else { |
1083 |
return apr_off_t_toa(r->pool, r->bytes_sent); |
1082 |
return apr_off_t_toa(r->pool, r->bytes_sent); |
1084 |
} |
1083 |
} |
1085 |
} |
1084 |
} |
1086 |
|
1085 |
|
Lines 1090-1096
Link Here
|
1090 |
return "0"; |
1089 |
return "0"; |
1091 |
} |
1090 |
} |
1092 |
else { |
1091 |
else { |
1093 |
return apr_psprintf(r->pool, "%" APR_OFF_T_FMT, r->bytes_sent); |
1092 |
return apr_psprintf(r->pool, "%" APR_OFF_T_FMT, r->bytes_sent); |
1094 |
} |
1093 |
} |
1095 |
} |
1094 |
} |
1096 |
|
1095 |
|
Lines 1218-1224
Link Here
|
1218 |
const char **sa) |
1217 |
const char **sa) |
1219 |
{ |
1218 |
{ |
1220 |
const char *s = *sa; |
1219 |
const char *s = *sa; |
1221 |
int i; |
|
|
1222 |
struct log_item_list *l; |
1220 |
struct log_item_list *l; |
1223 |
|
1221 |
|
1224 |
if (*s != '%') { |
1222 |
if (*s != '%') { |
Lines 1571-1578
Link Here
|
1571 |
"JkLogStampFormat", jk_set_log_fmt, NULL, RSRC_CONF, |
1569 |
"JkLogStampFormat", jk_set_log_fmt, NULL, RSRC_CONF, |
1572 |
"The Jakarta Tomcat module log format, follow strftime synthax"), |
1570 |
"The Jakarta Tomcat module log format, follow strftime synthax"), |
1573 |
AP_INIT_TAKE1( |
1571 |
AP_INIT_TAKE1( |
1574 |
"JkRequestLogFormat", jk_set_request_log_format, NULL, RSRC_CONF, |
1572 |
"JkRequestLogFormat", jk_set_request_log_format, NULL, RSRC_CONF, |
1575 |
"The Jakarta mod_jk module request log format string"), |
1573 |
"The Jakarta mod_jk module request log format string"), |
1576 |
|
1574 |
|
1577 |
/* |
1575 |
/* |
1578 |
* Automatically Alias webapp context directories into the Apache |
1576 |
* Automatically Alias webapp context directories into the Apache |
Lines 1871-1877
Link Here
|
1871 |
|
1869 |
|
1872 |
if (conf) |
1870 |
if (conf) |
1873 |
{ |
1871 |
{ |
1874 |
wc_close(conf->log); |
1872 |
/* On pool cleanup pass NULL for the jk_logger to |
|
|
1873 |
prevent segmentation faults on Windows because |
1874 |
we can't guarantee what order pools get cleaned |
1875 |
up between APR implementations. */ |
1876 |
wc_close(NULL); |
1875 |
if (conf->worker_properties) |
1877 |
if (conf->worker_properties) |
1876 |
map_free(&conf->worker_properties); |
1878 |
map_free(&conf->worker_properties); |
1877 |
if (conf->uri_to_context) |
1879 |
if (conf->uri_to_context) |
Lines 1879-1890
Link Here
|
1879 |
if (conf->automount) |
1881 |
if (conf->automount) |
1880 |
map_free(&conf->automount); |
1882 |
map_free(&conf->automount); |
1881 |
if (conf->uw_map) |
1883 |
if (conf->uw_map) |
1882 |
uri_worker_map_free(&conf->uw_map, conf->log); |
1884 |
uri_worker_map_free(&conf->uw_map, NULL); |
1883 |
/* Since we are now using apache to do logging, this |
|
|
1884 |
* cleanup will just cause problems so don't do it |
1885 |
* |
1886 |
* jk_close_file_logger(&conf->log); |
1887 |
*/ |
1888 |
} |
1885 |
} |
1889 |
s = s->next; |
1886 |
s = s->next; |
1890 |
} |
1887 |
} |
Lines 2078-2083
Link Here
|
2078 |
** +-------------------------------------------------------+ |
2075 |
** +-------------------------------------------------------+ |
2079 |
*/ |
2076 |
*/ |
2080 |
|
2077 |
|
|
|
2078 |
static apr_status_t jklog_cleanup(void *d) |
2079 |
{ |
2080 |
/* set the main_log to NULL */ |
2081 |
main_log = NULL; |
2082 |
return APR_SUCCESS; |
2083 |
} |
2084 |
|
2081 |
static void open_jklog(server_rec *s, apr_pool_t *p) |
2085 |
static void open_jklog(server_rec *s, apr_pool_t *p) |
2082 |
{ |
2086 |
{ |
2083 |
jk_server_conf_t *conf; |
2087 |
jk_server_conf_t *conf; |
Lines 2138-2143
Link Here
|
2138 |
conf->log = jkl; |
2142 |
conf->log = jkl; |
2139 |
if (main_log == NULL) |
2143 |
if (main_log == NULL) |
2140 |
main_log = conf->log; |
2144 |
main_log = conf->log; |
|
|
2145 |
apr_pool_cleanup_register(p, main_log, jklog_cleanup, jklog_cleanup); |
2141 |
return; |
2146 |
return; |
2142 |
} |
2147 |
} |
2143 |
|
2148 |
|
Lines 2234-2239
Link Here
|
2234 |
for (; s; s = s->next) { |
2239 |
for (; s; s = s->next) { |
2235 |
open_jklog(s, pconf); |
2240 |
open_jklog(s, pconf); |
2236 |
} |
2241 |
} |
|
|
2242 |
|
2237 |
return OK; |
2243 |
return OK; |
2238 |
} |
2244 |
} |
2239 |
|
2245 |
|
Lines 2263-2269
Link Here
|
2263 |
if(worker) { |
2269 |
if(worker) { |
2264 |
r->handler=apr_pstrdup(r->pool,JK_HANDLER); |
2270 |
r->handler=apr_pstrdup(r->pool,JK_HANDLER); |
2265 |
apr_table_setn(r->notes, JK_WORKER_ID, worker); |
2271 |
apr_table_setn(r->notes, JK_WORKER_ID, worker); |
2266 |
|
2272 |
|
2267 |
/* This could be a sub-request, possibly from mod_dir */ |
2273 |
/* This could be a sub-request, possibly from mod_dir */ |
2268 |
if(r->main) |
2274 |
if(r->main) |
2269 |
apr_table_setn(r->main->notes, JK_WORKER_ID, worker); |
2275 |
apr_table_setn(r->main->notes, JK_WORKER_ID, worker); |
Lines 2357-2363
Link Here
|
2357 |
/* Only if sub-request for a directory, most likely from mod_dir */ |
2363 |
/* Only if sub-request for a directory, most likely from mod_dir */ |
2358 |
if (r->main && r->main->filename && |
2364 |
if (r->main && r->main->filename && |
2359 |
!*apr_filename_of_pathname(r->main->filename)){ |
2365 |
!*apr_filename_of_pathname(r->main->filename)){ |
2360 |
|
2366 |
|
2361 |
/* The filename from the main request will be set to what should |
2367 |
/* The filename from the main request will be set to what should |
2362 |
* be picked up, aliases included. Tomcat will need to know about |
2368 |
* be picked up, aliases included. Tomcat will need to know about |
2363 |
* those aliases or things won't work for them. Normal files should |
2369 |
* those aliases or things won't work for them. Normal files should |
Lines 2385-2396
Link Here
|
2385 |
|
2391 |
|
2386 |
static void jk_register_hooks(apr_pool_t *p) |
2392 |
static void jk_register_hooks(apr_pool_t *p) |
2387 |
{ |
2393 |
{ |
2388 |
ap_hook_handler(jk_handler, NULL, NULL, APR_HOOK_MIDDLE); |
2394 |
/* Make sure mod_alias runs before mod_jk to make sure that |
|
|
2395 |
Alias's are mapped before mod_jk tries to process the request */ |
2396 |
static const char * const aszPre[] = { "mod_alias.c", NULL }; |
2397 |
|
2398 |
/* Make sure mod_dir runs after mod_jk so that a |
2399 |
DirectoryIndex index.jsp works */ |
2400 |
static const char * const aszPost[] = { "mod_dir.c", NULL }; |
2401 |
|
2402 |
ap_hook_handler(jk_handler,aszPre,aszPost,APR_HOOK_MIDDLE); |
2389 |
ap_hook_post_config(jk_post_config,NULL,NULL,APR_HOOK_MIDDLE); |
2403 |
ap_hook_post_config(jk_post_config,NULL,NULL,APR_HOOK_MIDDLE); |
2390 |
ap_hook_child_init(jk_child_init,NULL,NULL,APR_HOOK_MIDDLE); |
2404 |
ap_hook_child_init(jk_child_init,NULL,NULL,APR_HOOK_MIDDLE); |
2391 |
ap_hook_translate_name(jk_translate,NULL,NULL,APR_HOOK_FIRST); |
2405 |
ap_hook_translate_name(jk_translate,aszPre,aszPost,APR_HOOK_MIDDLE); |
2392 |
#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808) |
2406 |
#if (MODULE_MAGIC_NUMBER_MAJOR > 20010808) |
2393 |
ap_hook_map_to_storage(jk_map_to_storage, NULL, NULL, APR_HOOK_MIDDLE); |
2407 |
ap_hook_map_to_storage(jk_map_to_storage,aszPre,aszPost,APR_HOOK_MIDDLE); |
2394 |
#endif |
2408 |
#endif |
2395 |
} |
2409 |
} |
2396 |
|
2410 |
|