connection.c revision ec020ca384efb30d501a5af796ddc3bb237d7b8f
0797faae937515a5225a36db4a1ec79480d2555cjorton/* ====================================================================
0797faae937515a5225a36db4a1ec79480d2555cjorton * The Apache Software License, Version 1.1
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
0797faae937515a5225a36db4a1ec79480d2555cjorton * reserved.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * Redistribution and use in source and binary forms, with or without
0797faae937515a5225a36db4a1ec79480d2555cjorton * modification, are permitted provided that the following conditions
0797faae937515a5225a36db4a1ec79480d2555cjorton * are met:
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * 1. Redistributions of source code must retain the above copyright
0797faae937515a5225a36db4a1ec79480d2555cjorton * notice, this list of conditions and the following disclaimer.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * 2. Redistributions in binary form must reproduce the above copyright
0797faae937515a5225a36db4a1ec79480d2555cjorton * notice, this list of conditions and the following disclaimer in
0797faae937515a5225a36db4a1ec79480d2555cjorton * the documentation and/or other materials provided with the
0797faae937515a5225a36db4a1ec79480d2555cjorton * distribution.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * 3. The end-user documentation included with the redistribution,
0797faae937515a5225a36db4a1ec79480d2555cjorton * if any, must include the following acknowledgment:
0797faae937515a5225a36db4a1ec79480d2555cjorton * "This product includes software developed by the
0797faae937515a5225a36db4a1ec79480d2555cjorton * Apache Software Foundation (http://www.apache.org/)."
0797faae937515a5225a36db4a1ec79480d2555cjorton * Alternately, this acknowledgment may appear in the software itself,
0797faae937515a5225a36db4a1ec79480d2555cjorton * if and wherever such third-party acknowledgments normally appear.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * 4. The names "Apache" and "Apache Software Foundation" must
0797faae937515a5225a36db4a1ec79480d2555cjorton * not be used to endorse or promote products derived from this
0797faae937515a5225a36db4a1ec79480d2555cjorton * software without prior written permission. For written
0797faae937515a5225a36db4a1ec79480d2555cjorton * permission, please contact apache@apache.org.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * 5. Products derived from this software may not be called "Apache",
0797faae937515a5225a36db4a1ec79480d2555cjorton * nor may "Apache" appear in their name, without prior written
0797faae937515a5225a36db4a1ec79480d2555cjorton * permission of the Apache Software Foundation.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
0797faae937515a5225a36db4a1ec79480d2555cjorton * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
dca6643570b2f028bc7af76329bd7e333bf7493cpquerna * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
dca6643570b2f028bc7af76329bd7e333bf7493cpquerna * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
dca6643570b2f028bc7af76329bd7e333bf7493cpquerna * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dca6643570b2f028bc7af76329bd7e333bf7493cpquerna * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0797faae937515a5225a36db4a1ec79480d2555cjorton * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
0797faae937515a5225a36db4a1ec79480d2555cjorton * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2685f3814b77577ef7b2523442dab1ca88df1e41jorton * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0797faae937515a5225a36db4a1ec79480d2555cjorton * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
0797faae937515a5225a36db4a1ec79480d2555cjorton * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0797faae937515a5225a36db4a1ec79480d2555cjorton * SUCH DAMAGE.
0797faae937515a5225a36db4a1ec79480d2555cjorton * ====================================================================
fca945cb6bed035dcc6bbced5e327bbd4d8420abjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * This software consists of voluntary contributions made by many
0797faae937515a5225a36db4a1ec79480d2555cjorton * individuals on behalf of the Apache Software Foundation. For more
0797faae937515a5225a36db4a1ec79480d2555cjorton * information on the Apache Software Foundation, please see
0797faae937515a5225a36db4a1ec79480d2555cjorton * <http://www.apache.org/>.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * Portions of this software are based upon public domain software
0797faae937515a5225a36db4a1ec79480d2555cjorton * originally written at the National Center for Supercomputing Applications,
0797faae937515a5225a36db4a1ec79480d2555cjorton * University of Illinois, Urbana-Champaign.
0797faae937515a5225a36db4a1ec79480d2555cjorton */
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "apr.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "apr_strings.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton#define CORE_PRIVATE
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "ap_config.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "httpd.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "http_connection.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "http_request.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "http_protocol.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "ap_mpm.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "mpm_default.h"
2685f3814b77577ef7b2523442dab1ca88df1e41jorton#include "http_config.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "http_vhost.h"
2685f3814b77577ef7b2523442dab1ca88df1e41jorton#include "scoreboard.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "http_log.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton#include "util_filter.h"
0797faae937515a5225a36db4a1ec79480d2555cjorton
2685f3814b77577ef7b2523442dab1ca88df1e41jortonAPR_HOOK_STRUCT(
2685f3814b77577ef7b2523442dab1ca88df1e41jorton APR_HOOK_LINK(pre_connection)
0797faae937515a5225a36db4a1ec79480d2555cjorton APR_HOOK_LINK(process_connection)
0797faae937515a5225a36db4a1ec79480d2555cjorton)
2685f3814b77577ef7b2523442dab1ca88df1e41jorton
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c),(c),OK,DECLINED)
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_IMPLEMENT_HOOK_RUN_FIRST(int,process_connection,(conn_rec *c),(c),DECLINED)
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton/*
0797faae937515a5225a36db4a1ec79480d2555cjorton * More machine-dependent networking gooo... on some systems,
0797faae937515a5225a36db4a1ec79480d2555cjorton * you've got to be *really* sure that all the packets are acknowledged
0797faae937515a5225a36db4a1ec79480d2555cjorton * before closing the connection, since the client will not be able
fca945cb6bed035dcc6bbced5e327bbd4d8420abjorton * to see the last response if their TCP buffer is flushed by a RST
0797faae937515a5225a36db4a1ec79480d2555cjorton * packet from us, which is what the server's TCP stack will send
0797faae937515a5225a36db4a1ec79480d2555cjorton * if it receives any request data after closing the connection.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * In an ideal world, this function would be accomplished by simply
0797faae937515a5225a36db4a1ec79480d2555cjorton * setting the socket option SO_LINGER and handling it within the
2685f3814b77577ef7b2523442dab1ca88df1e41jorton * server's TCP stack while the process continues on to the next request.
fca945cb6bed035dcc6bbced5e327bbd4d8420abjorton * Unfortunately, it seems that most (if not all) operating systems
fca945cb6bed035dcc6bbced5e327bbd4d8420abjorton * block the server process on close() when SO_LINGER is used.
2685f3814b77577ef7b2523442dab1ca88df1e41jorton * For those that don't, see USE_SO_LINGER below. For the rest,
0797faae937515a5225a36db4a1ec79480d2555cjorton * we have created a home-brew lingering_close.
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * Many operating systems tend to block, puke, or otherwise mishandle
0797faae937515a5225a36db4a1ec79480d2555cjorton * calls to shutdown only half of the connection. You should define
0797faae937515a5225a36db4a1ec79480d2555cjorton * NO_LINGCLOSE in ap_config.h if such is the case for your system.
0797faae937515a5225a36db4a1ec79480d2555cjorton */
0797faae937515a5225a36db4a1ec79480d2555cjorton#ifndef MAX_SECS_TO_LINGER
0797faae937515a5225a36db4a1ec79480d2555cjorton#define MAX_SECS_TO_LINGER 30
0797faae937515a5225a36db4a1ec79480d2555cjorton#endif
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton#ifdef USE_SO_LINGER
0797faae937515a5225a36db4a1ec79480d2555cjorton#define NO_LINGCLOSE /* The two lingering options are exclusive */
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjortonstatic void sock_enable_linger(int s)
0797faae937515a5225a36db4a1ec79480d2555cjorton{
0797faae937515a5225a36db4a1ec79480d2555cjorton struct linger li;
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton li.l_onoff = 1;
0797faae937515a5225a36db4a1ec79480d2555cjorton li.l_linger = MAX_SECS_TO_LINGER;
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton if (setsockopt(s, SOL_SOCKET, SO_LINGER,
0797faae937515a5225a36db4a1ec79480d2555cjorton (char *) &li, sizeof(struct linger)) < 0) {
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
fca945cb6bed035dcc6bbced5e327bbd4d8420abjorton "setsockopt: (SO_LINGER)");
fca945cb6bed035dcc6bbced5e327bbd4d8420abjorton /* not a fatal error */
fca945cb6bed035dcc6bbced5e327bbd4d8420abjorton }
0b310e2cb91c7ca69a95637c05fae2fb124d7fcfpquerna}
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton#else
0797faae937515a5225a36db4a1ec79480d2555cjorton#define sock_enable_linger(s) /* NOOP */
0797faae937515a5225a36db4a1ec79480d2555cjorton#endif /* USE_SO_LINGER */
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c)
a91a59d0b0ceed7cd5621fe8757eda5ff6a043a8pquerna{
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_bucket_brigade *bb;
a91a59d0b0ceed7cd5621fe8757eda5ff6a043a8pquerna apr_bucket *b;
0797faae937515a5225a36db4a1ec79480d2555cjorton
a91a59d0b0ceed7cd5621fe8757eda5ff6a043a8pquerna bb = apr_brigade_create(c->pool);
0797faae937515a5225a36db4a1ec79480d2555cjorton b = apr_bucket_flush_create();
a91a59d0b0ceed7cd5621fe8757eda5ff6a043a8pquerna APR_BRIGADE_INSERT_TAIL(bb, b);
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_pass_brigade(c->output_filters, bb);
0797faae937515a5225a36db4a1ec79480d2555cjorton}
a91a59d0b0ceed7cd5621fe8757eda5ff6a043a8pquerna
0797faae937515a5225a36db4a1ec79480d2555cjorton/* we now proceed to read from the client until we get EOF, or until
a91a59d0b0ceed7cd5621fe8757eda5ff6a043a8pquerna * MAX_SECS_TO_LINGER has passed. the reasons for doing this are
0797faae937515a5225a36db4a1ec79480d2555cjorton * documented in a draft:
a91a59d0b0ceed7cd5621fe8757eda5ff6a043a8pquerna *
0797faae937515a5225a36db4a1ec79480d2555cjorton * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
0797faae937515a5225a36db4a1ec79480d2555cjorton *
0797faae937515a5225a36db4a1ec79480d2555cjorton * in a nutshell -- if we don't make this effort we risk causing
0797faae937515a5225a36db4a1ec79480d2555cjorton * TCP RST packets to be sent which can tear down a connection before
0797faae937515a5225a36db4a1ec79480d2555cjorton * all the response data has been sent to the client.
0797faae937515a5225a36db4a1ec79480d2555cjorton */
0797faae937515a5225a36db4a1ec79480d2555cjorton#define SECONDS_TO_LINGER 2
0797faae937515a5225a36db4a1ec79480d2555cjortonvoid ap_lingering_close(conn_rec *c)
2685f3814b77577ef7b2523442dab1ca88df1e41jorton{
0797faae937515a5225a36db4a1ec79480d2555cjorton char dummybuf[512];
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_size_t nbytes = sizeof(dummybuf);
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_status_t rc;
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_int32_t timeout;
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_int32_t total_linger_time = 0;
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_update_child_status(AP_CHILD_THREAD_FROM_ID(c->id), SERVER_CLOSING, NULL);
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton#ifdef NO_LINGCLOSE
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_flush_conn(c); /* just close it */
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_socket_close(c->client_socket);
0797faae937515a5225a36db4a1ec79480d2555cjorton return;
0797faae937515a5225a36db4a1ec79480d2555cjorton#endif
072f7e449a76d28b580de6e89a1723713ab9adb1jorton
072f7e449a76d28b580de6e89a1723713ab9adb1jorton /* Close the connection, being careful to send out whatever is still
072f7e449a76d28b580de6e89a1723713ab9adb1jorton * in our buffers. If possible, try to avoid a hard close until the
072f7e449a76d28b580de6e89a1723713ab9adb1jorton * client has ACKed our FIN and/or has stopped sending us data.
0797faae937515a5225a36db4a1ec79480d2555cjorton */
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton /* Send any leftover data to the client, but never try to again */
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_flush_conn(c);
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton if (c->aborted) {
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_socket_close(c->client_socket);
0797faae937515a5225a36db4a1ec79480d2555cjorton return;
0797faae937515a5225a36db4a1ec79480d2555cjorton }
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton /* Shut down the socket for write, which will send a FIN
0797faae937515a5225a36db4a1ec79480d2555cjorton * to the peer.
0797faae937515a5225a36db4a1ec79480d2555cjorton */
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton if (apr_shutdown(c->client_socket, APR_SHUTDOWN_WRITE) != APR_SUCCESS ||
0797faae937515a5225a36db4a1ec79480d2555cjorton c->aborted) {
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_socket_close(c->client_socket);
0797faae937515a5225a36db4a1ec79480d2555cjorton return;
0797faae937515a5225a36db4a1ec79480d2555cjorton }
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton /* Read all data from the peer until we reach "end-of-file" (FIN
0797faae937515a5225a36db4a1ec79480d2555cjorton * from peer) or we've exceeded our overall timeout. If the client does
0797faae937515a5225a36db4a1ec79480d2555cjorton * not send us bytes within 2 seconds (a value pulled from Apache 1.3
0797faae937515a5225a36db4a1ec79480d2555cjorton * which seems to work well), close the connection.
0797faae937515a5225a36db4a1ec79480d2555cjorton */
0797faae937515a5225a36db4a1ec79480d2555cjorton timeout = SECONDS_TO_LINGER * APR_USEC_PER_SEC;
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_setsocketopt(c->client_socket, APR_SO_TIMEOUT, timeout);
0797faae937515a5225a36db4a1ec79480d2555cjorton for (;;) {
0797faae937515a5225a36db4a1ec79480d2555cjorton nbytes = sizeof(dummybuf);
0797faae937515a5225a36db4a1ec79480d2555cjorton rc = apr_recv(c->client_socket, dummybuf, &nbytes);
0797faae937515a5225a36db4a1ec79480d2555cjorton if (rc != APR_SUCCESS || nbytes == 0) break;
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton total_linger_time += SECONDS_TO_LINGER;
0797faae937515a5225a36db4a1ec79480d2555cjorton if (total_linger_time >= MAX_SECS_TO_LINGER) {
0797faae937515a5225a36db4a1ec79480d2555cjorton break;
0797faae937515a5225a36db4a1ec79480d2555cjorton }
0797faae937515a5225a36db4a1ec79480d2555cjorton }
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_socket_close(c->client_socket);
0797faae937515a5225a36db4a1ec79480d2555cjorton}
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_CORE_DECLARE(void) ap_process_connection(conn_rec *c)
0797faae937515a5225a36db4a1ec79480d2555cjorton{
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_update_vhost_given_ip(c);
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_run_pre_connection(c);
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_run_process_connection(c);
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton}
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton/* Clearly some of this stuff doesn't belong in a generalised connection
0797faae937515a5225a36db4a1ec79480d2555cjorton structure, but for now...
0797faae937515a5225a36db4a1ec79480d2555cjorton*/
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjortonAP_CORE_DECLARE(conn_rec *)ap_new_connection(apr_pool_t *p, server_rec *server,
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_socket_t *inout, long id)
0797faae937515a5225a36db4a1ec79480d2555cjorton{
0797faae937515a5225a36db4a1ec79480d2555cjorton conn_rec *conn = (conn_rec *) apr_pcalloc(p, sizeof(conn_rec));
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_status_t rv;
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(id),
0797faae937515a5225a36db4a1ec79480d2555cjorton SERVER_BUSY_READ, (request_rec *) NULL);
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton /* Got a connection structure, so initialize what fields we can
0797faae937515a5225a36db4a1ec79480d2555cjorton * (the rest are zeroed out by pcalloc).
0797faae937515a5225a36db4a1ec79480d2555cjorton */
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton conn->conn_config=ap_create_conn_config(p);
072f7e449a76d28b580de6e89a1723713ab9adb1jorton conn->notes = apr_table_make(p, 5);
072f7e449a76d28b580de6e89a1723713ab9adb1jorton
072f7e449a76d28b580de6e89a1723713ab9adb1jorton conn->pool = p;
072f7e449a76d28b580de6e89a1723713ab9adb1jorton if ((rv = apr_socket_addr_get(&conn->local_addr, APR_LOCAL, inout))
0797faae937515a5225a36db4a1ec79480d2555cjorton != APR_SUCCESS) {
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
0797faae937515a5225a36db4a1ec79480d2555cjorton "apr_socket_addr_get(APR_LOCAL)");
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_socket_close(inout);
0797faae937515a5225a36db4a1ec79480d2555cjorton return NULL;
0797faae937515a5225a36db4a1ec79480d2555cjorton }
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_sockaddr_ip_get(&conn->local_ip, conn->local_addr);
0797faae937515a5225a36db4a1ec79480d2555cjorton if ((rv = apr_socket_addr_get(&conn->remote_addr, APR_REMOTE, inout))
0797faae937515a5225a36db4a1ec79480d2555cjorton != APR_SUCCESS) {
0797faae937515a5225a36db4a1ec79480d2555cjorton ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
0797faae937515a5225a36db4a1ec79480d2555cjorton "apr_socket_addr_get(APR_REMOTE)");
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_socket_close(inout);
0797faae937515a5225a36db4a1ec79480d2555cjorton return NULL;
0797faae937515a5225a36db4a1ec79480d2555cjorton }
0797faae937515a5225a36db4a1ec79480d2555cjorton apr_sockaddr_ip_get(&conn->remote_ip, conn->remote_addr);
0797faae937515a5225a36db4a1ec79480d2555cjorton conn->base_server = server;
0797faae937515a5225a36db4a1ec79480d2555cjorton conn->client_socket = inout;
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton conn->id = id;
0797faae937515a5225a36db4a1ec79480d2555cjorton
0797faae937515a5225a36db4a1ec79480d2555cjorton return conn;
0797faae937515a5225a36db4a1ec79480d2555cjorton}
0797faae937515a5225a36db4a1ec79480d2555cjorton