📄 mod_jk.c
字号:
/* ========================================================================= * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999-2001 The Apache Software Foundation. * * All rights reserved. * * * * ========================================================================= * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * * notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the redistribution, if any, * * must include the following acknowlegement: * * * * "This product includes software developed by the Apache Software * * Foundation <http://www.apache.org/>." * * * * Alternately, this acknowlegement may appear in the software itself, if * * and wherever such third-party acknowlegements normally appear. * * * * 4. The names "The Jakarta Project", "Jk", and "Apache Software * * Foundation" must not be used to endorse or promote products derived * * from this software without prior written permission. For written * * permission, please contact <apache@apache.org>. * * * * 5. Products derived from this software may not be called "Apache" nor may * * "Apache" appear in their names without prior written permission of the * * Apache Software Foundation. * * * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * * POSSIBILITY OF SUCH DAMAGE. * * * * ========================================================================= * * * * This software consists of voluntary contributions made by many indivi- * * duals on behalf of the Apache Software Foundation. For more information * * on the Apache Software Foundation, please see <http://www.apache.org/>. * * * * ========================================================================= *//*************************************************************************** * Description: Apache 1.3 plugin for Jakarta/Tomcat * * See ../common/jk_service.h for general mod_jk info * * Author: Gal Shachor <shachor@il.ibm.com> * * Dan Milstein <danmil@shore.net> * * Henri Gomez <hgomez@slib.fr> * * Version: $Revision: 1.35 $ * ***************************************************************************//* * mod_jk: keeps all servlet/jakarta related ramblings together. *//* #include "ap_config.h" */#include "httpd.h"#include "http_config.h"#include "http_request.h"#include "http_core.h"#include "http_protocol.h"#include "http_main.h"#include "http_log.h"#include "util_script.h"#include "util_date.h"#include "http_conf_globals.h"/* * Jakarta (jk_) include files */#ifdef NETWARE#define _SYS_TYPES_H_#define _NETDB_H_INCLUDED#define _IN_#define _INET_#define _SYS_TIMEVAL_H_#define _SYS_SOCKET_H_#endif#include "jk_global.h"#include "jk_util.h"#include "jk_map.h"#include "jk_pool.h"#include "jk_service.h"#include "jk_worker.h"#include "jk_uri_worker_map.h"#define JK_WORKER_ID ("jakarta.worker")#define JK_HANDLER ("jakarta-servlet")#define JK_DURATION ("jakarta.worker.duration")#define JK_MAGIC_TYPE ("application/x-jakarta-servlet")#define NULL_FOR_EMPTY(x) ((x && !strlen(x)) ? NULL : x) /* * If you are not using SSL, comment out the following line. It will make * apache run faster. * * Personally, I (DM), think this may be a lie. */#define ADD_SSL_INFO module MODULE_VAR_EXPORT jk_module;extern module dir_module;/* * Configuration object for the mod_jk module. */typedef struct { /* * Log stuff */ char *log_file; int log_level; jk_logger_t *log; /* * Worker stuff */ jk_map_t *worker_properties; char *worker_file; jk_map_t *uri_to_context; int mountcopy; char *secret_key; jk_map_t *automount; jk_uri_worker_map_t *uw_map; /* * Automatic context path apache alias */ char *alias_dir; /* * Request Logging */ char *format_string; array_header *format; /* * SSL Support */ int ssl_enable; char *https_indicator; char *certs_indicator; char *cipher_indicator; char *session_indicator; char *key_size_indicator; /* * Jk Options */ int options; /* * Environment variables support */ int envvars_in_use; table *envvars; server_rec *s;} jk_server_conf_t;/* * The "private", or subclass portion of the web server service class for * Apache 1.3. An instance of this class is created for each request * handled. See jk_service.h for details about the ws_service object in * general. */struct apache_private_data { /* * For memory management for this request. Aliased to be identical to * the pool in the superclass (jk_ws_service). */ jk_pool_t p; /* True iff response headers have been returned to client */ int response_started; /* True iff request body data has been read from Apache */ int read_body_started; /* Apache request structure */ request_rec *r; };typedef struct apache_private_data apache_private_data_t;typedef struct dir_config_struct { array_header *index_names;} dir_config_rec;static jk_logger_t *main_log = NULL;static jk_worker_env_t worker_env;static int JK_METHOD ws_start_response(jk_ws_service_t *s, int status, const char *reason, const char * const *header_names, const char * const *header_values, unsigned num_of_headers);static int JK_METHOD ws_read(jk_ws_service_t *s, void *b, unsigned l, unsigned *a);static int JK_METHOD ws_write(jk_ws_service_t *s, const void *b, unsigned l);/* ====================================================================== *//* JK Service step callbacks *//* ====================================================================== *//* * Send the HTTP response headers back to the browser. * * Think of this function as a method of the apache1.3-specific subclass of * the jk_ws_service class. Think of the *s param as a "this" or "self" * pointer.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -