http_core.c revision 1c02d01901ef257e1fc9dd2cf7fdf83e81b8e7ef
/* Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed 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"
#define CORE_PRIVATE
#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 */
const char *arg)
{
return err;
}
return NULL;
}
const char *arg)
{
return err;
}
* so we accept anything but "Off" or "0" as "On"
*/
}
else {
}
return NULL;
}
const char *arg)
{
return err;
}
return NULL;
}
static const command_rec http_cmds[] = {
"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 }
};
static const char *http_scheme(const request_rec *r)
{
return "http";
}
{
return DEFAULT_HTTP_PORT;
}
static int ap_process_http_async_connection(conn_rec *c)
{
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;
}
static int ap_process_http_connection(conn_rec *c)
{
request_rec *r;
/*
* 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) {
c->keepalive = AP_CONN_UNKNOWN;
/* process the request if it was read without error */
/* 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;
if (ap_graceful_stop_signalled())
break;
if (!csd) {
}
/* Go straight to select() to wait for the next request */
}
return OK;
}
static int http_create_request(request_rec *r)
{
NULL, r, r->connection);
NULL, r, r->connection);
NULL, r, r->connection);
}
return OK;
}
static void register_hooks(apr_pool_t *p)
{
/**
* If we ae using an MPM That Supports Async Connections,
* use a different processing function
*/
int async_mpm = 0;
&& async_mpm == 1) {
}
else {
}
}
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 */
};