📄 mod_jk.c
字号:
s++; break; case 't': *d++ = '\t'; s++; break; default: /* copy verbatim */ *d++ = '\\'; /* * Allow the loop to deal with this *s in the normal * fashion so that it handles end of string etc. * properly. */ break; } } } *d = '\0'; *sa = s; return NULL;}static char *parse_request_log_item(apr_pool_t * p, request_log_format_item * it, const char **sa){ const char *s = *sa; struct log_item_list *l; if (*s != '%') { return parse_request_log_misc_string(p, it, sa); } ++s; it->arg = ""; /* For safety's sake... */ l = find_log_func(*s++); if (!l) { char dummy[2]; dummy[0] = s[-1]; dummy[1] = '\0'; return apr_pstrcat(p, "Unrecognized JkRequestLogFormat directive %", dummy, NULL); } it->func = l->func; *sa = s; return NULL;}static apr_array_header_t *parse_request_log_string(apr_pool_t * p, const char *s, const char **err){ apr_array_header_t *a = apr_array_make(p, 15, sizeof(request_log_format_item)); char *res; while (*s) { if ((res = parse_request_log_item(p, (request_log_format_item *) apr_array_push(a), &s))) { *err = res; return NULL; } } s = "\n"; parse_request_log_item(p, (request_log_format_item *) apr_array_push(a), &s); return a;}/* * JkRequestLogFormat Directive Handling * * JkRequestLogFormat format string * * %b - Bytes sent, excluding HTTP headers. In CLF format * %B - Bytes sent, excluding HTTP headers. * %H - The request protocol * %m - The request method * %p - The canonical Port of the server serving the request * %q - The query string (prepended with a ? if a query string exists, * otherwise an empty string) * %r - First line of request * %s - request HTTP status code * %T - Requset duration, elapsed time to handle request in seconds '.' micro seconds * %U - The URL path requested, not including any query string. * %v - The canonical ServerName of the server serving the request. * %V - The server name according to the UseCanonicalName setting. * %w - Tomcat worker name */static const char *jk_set_request_log_format(cmd_parms * cmd, void *dummy, char *format){ const char *err_string = NULL; server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); conf->format_string = apr_pstrdup(cmd->pool, format); if (format != NULL) { conf->format = parse_request_log_string(cmd->pool, format, &err_string); } if (conf->format == NULL) return "JkRequestLogFormat format array NULL"; return err_string;}/* * JkExtractSSL Directive Handling * * JkExtractSSL On/Off */static const char *jk_set_enable_ssl(cmd_parms * cmd, void *dummy, int flag){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); /* Set up our value */ conf->ssl_enable = flag ? JK_TRUE : JK_FALSE; return NULL;}/* * JkHTTPSIndicator Directive Handling * * JkHTTPSIndicator HTTPS */static const char *jk_set_https_indicator(cmd_parms * cmd, void *dummy, const char *indicator){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); conf->https_indicator = apr_pstrdup(cmd->pool, indicator); return NULL;}/* * JkCERTSIndicator Directive Handling * * JkCERTSIndicator SSL_CLIENT_CERT */static const char *jk_set_certs_indicator(cmd_parms * cmd, void *dummy, const char *indicator){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); conf->certs_indicator = apr_pstrdup(cmd->pool, indicator); return NULL;}/* * JkCIPHERIndicator Directive Handling * * JkCIPHERIndicator SSL_CIPHER */static const char *jk_set_cipher_indicator(cmd_parms * cmd, void *dummy, const char *indicator){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); conf->cipher_indicator = apr_pstrdup(cmd->pool, indicator); return NULL;}/* * JkSESSIONIndicator Directive Handling * * JkSESSIONIndicator SSL_SESSION_ID */static const char *jk_set_session_indicator(cmd_parms * cmd, void *dummy, const char *indicator){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); conf->session_indicator = apr_pstrdup(cmd->pool, indicator); return NULL;}/* * JkKEYSIZEIndicator Directive Handling * * JkKEYSIZEIndicator SSL_CIPHER_USEKEYSIZE */static const char *jk_set_key_size_indicator(cmd_parms * cmd, void *dummy, const char *indicator){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); conf->key_size_indicator = apr_pstrdup(cmd->pool, indicator); return NULL;}/* * JkOptions Directive Handling * * * +ForwardSSLKeySize => Forward SSL Key Size, to follow 2.3 specs but may broke old TC 3.2 * -ForwardSSLKeySize => Don't Forward SSL Key Size, will make mod_jk works with all TC release * ForwardURICompat => Forward URI normally, less spec compliant but mod_rewrite compatible (old TC) * ForwardURICompatUnparsed => Forward URI as unparsed, spec compliant but broke mod_rewrite (old TC) * ForwardURIEscaped => Forward URI escaped and Tomcat (3.3 rc2) stuff will do the decoding part * ForwardDirectories => Forward all directory requests with no index files to Tomcat */static const char *jk_set_options(cmd_parms * cmd, void *dummy, const char *line){ int opt = 0; int mask = 0; char action; char *w; server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); while (line[0] != 0) { w = ap_getword_conf(cmd->pool, &line); action = 0; if (*w == '+' || *w == '-') { action = *(w++); } mask = 0; if (!strcasecmp(w, "ForwardKeySize")) { opt = JK_OPT_FWDKEYSIZE; } else if (!strcasecmp(w, "ForwardURICompat")) { opt = JK_OPT_FWDURICOMPAT; mask = JK_OPT_FWDURIMASK; } else if (!strcasecmp(w, "ForwardURICompatUnparsed")) { opt = JK_OPT_FWDURICOMPATUNPARSED; mask = JK_OPT_FWDURIMASK; } else if (!strcasecmp(w, "ForwardURIEscaped")) { opt = JK_OPT_FWDURIESCAPED; mask = JK_OPT_FWDURIMASK; } else if (!strcasecmp(w, "ForwardDirectories")) { opt = JK_OPT_FWDDIRS; } else if (!strcasecmp(w, "ForwardLocalAddress")) { opt = JK_OPT_FWDLOCAL; } else if (!strcasecmp(w, "FlushPackets")) { opt = JK_OPT_FLUSHPACKETS; } else return apr_pstrcat(cmd->pool, "JkOptions: Illegal option '", w, "'", NULL); conf->options &= ~mask; if (action == '-') { conf->options &= ~opt; } else if (action == '+') { conf->options |= opt; } else { /* for now +Opt == Opt */ conf->options |= opt; } } return NULL;}/* * JkEnvVar Directive Handling * * JkEnvVar MYOWNDIR */static const char *jk_add_env_var(cmd_parms * cmd, void *dummy, const char *env_name, const char *default_value){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); conf->envvars_in_use = JK_TRUE; apr_table_add(conf->envvars, env_name, default_value); return NULL;}/* * JkWorkerProperty Directive Handling * * JkWorkerProperty name=value */static const char *jk_set_worker_property(cmd_parms * cmd, void *dummy, const char *line){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); if (jk_map_read_property(conf->worker_properties, line) == JK_FALSE) return apr_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line); return NULL;}static const command_rec jk_cmds[] = { /* * JkWorkersFile specifies a full path to the location of the worker * properties file. * * This file defines the different workers used by apache to redirect * servlet requests. */ AP_INIT_TAKE1("JkWorkersFile", jk_set_worker_file, NULL, RSRC_CONF, "the name of a worker file for the Jakarta servlet containers"), /* * JkMountFile specifies a full path to the location of the * uriworker properties file. * * This file defines the different mapping for workers used by apache * to redirect servlet requests. */ AP_INIT_TAKE1("JkMountFile", jk_set_mount_file, NULL, RSRC_CONF, "the name of a mount file for the Jakarta servlet uri mapping"), /* * JkAutoMount specifies that the list of handled URLs must be * asked to the servlet engine (autoconf feature) */ AP_INIT_TAKE12("JkAutoMount", jk_automount_context, NULL, RSRC_CONF, "automatic mount points to a Tomcat worker"), /* * JkMount mounts a url prefix to a worker (the worker need to be * defined in the worker properties file. */ AP_INIT_TAKE12("JkMount", jk_mount_context, NULL, RSRC_CONF|ACCESS_CONF, "A mount point from a context to a Tomcat worker"), /* * JkUnMount unmounts a url prefix to a worker (the worker need to be * defined in the worker properties file. */ AP_INIT_TAKE12("JkUnMount", jk_unmount_context, NULL, RSRC_CONF|ACCESS_CONF, "A no mount point from a context to a Tomcat worker"), /* * JkMountCopy specifies if mod_jk should copy the mount points * from the main server to the virtual servers. */ AP_INIT_FLAG("JkMountCopy", jk_set_mountcopy, NULL, RSRC_CONF, "Should the base server mounts be copied to the virtual server"), /* * JkLogFile & JkLogLevel specifies to where should the plugin log * its information and how much. * JkLogStampFormat specify the time-stamp to be used on log */ AP_INIT_TAKE1("JkLogFile", jk_set_log_file, NULL, RSRC_CONF, "Full path to the Jakarta Tomcat module log file"), AP_INIT_TAKE1("JkShmFile", jk_set_shm_file, NULL, RSRC_CONF, "Full path to the Jakarta Tomcat module shared memory file"),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -