mod_jk.c
来自「以便Apache与其他服务进行整合 Mod_JK安装」· C语言 代码 · 共 2,094 行 · 第 1/5 页
C
2,094 行
return stuff;}static const char *log_worker_name(request_rec * r, char *a){ return ap_table_get(r->notes, JK_NOTE_WORKER_NAME);}static const char *log_worker_route(request_rec * r, char *a){ return ap_table_get(r->notes, JK_NOTE_WORKER_ROUTE);}static const char *log_request_duration(request_rec * r, char *a){ return ap_table_get(r->notes, JK_NOTE_REQUEST_DURATION);}static const char *log_request_line(request_rec * r, char *a){ /* NOTE: If the original request contained a password, we * re-write the request line here to contain XXXXXX instead: * (note the truncation before the protocol string for HTTP/0.9 requests) * (note also that r->the_request contains the unmodified request) */ return (r->parsed_uri.password) ? ap_pstrcat(r->pool, r->method, " ", ap_unparse_uri_components(r-> pool, &r-> parsed_uri, 0), r->assbackwards ? NULL : " ", r->protocol, NULL) : r->the_request;}/* These next two routines use the canonical name:port so that log * parsers don't need to duplicate all the vhost parsing crud. */static const char *log_virtual_host(request_rec * r, char *a){ return r->server->server_hostname;}static const char *log_server_port(request_rec * r, char *a){ return ap_psprintf(r->pool, "%u", r->server->port ? r->server-> port : ap_default_port(r));}/* This respects the setting of UseCanonicalName so that * the dynamic mass virtual hosting trick works better. */static const char *log_server_name(request_rec * r, char *a){ return ap_get_server_name(r);}static const char *log_request_uri(request_rec * r, char *a){ return r->uri;}static const char *log_request_method(request_rec * r, char *a){ return r->method;}static const char *log_request_protocol(request_rec * r, char *a){ return r->protocol;}static const char *log_request_query(request_rec * r, char *a){ return (r->args != NULL) ? ap_pstrcat(r->pool, "?", r->args, NULL) : "";}static const char *log_status(request_rec * r, char *a){ return pfmt(r->pool, r->status);}static const char *clf_log_bytes_sent(request_rec * r, char *a){ if (!r->sent_bodyct) { return "-"; } else { long int bs; ap_bgetopt(r->connection->client, BO_BYTECT, &bs); return ap_psprintf(r->pool, "%ld", bs); }}static const char *log_bytes_sent(request_rec * r, char *a){ if (!r->sent_bodyct) { return "0"; } else { long int bs; ap_bgetopt(r->connection->client, BO_BYTECT, &bs); return ap_psprintf(r->pool, "%ld", bs); }}static struct log_item_list{ char ch; item_key_func func;} log_item_keys[] = { { 'T', log_request_duration}, { 'r', log_request_line}, { 'U', log_request_uri}, { 's', log_status}, { 'b', clf_log_bytes_sent}, { 'B', log_bytes_sent}, { 'V', log_server_name}, { 'v', log_virtual_host}, { 'p', log_server_port}, { 'H', log_request_protocol}, { 'm', log_request_method}, { 'q', log_request_query}, { 'w', log_worker_name}, { 'R', log_worker_route}, { '\0'}};static struct log_item_list *find_log_func(char k){ int i; for (i = 0; log_item_keys[i].ch; ++i) if (k == log_item_keys[i].ch) { return &log_item_keys[i]; } return NULL;}static char *parse_request_log_misc_string(pool * p, request_log_format_item * it, const char **sa){ const char *s; char *d; it->func = constant_item; s = *sa; while (*s && *s != '%') { s++; } /* * This might allocate a few chars extra if there's a backslash * escape in the format string. */ it->arg = ap_palloc(p, s - *sa + 1); d = it->arg; s = *sa; while (*s && *s != '%') { if (*s != '\\') { *d++ = *s++; } else { s++; switch (*s) { case '\\': *d++ = '\\'; s++; break; case 'n': *d++ = '\n'; 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(pool * 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 ap_pstrcat(p, "Unrecognized JkRequestLogFormat directive %", dummy, NULL); } it->func = l->func; *sa = s; return NULL;}static array_header *parse_request_log_string(pool * p, const char *s, const char **err){ array_header *a = ap_make_array(p, 15, sizeof(request_log_format_item)); char *res; while (*s) { if ((res = parse_request_log_item(p, (request_log_format_item *) ap_push_array(a), &s))) { *err = res; return NULL; } } 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){ 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 = ap_pstrdup(cmd->pool, format); return NULL;}/* * JkWorkerIndicator Directive Handling * * JkWorkerIndicator JkWorker */static const char *jk_set_worker_indicator(cmd_parms * cmd, void *dummy, 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->worker_indicator = ap_pstrdup(cmd->pool, indicator); return NULL;}/* * 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, 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 = ap_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, 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 = ap_pstrdup(cmd->pool, indicator); return NULL;}/* * JkCIPHERIndicator Directive Handling * * JkCIPHERIndicator SSL_CIPHER */static const char *jk_set_cipher_indicator(cmd_parms * cmd, void *dummy, 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 = ap_pstrdup(cmd->pool, indicator); return NULL;}/* * JkCERTCHAINPrefix Directive Handling * * JkCERTCHAINPrefix SSL_CLIENT_CERT_CHAIN_ */static const char *jk_set_certchain_prefix(cmd_parms * cmd, void *dummy, const char *prefix){ server_rec *s = cmd->server; jk_server_conf_t *conf = (jk_server_conf_t *) ap_get_module_config(s->module_config, &jk_module); conf->certchain_prefix = ap_pstrdup(cmd->pool, prefix); return NULL;}/* * JkSESSIONIndicator Directive Handling * * JkSESSIONIndicator SSL_SESSION_ID */static const char *jk_set_session_indicator(cmd_parms * cmd, void *dummy, 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 = ap_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, char *indicator){ server_rec *s = cmd->server;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?