diff options
author | Jeff Trawick <trawick@apache.org> | 2001-02-01 18:21:49 +0100 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2001-02-01 18:21:49 +0100 |
commit | 288e2cc490719b95f3c5e96469c8e0d78e27f4a8 (patch) | |
tree | 8988a531224ef2bb883b6e4d24de712d3f473827 /server/connection.c | |
parent | This file will go away. For this moment, the s/FindFirstFile/apr_stat/ (diff) | |
download | apache2-288e2cc490719b95f3c5e96469c8e0d78e27f4a8.tar.xz apache2-288e2cc490719b95f3c5e96469c8e0d78e27f4a8.zip |
handle a TCP connection reset between the time we accept the connection
and when apr_get_sockaddr() does getsockname() or getpeername()
this change will be rolled into the other MPMs later
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87947 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/connection.c')
-rw-r--r-- | server/connection.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/server/connection.c b/server/connection.c index 5c9f50bf01..6287fa2177 100644 --- a/server/connection.c +++ b/server/connection.c @@ -67,6 +67,7 @@ #include "mpm_status.h" #include "http_config.h" #include "http_vhost.h" +#include "http_log.h" #include "util_filter.h" #ifdef HAVE_NETINET_IN_H @@ -270,6 +271,7 @@ conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, apr_socket_t *inout, long id) { conn_rec *conn = (conn_rec *) apr_pcalloc(p, sizeof(conn_rec)); + apr_status_t rv; /* Got a connection structure, so initialize what fields we can * (the rest are zeroed out by pcalloc). @@ -279,9 +281,21 @@ conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, conn->notes = apr_make_table(p, 5); conn->pool = p; - apr_get_sockaddr(&conn->local_addr, APR_LOCAL, inout); + if ((rv = apr_get_sockaddr(&conn->local_addr, APR_LOCAL, inout)) + != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_INFO, rv, server, + "apr_get_sockaddr(APR_LOCAL)"); + apr_close_socket(inout); + return NULL; + } apr_get_ipaddr(&conn->local_ip, conn->local_addr); - apr_get_sockaddr(&conn->remote_addr, APR_REMOTE, inout); + if ((rv = apr_get_sockaddr(&conn->remote_addr, APR_REMOTE, inout)) + != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_INFO, rv, server, + "apr_get_sockaddr(APR_REMOTE)"); + apr_close_socket(inout); + return NULL; + } apr_get_ipaddr(&conn->remote_ip, conn->remote_addr); conn->base_server = server; conn->client_socket = inout; |