/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "apr_strings.h"
#include "apr_thread_proc.h" /* for RLIMIT stuff */
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "httpd.h"
#include "http_config.h"
#include "http_connection.h"
#include "http_core.h"
#include "http_protocol.h" /* For index_of_response(). Grump. */
#include "http_request.h"
#include "util_filter.h"
#include "util_ebcdic.h"
#include "ap_mpm.h"
#include "scoreboard.h"
#include "mod_core.h"
/* Handles for core filters */
/* If we are using an MPM That Supports Async Connections,
* use a different processing function
*/
static int async_mpm = 0;
const char *arg)
{
return err;
}
/* Stolen from mod_proxy.c */
return "KeepAliveTimeout has wrong format";
/* We don't want to take into account whether or not KeepAliveTimeout is
* set for the main server, because if no http_module directive is used
* for a vhost, it will inherit the http_srv_cfg from the main server.
* However keep_alive_timeout_set helps determine whether the vhost should
* use its own configured timeout or the one from the vhost delared first
* on the same IP:port (ie. c->base_server, and the legacy behaviour).
*/
}
return NULL;
}
int arg)
{
return err;
}
return NULL;
}
const char *arg)
{
return err;
}
return NULL;
}
"Keep-Alive timeout duration (sec)"),
"Maximum number of Keep-Alive requests per connection, "
"or 0 for infinite"),
"Whether persistent connections should be On or Off"),
{ NULL }
};
{
/*
* The http module shouldn't return anything other than
* "http" (the default) or "https".
*/
if (r->server->server_scheme &&
return "https";
return "http";
}
{
if (r->server->server_scheme &&
return DEFAULT_HTTPS_PORT;
return DEFAULT_HTTP_PORT;
}
{
request_rec *r;
if ((r = ap_read_request(c))) {
c->keepalive = AP_CONN_UNKNOWN;
/* process the request if it was read without error */
/* After the call to ap_process_request, the
* request pool may have been deleted. We set
* r=NULL here to ensure that any dereference
* of r that might be added later in this function
* will result in a segfault immediately instead
* of nondeterministic failures later.
*/
r = NULL;
}
/* Something went wrong; close the connection */
}
}
else { /* ap_read_request failed - client may have closed */
}
}
return OK;
}
{
request_rec *r;
int mpm_state = 0;
/*
* Read and process each request found on our connection
* until no requests are left or we decide to close.
*/
while ((r = ap_read_request(c)) != NULL) {
/* To preserve legacy behaviour, use the keepalive timeout from the
* base server (first on this IP:port) when none is explicitly
* configured on this server.
*/
if (!r->server->keep_alive_timeout_set) {
}
c->keepalive = AP_CONN_UNKNOWN;
/* process the request if it was read without error */
if (cs)
/* After the call to ap_process_request, the
* request pool will have been deleted. We set
* r=NULL here to ensure that any dereference
* of r that might be added later in this function
* will result in a segfault immediately instead
* of nondeterministic failures later.
*/
r = NULL;
}
break;
break;
}
if (mpm_state == AP_MPMQ_STOPPING) {
break;
}
if (!csd) {
csd = ap_get_conn_socket(c);
}
/* Go straight to select() to wait for the next request */
}
return OK;
}
{
if (async_mpm && !c->clogging_input_filters) {
return ap_process_http_async_connection(c);
}
else {
return ap_process_http_sync_connection(c);
}
}
{
NULL, r, r->connection);
NULL, r, r->connection);
NULL, r, r->connection);
NULL, r, r->connection);
}
return OK;
}
{
return DONE; /* Send HTTP pong, without Allow header */
}
return DECLINED;
}
{
async_mpm = 0;
}
return OK;
}
{
}
NULL, /* create per-directory config structure */
NULL, /* merge per-directory config structures */
NULL, /* create per-server config structure */
NULL, /* merge per-server config structures */
http_cmds, /* command apr_table_t */
register_hooks /* register hooks */
};