From: Ben Laurie Date: Tue, 29 Jun 1999 09:00:25 +0000 (+0000) Subject: New API for I/O layering, and dependency updates. X-Git-Tag: 1.3.7~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d4ecd1b907d2a992602e50d7db4479686abfe5b1;p=thirdparty%2Fapache%2Fhttpd.git New API for I/O layering, and dependency updates. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83398 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_connection.h b/include/http_connection.h index cbe8e74f4e7..47bf42494f9 100644 --- a/include/http_connection.h +++ b/include/http_connection.h @@ -62,6 +62,10 @@ extern "C" { #endif +conn_rec *ap_new_connection(pool *p, server_rec *server, BUFF *inout, + const struct sockaddr_in *remaddr, + const struct sockaddr_in *saddr, + int child_num); CORE_EXPORT(void) ap_process_connection(conn_rec *); #ifdef __cplusplus diff --git a/server/connection.c b/server/connection.c index 2ee7680f90c..2d190489282 100644 --- a/server/connection.c +++ b/server/connection.c @@ -182,13 +182,14 @@ static void lingering_close(request_rec *r) } #endif /* ndef NO_LINGCLOSE */ - CORE_EXPORT(void) ap_process_connection(conn_rec *c) { request_rec *r; ap_update_vhost_given_ip(c); + ap_run_pre_connection(c); + /* * Read and process each request found on our connection * until no requests are left or we decide to close. @@ -235,3 +236,34 @@ CORE_EXPORT(void) ap_process_connection(conn_rec *c) } #endif } + +/* Clearly some of this stuff doesn't belong in a generalised connection + structure, but for now... +*/ + +conn_rec *ap_new_connection(pool *p, server_rec *server, BUFF *inout, + const struct sockaddr_in *remaddr, + const struct sockaddr_in *saddr, + int child_num) +{ + conn_rec *conn = (conn_rec *) ap_pcalloc(p, sizeof(conn_rec)); + + /* Got a connection structure, so initialize what fields we can + * (the rest are zeroed out by pcalloc). + */ + + conn->conn_config=ap_create_conn_config(p); + + conn->child_num = child_num; + + conn->pool = p; + conn->local_addr = *saddr; + conn->base_server = server; + conn->client = inout; + + conn->remote_addr = *remaddr; + conn->remote_ip = ap_pstrdup(conn->pool, + inet_ntoa(conn->remote_addr.sin_addr)); + + return conn; +} diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 8e10f3693ab..6a84f596f2e 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -2000,36 +2000,6 @@ static void set_signals(void) #endif } -/***************************************************************** - * Connection structures and accounting... - */ - - -static conn_rec *new_connection(pool *p, server_rec *server, BUFF *inout, - const struct sockaddr_in *remaddr, - const struct sockaddr_in *saddr, - int child_num) -{ - conn_rec *conn = (conn_rec *) ap_pcalloc(p, sizeof(conn_rec)); - - /* Got a connection structure, so initialize what fields we can - * (the rest are zeroed out by pcalloc). - */ - - conn->child_num = child_num; - - conn->pool = p; - conn->local_addr = *saddr; - conn->base_server = server; - conn->client = inout; - - conn->remote_addr = *remaddr; - conn->remote_ip = ap_pstrdup(conn->pool, - inet_ntoa(conn->remote_addr.sin_addr)); - - return conn; -} - #if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) static void sock_disable_nagle(int s) { @@ -2353,10 +2323,10 @@ static void child_main(int child_num_arg) ap_bpush_iol(conn_io, iol); - current_conn = new_connection(ptrans, server_conf, conn_io, - (struct sockaddr_in *) &sa_client, - (struct sockaddr_in *) &sa_server, - my_child_num); + current_conn = ap_new_connection(ptrans, server_conf, conn_io, + (struct sockaddr_in *) &sa_client, + (struct sockaddr_in *) &sa_server, + my_child_num); ap_process_connection(current_conn); }