Loading modules/proxy/proxy_connect.c +11 −13 Original line number Diff line number Diff line Loading @@ -104,13 +104,11 @@ int ap_proxy_connect_handler(request_rec *r, char *url, { apr_pool_t *p = r->pool; apr_socket_t *sock; apr_status_t err, rv; char buffer[HUGE_STRING_LEN]; int i, err; int i; apr_size_t nbytes; #if 0 apr_socket_t *client_sock = NULL; #endif apr_pollfd_t *pollfd; apr_int32_t pollcnt; apr_int16_t pollevent; Loading Loading @@ -193,8 +191,8 @@ int ap_proxy_connect_handler(request_rec *r, char *url, } /* create a new socket */ if ((apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: error creating socket"); return HTTP_INTERNAL_SERVER_ERROR; } Loading @@ -217,11 +215,11 @@ int ap_proxy_connect_handler(request_rec *r, char *url, while (connect_addr) { /* make the connection out of the socket */ err = apr_connect(sock, connect_addr); rv = apr_connect(sock, connect_addr); /* if an error occurred, loop round and try again */ if (err != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server, if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: CONNECT: attempt to connect to %pI (%s) failed", connect_addr, connectname); connect_addr = connect_addr->next; continue; Loading Loading @@ -296,10 +294,10 @@ int ap_proxy_connect_handler(request_rec *r, char *url, /* r->sent_bodyct = 1;*/ if(apr_poll_setup(&pollfd, 2, r->pool) != APR_SUCCESS) if((rv = apr_poll_setup(&pollfd, 2, r->pool)) != APR_SUCCESS) { apr_socket_close(sock); ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll_setup()"); return HTTP_INTERNAL_SERVER_ERROR; } Loading @@ -312,10 +310,10 @@ int ap_proxy_connect_handler(request_rec *r, char *url, while (1) { /* Infinite loop until error (one side closes the connection) */ /* ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, "proxy: CONNECT: going to sleep (poll)");*/ if (apr_poll(pollfd, &pollcnt, -1) != APR_SUCCESS) if ((rv = apr_poll(pollfd, &pollcnt, -1)) != APR_SUCCESS) { apr_socket_close(sock); ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: CONNECT: error apr_poll()"); ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll()"); return HTTP_INTERNAL_SERVER_ERROR; } /* ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, Loading modules/proxy/proxy_ftp.c +27 −28 Original line number Diff line number Diff line Loading @@ -633,24 +633,24 @@ int ap_proxy_ftp_handler(request_rec *r, char *url) } if ((apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error creating socket"); return HTTP_INTERNAL_SERVER_ERROR; } #if !defined(TPF) && !defined(BEOS) if (conf->recv_buffer_size > 0 && apr_setsocketopt(sock, APR_SO_RCVBUF, conf->recv_buffer_size)) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, && (rv = apr_setsocketopt(sock, APR_SO_RCVBUF, conf->recv_buffer_size))) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); } #endif if (apr_setsocketopt(sock, APR_SO_REUSEADDR, one)) { if (APR_SUCCESS != (rv = apr_setsocketopt(sock, APR_SO_REUSEADDR, one))) { #ifndef _OSD_POSIX /* BS2000 has this option "always on" */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); return HTTP_INTERNAL_SERVER_ERROR; #endif /*_OSD_POSIX*/ Loading Loading @@ -678,11 +678,11 @@ int ap_proxy_ftp_handler(request_rec *r, char *url) while (connect_addr) { /* make the connection out of the socket */ err = apr_connect(sock, connect_addr); rv = apr_connect(sock, connect_addr); /* if an error occurred, loop round and try again */ if (err != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server, if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: FTP: attempt to connect to %pI (%s) failed", connect_addr, connectname); connect_addr = connect_addr->next; continue; Loading Loading @@ -1131,8 +1131,8 @@ int ap_proxy_ftp_handler(request_rec *r, char *url) apr_port_t local_port; unsigned int h0, h1, h2, h3, p0, p1; if ((apr_socket_create(&local_sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, if ((rv = apr_socket_create(&local_sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error creating local socket"); return HTTP_INTERNAL_SERVER_ERROR; } Loading @@ -1140,29 +1140,28 @@ int ap_proxy_ftp_handler(request_rec *r, char *url) apr_sockaddr_port_get(&local_port, local_addr); apr_sockaddr_ip_get(&local_ip, local_addr); if (apr_setsocketopt(local_sock, APR_SO_REUSEADDR, one) != APR_SUCCESS) { if ((rv = apr_setsocketopt(local_sock, APR_SO_REUSEADDR, one)) != APR_SUCCESS) { #ifndef _OSD_POSIX /* BS2000 has this option "always on" */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error setting reuseaddr option"); return HTTP_INTERNAL_SERVER_ERROR; #endif /*_OSD_POSIX*/ } if (apr_sockaddr_info_get(&local_addr, local_ip, APR_UNSPEC, local_port, 0, r->pool) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: FTP: error creating local socket address"); return HTTP_INTERNAL_SERVER_ERROR; } apr_sockaddr_info_get(&local_addr, local_ip, APR_UNSPEC, local_port, 0, r->pool); if (apr_bind(local_sock, local_addr) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: FTP: error binding to ftp data socket %s:%d", local_ip, local_port); if ((rv = apr_bind(local_sock, local_addr)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error binding to ftp data socket %pI", local_addr); return HTTP_INTERNAL_SERVER_ERROR; } /* only need a short queue */ apr_listen(local_sock, 2); if ((rv = apr_listen(local_sock, 2)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error listening to ftp data socket %pI", local_addr); return HTTP_INTERNAL_SERVER_ERROR; } /* FIXME: Sent PORT here */ Loading Loading @@ -1486,14 +1485,14 @@ ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, for(;;) { /* FIXME: this does not return, despite the incoming connection being accepted */ switch(apr_accept(&remote_sock, local_sock, r->pool)) switch(rv = apr_accept(&remote_sock, local_sock, r->pool)) { case APR_EINTR: continue; case APR_SUCCESS: break; default: ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: failed to accept data connection"); return HTTP_BAD_GATEWAY; } Loading modules/proxy/proxy_http.c +9 −9 Original line number Diff line number Diff line Loading @@ -334,16 +334,16 @@ int ap_proxy_http_handler(request_rec *r, char *url, backend->connection = NULL; /* see memory note above */ if ((apr_socket_create(&sock, APR_INET, SOCK_STREAM, c->pool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, c->pool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: error creating socket"); return HTTP_INTERNAL_SERVER_ERROR; } #if !defined(TPF) && !defined(BEOS) if (conf->recv_buffer_size > 0 && apr_setsocketopt(sock, APR_SO_RCVBUF, conf->recv_buffer_size)) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, if (conf->recv_buffer_size > 0 && (rv = apr_setsocketopt(sock, APR_SO_RCVBUF, conf->recv_buffer_size))) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); } #endif Loading @@ -368,11 +368,11 @@ int ap_proxy_http_handler(request_rec *r, char *url, while (connect_addr) { /* make the connection out of the socket */ err = apr_connect(sock, connect_addr); rv = apr_connect(sock, connect_addr); /* if an error occurred, loop round and try again */ if (err != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server, if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: attempt to connect to %pI (%s) failed", connect_addr, connectname); connect_addr = connect_addr->next; Loading Loading @@ -590,7 +590,7 @@ int ap_proxy_http_handler(request_rec *r, char *url, if (APR_SUCCESS != (rv = ap_proxy_string_read(origin, bb, buffer, sizeof(buffer), &eos))) { apr_socket_close(sock); backend->connection = NULL; ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: error reading status line from remote server %s", connectname); return ap_proxyerror(r, HTTP_BAD_GATEWAY, Loading Loading
modules/proxy/proxy_connect.c +11 −13 Original line number Diff line number Diff line Loading @@ -104,13 +104,11 @@ int ap_proxy_connect_handler(request_rec *r, char *url, { apr_pool_t *p = r->pool; apr_socket_t *sock; apr_status_t err, rv; char buffer[HUGE_STRING_LEN]; int i, err; int i; apr_size_t nbytes; #if 0 apr_socket_t *client_sock = NULL; #endif apr_pollfd_t *pollfd; apr_int32_t pollcnt; apr_int16_t pollevent; Loading Loading @@ -193,8 +191,8 @@ int ap_proxy_connect_handler(request_rec *r, char *url, } /* create a new socket */ if ((apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: error creating socket"); return HTTP_INTERNAL_SERVER_ERROR; } Loading @@ -217,11 +215,11 @@ int ap_proxy_connect_handler(request_rec *r, char *url, while (connect_addr) { /* make the connection out of the socket */ err = apr_connect(sock, connect_addr); rv = apr_connect(sock, connect_addr); /* if an error occurred, loop round and try again */ if (err != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server, if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: CONNECT: attempt to connect to %pI (%s) failed", connect_addr, connectname); connect_addr = connect_addr->next; continue; Loading Loading @@ -296,10 +294,10 @@ int ap_proxy_connect_handler(request_rec *r, char *url, /* r->sent_bodyct = 1;*/ if(apr_poll_setup(&pollfd, 2, r->pool) != APR_SUCCESS) if((rv = apr_poll_setup(&pollfd, 2, r->pool)) != APR_SUCCESS) { apr_socket_close(sock); ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll_setup()"); return HTTP_INTERNAL_SERVER_ERROR; } Loading @@ -312,10 +310,10 @@ int ap_proxy_connect_handler(request_rec *r, char *url, while (1) { /* Infinite loop until error (one side closes the connection) */ /* ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, "proxy: CONNECT: going to sleep (poll)");*/ if (apr_poll(pollfd, &pollcnt, -1) != APR_SUCCESS) if ((rv = apr_poll(pollfd, &pollcnt, -1)) != APR_SUCCESS) { apr_socket_close(sock); ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: CONNECT: error apr_poll()"); ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll()"); return HTTP_INTERNAL_SERVER_ERROR; } /* ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, Loading
modules/proxy/proxy_ftp.c +27 −28 Original line number Diff line number Diff line Loading @@ -633,24 +633,24 @@ int ap_proxy_ftp_handler(request_rec *r, char *url) } if ((apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error creating socket"); return HTTP_INTERNAL_SERVER_ERROR; } #if !defined(TPF) && !defined(BEOS) if (conf->recv_buffer_size > 0 && apr_setsocketopt(sock, APR_SO_RCVBUF, conf->recv_buffer_size)) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, && (rv = apr_setsocketopt(sock, APR_SO_RCVBUF, conf->recv_buffer_size))) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); } #endif if (apr_setsocketopt(sock, APR_SO_REUSEADDR, one)) { if (APR_SUCCESS != (rv = apr_setsocketopt(sock, APR_SO_REUSEADDR, one))) { #ifndef _OSD_POSIX /* BS2000 has this option "always on" */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); return HTTP_INTERNAL_SERVER_ERROR; #endif /*_OSD_POSIX*/ Loading Loading @@ -678,11 +678,11 @@ int ap_proxy_ftp_handler(request_rec *r, char *url) while (connect_addr) { /* make the connection out of the socket */ err = apr_connect(sock, connect_addr); rv = apr_connect(sock, connect_addr); /* if an error occurred, loop round and try again */ if (err != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server, if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: FTP: attempt to connect to %pI (%s) failed", connect_addr, connectname); connect_addr = connect_addr->next; continue; Loading Loading @@ -1131,8 +1131,8 @@ int ap_proxy_ftp_handler(request_rec *r, char *url) apr_port_t local_port; unsigned int h0, h1, h2, h3, p0, p1; if ((apr_socket_create(&local_sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, if ((rv = apr_socket_create(&local_sock, APR_INET, SOCK_STREAM, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error creating local socket"); return HTTP_INTERNAL_SERVER_ERROR; } Loading @@ -1140,29 +1140,28 @@ int ap_proxy_ftp_handler(request_rec *r, char *url) apr_sockaddr_port_get(&local_port, local_addr); apr_sockaddr_ip_get(&local_ip, local_addr); if (apr_setsocketopt(local_sock, APR_SO_REUSEADDR, one) != APR_SUCCESS) { if ((rv = apr_setsocketopt(local_sock, APR_SO_REUSEADDR, one)) != APR_SUCCESS) { #ifndef _OSD_POSIX /* BS2000 has this option "always on" */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error setting reuseaddr option"); return HTTP_INTERNAL_SERVER_ERROR; #endif /*_OSD_POSIX*/ } if (apr_sockaddr_info_get(&local_addr, local_ip, APR_UNSPEC, local_port, 0, r->pool) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: FTP: error creating local socket address"); return HTTP_INTERNAL_SERVER_ERROR; } apr_sockaddr_info_get(&local_addr, local_ip, APR_UNSPEC, local_port, 0, r->pool); if (apr_bind(local_sock, local_addr) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: FTP: error binding to ftp data socket %s:%d", local_ip, local_port); if ((rv = apr_bind(local_sock, local_addr)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error binding to ftp data socket %pI", local_addr); return HTTP_INTERNAL_SERVER_ERROR; } /* only need a short queue */ apr_listen(local_sock, 2); if ((rv = apr_listen(local_sock, 2)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: error listening to ftp data socket %pI", local_addr); return HTTP_INTERNAL_SERVER_ERROR; } /* FIXME: Sent PORT here */ Loading Loading @@ -1486,14 +1485,14 @@ ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, for(;;) { /* FIXME: this does not return, despite the incoming connection being accepted */ switch(apr_accept(&remote_sock, local_sock, r->pool)) switch(rv = apr_accept(&remote_sock, local_sock, r->pool)) { case APR_EINTR: continue; case APR_SUCCESS: break; default: ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: FTP: failed to accept data connection"); return HTTP_BAD_GATEWAY; } Loading
modules/proxy/proxy_http.c +9 −9 Original line number Diff line number Diff line Loading @@ -334,16 +334,16 @@ int ap_proxy_http_handler(request_rec *r, char *url, backend->connection = NULL; /* see memory note above */ if ((apr_socket_create(&sock, APR_INET, SOCK_STREAM, c->pool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, if ((rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, c->pool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: error creating socket"); return HTTP_INTERNAL_SERVER_ERROR; } #if !defined(TPF) && !defined(BEOS) if (conf->recv_buffer_size > 0 && apr_setsocketopt(sock, APR_SO_RCVBUF, conf->recv_buffer_size)) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, if (conf->recv_buffer_size > 0 && (rv = apr_setsocketopt(sock, APR_SO_RCVBUF, conf->recv_buffer_size))) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); } #endif Loading @@ -368,11 +368,11 @@ int ap_proxy_http_handler(request_rec *r, char *url, while (connect_addr) { /* make the connection out of the socket */ err = apr_connect(sock, connect_addr); rv = apr_connect(sock, connect_addr); /* if an error occurred, loop round and try again */ if (err != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server, if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: attempt to connect to %pI (%s) failed", connect_addr, connectname); connect_addr = connect_addr->next; Loading Loading @@ -590,7 +590,7 @@ int ap_proxy_http_handler(request_rec *r, char *url, if (APR_SUCCESS != (rv = ap_proxy_string_read(origin, bb, buffer, sizeof(buffer), &eos))) { apr_socket_close(sock); backend->connection = NULL; ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: error reading status line from remote server %s", connectname); return ap_proxyerror(r, HTTP_BAD_GATEWAY, Loading