1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

http occurances to update for apr_socket_opt_get/set

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
William A. Rowe Jr
2002-07-15 08:05:11 +00:00
parent 7207c17ad2
commit ed8fc9abae
10 changed files with 39 additions and 34 deletions

View File

@@ -308,7 +308,7 @@ static int ap_process_http_connection(conn_rec *c)
csd = ap_get_module_config(c->conn_config, &core_module); csd = ap_get_module_config(c->conn_config, &core_module);
csd_set = 1; csd_set = 1;
} }
apr_setsocketopt(csd, APR_INCOMPLETE_READ, 1); apr_socket_opt_set(csd, APR_INCOMPLETE_READ, 1);
} }
return OK; return OK;

View File

@@ -951,17 +951,18 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
#if !defined(TPF) && !defined(BEOS) #if !defined(TPF) && !defined(BEOS)
if (conf->recv_buffer_size > 0 if (conf->recv_buffer_size > 0
&& (rv = apr_setsocketopt(sock, APR_SO_RCVBUF, && (rv = apr_socket_opt_set(sock, APR_SO_RCVBUF,
conf->recv_buffer_size))) { conf->recv_buffer_size))) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); "apr_socket_opt_set(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
} }
#endif #endif
if (APR_SUCCESS != (rv = apr_setsocketopt(sock, APR_SO_REUSEADDR, one))) { if ((rv = apr_socket_opt_set(sock, APR_SO_REUSEADDR, one))
!= APR_SUCCESS) {
#ifndef _OSD_POSIX /* BS2000 has this option "always on" */ #ifndef _OSD_POSIX /* BS2000 has this option "always on" */
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy: FTP: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); "proxy: FTP: error setting reuseaddr option: apr_socket_opt_set(SO_REUSEADDR)");
return HTTP_INTERNAL_SERVER_ERROR; return HTTP_INTERNAL_SERVER_ERROR;
#endif /* _OSD_POSIX */ #endif /* _OSD_POSIX */
} }
@@ -1288,10 +1289,11 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
} }
#if !defined (TPF) && !defined(BEOS) #if !defined (TPF) && !defined(BEOS)
if (conf->recv_buffer_size > 0 && (rv = apr_setsocketopt(data_sock, APR_SO_RCVBUF, if (conf->recv_buffer_size > 0
conf->recv_buffer_size))) { && (rv = apr_socket_opt_set(data_sock, APR_SO_RCVBUF,
conf->recv_buffer_size))) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy: FTP: setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); "proxy: FTP: apr_socket_opt_set(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
} }
#endif #endif
@@ -1374,10 +1376,11 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
} }
#if !defined (TPF) && !defined(BEOS) #if !defined (TPF) && !defined(BEOS)
if (conf->recv_buffer_size > 0 && (rv = apr_setsocketopt(data_sock, APR_SO_RCVBUF, if (conf->recv_buffer_size > 0
conf->recv_buffer_size))) { && (rv = apr_socket_opt_set(data_sock, APR_SO_RCVBUF,
conf->recv_buffer_size))) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy: FTP: setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); "proxy: FTP: apr_socket_opt_set(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
} }
#endif #endif
@@ -1418,7 +1421,8 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
apr_sockaddr_port_get(&local_port, local_addr); apr_sockaddr_port_get(&local_port, local_addr);
apr_sockaddr_ip_get(&local_ip, local_addr); apr_sockaddr_ip_get(&local_ip, local_addr);
if ((rv = apr_setsocketopt(local_sock, APR_SO_REUSEADDR, one)) != APR_SUCCESS) { if ((rv = apr_socket_opt_set(local_sock, APR_SO_REUSEADDR, one))
!= APR_SUCCESS) {
#ifndef _OSD_POSIX /* BS2000 has this option "always on" */ #ifndef _OSD_POSIX /* BS2000 has this option "always on" */
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy: FTP: error setting reuseaddr option"); "proxy: FTP: error setting reuseaddr option");

View File

@@ -1148,10 +1148,10 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
#if !defined(TPF) && !defined(BEOS) #if !defined(TPF) && !defined(BEOS)
if (conf->recv_buffer_size > 0 && if (conf->recv_buffer_size > 0 &&
(rv = apr_setsocketopt(*newsock, APR_SO_RCVBUF, (rv = apr_socket_opt_set(*newsock, APR_SO_RCVBUF,
conf->recv_buffer_size))) { conf->recv_buffer_size))) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
"setsockopt(SO_RCVBUF): Failed to set " "apr_socket_opt_set(SO_RCVBUF): Failed to set "
"ProxyReceiveBufferSize, using default"); "ProxyReceiveBufferSize, using default");
} }
#endif #endif

View File

@@ -180,7 +180,7 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
*/ */
timeout = apr_time_from_sec(SECONDS_TO_LINGER); timeout = apr_time_from_sec(SECONDS_TO_LINGER);
apr_socket_timeout_set(csd, timeout); apr_socket_timeout_set(csd, timeout);
apr_setsocketopt(csd, APR_INCOMPLETE_READ, 1); apr_socket_opt_set(csd, APR_INCOMPLETE_READ, 1);
while (1) { while (1) {
nbytes = sizeof(dummybuf); nbytes = sizeof(dummybuf);
rc = apr_recv(csd, dummybuf, &nbytes); rc = apr_recv(csd, dummybuf, &nbytes);

View File

@@ -91,20 +91,20 @@ static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server)
apr_status_t stat; apr_status_t stat;
#ifndef WIN32 #ifndef WIN32
stat = apr_setsocketopt(s, APR_SO_REUSEADDR, one); stat = apr_socket_opt_set(s, APR_SO_REUSEADDR, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p,
"make_sock: for address %pI, setsockopt: (SO_REUSEADDR)", "make_sock: for address %pI, apr_socket_opt_set: (SO_REUSEADDR)",
server->bind_addr); server->bind_addr);
apr_socket_close(s); apr_socket_close(s);
return stat; return stat;
} }
#endif #endif
stat = apr_setsocketopt(s, APR_SO_KEEPALIVE, one); stat = apr_socket_opt_set(s, APR_SO_KEEPALIVE, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p,
"make_sock: for address %pI, setsockopt: (SO_KEEPALIVE)", "make_sock: for address %pI, apr_socket_opt_set: (SO_KEEPALIVE)",
server->bind_addr); server->bind_addr);
apr_socket_close(s); apr_socket_close(s);
return stat; return stat;
@@ -130,7 +130,7 @@ static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server)
* If no size is specified, use the kernel default. * If no size is specified, use the kernel default.
*/ */
if (send_buffer_size) { if (send_buffer_size) {
stat = apr_setsocketopt(s, APR_SO_SNDBUF, send_buffer_size); stat = apr_socket_opt_set(s, APR_SO_SNDBUF, send_buffer_size);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
ap_log_perror(APLOG_MARK, APLOG_WARNING, stat, p, ap_log_perror(APLOG_MARK, APLOG_WARNING, stat, p,
"make_sock: failed to set SendBufferSize for " "make_sock: failed to set SendBufferSize for "
@@ -172,10 +172,10 @@ static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server)
* So set reuseaddr, but do not attempt to do so until we have the * So set reuseaddr, but do not attempt to do so until we have the
* parent listeners successfully bound. * parent listeners successfully bound.
*/ */
stat = apr_setsocketopt(s, APR_SO_REUSEADDR, one); stat = apr_socket_opt_set(s, APR_SO_REUSEADDR, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p,
"make_sock: for address %pI, setsockopt: (SO_REUSEADDR)", "make_sock: for address %pI, apr_socket_opt_set: (SO_REUSEADDR)",
server->bind_addr); server->bind_addr);
apr_socket_close(s); apr_socket_close(s);
return stat; return stat;

View File

@@ -1958,7 +1958,7 @@ static int worker_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp,
#if APR_O_NONBLOCK_INHERITED #if APR_O_NONBLOCK_INHERITED
for(lr = ap_listeners ; lr != NULL ; lr = lr->next) { for(lr = ap_listeners ; lr != NULL ; lr = lr->next) {
apr_setsocketopt(lr->sd, APR_SO_NONBLOCK, 1); apr_socket_opt_set(lr->sd, APR_SO_NONBLOCK, 1);
} }
#endif /* APR_O_NONBLOCK_INHERITED */ #endif /* APR_O_NONBLOCK_INHERITED */

View File

@@ -465,7 +465,7 @@ void worker_main(void *arg)
/* If we got a new socket, set it to non-blocking mode and process /* If we got a new socket, set it to non-blocking mode and process
it. Otherwise handle the error. */ it. Otherwise handle the error. */
if (stat == APR_SUCCESS) { if (stat == APR_SUCCESS) {
apr_setsocketopt(csd, APR_SO_NONBLOCK, 0); apr_socket_opt_set(csd, APR_SO_NONBLOCK, 0);
#ifdef DBINFO_ON #ifdef DBINFO_ON
if (wouldblock_retry < MAX_WB_RETRIES) { if (wouldblock_retry < MAX_WB_RETRIES) {
retry_success++; retry_success++;
@@ -851,7 +851,7 @@ static int setup_listeners(server_rec *s)
} }
/* Use non-blocking listen sockets so that we /* Use non-blocking listen sockets so that we
never get hung up. */ never get hung up. */
apr_setsocketopt(lr->sd, APR_SO_NONBLOCK, 1); apr_socket_opt_set(lr->sd, APR_SO_NONBLOCK, 1);
} }
return 0; return 0;
} }

View File

@@ -1149,7 +1149,8 @@ static void worker_main(long thread_num)
if (c) { if (c) {
ap_process_connection(c, context->sock); ap_process_connection(c, context->sock);
apr_getsocketopt(context->sock, APR_SO_DISCONNECTED, &disconnected); apr_socket_opt_get(context->sock, APR_SO_DISCONNECTED,
&disconnected);
if (!disconnected) { if (!disconnected) {
context->accept_socket = INVALID_SOCKET; context->accept_socket = INVALID_SOCKET;
ap_lingering_close(c); ap_lingering_close(c);

View File

@@ -314,11 +314,11 @@ void ap_sock_disable_nagle(apr_socket_t *s)
* *
* In spite of these problems, failure here is not a shooting offense. * In spite of these problems, failure here is not a shooting offense.
*/ */
apr_status_t status = apr_setsocketopt(s, APR_TCP_NODELAY, 1); apr_status_t status = apr_socket_opt_set(s, APR_TCP_NODELAY, 1);
if (status != APR_SUCCESS) { if (status != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, status, ap_server_conf, ap_log_error(APLOG_MARK, APLOG_WARNING, status, ap_server_conf,
"setsockopt: (TCP_NODELAY)"); "apr_socket_opt_set: (TCP_NODELAY)");
} }
} }
#endif #endif

View File

@@ -717,7 +717,7 @@ static void write_request(struct connection * c)
#ifdef USE_SSL #ifdef USE_SSL
if (ssl != 1) if (ssl != 1)
#endif #endif
apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, 0); apr_socket_timeout_set(c->aprsock, 0);
c->connect = tnow; c->connect = tnow;
c->rwrite = reqlen; c->rwrite = reqlen;
c->rwrote = 0; c->rwrote = 0;
@@ -1225,7 +1225,7 @@ static void start_connect(struct connection * c)
SOCK_STREAM, c->ctx)) != APR_SUCCESS) { SOCK_STREAM, c->ctx)) != APR_SUCCESS) {
apr_err("socket", rv); apr_err("socket", rv);
} }
if ((rv = apr_setsocketopt(c->aprsock, APR_SO_NONBLOCK, 1)) if ((rv = apr_socket_opt_set(c->aprsock, APR_SO_NONBLOCK, 1))
!= APR_SUCCESS) { != APR_SUCCESS) {
apr_err("socket nonblock", rv); apr_err("socket nonblock", rv);
} }
@@ -1726,14 +1726,14 @@ static void test(void)
static void copyright(void) static void copyright(void)
{ {
if (!use_html) { if (!use_html) {
printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.110 $> apache-2.0"); printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.111 $> apache-2.0");
printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n"); printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n");
printf("\n"); printf("\n");
} }
else { else {
printf("<p>\n"); printf("<p>\n");
printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.110 $"); printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.111 $");
printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n"); printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/<br>\n"); printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/<br>\n");
printf("</p>\n<p>\n"); printf("</p>\n<p>\n");