httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject cvs commit: httpd-proxy/module-2.0 proxy_connect.c proxy_ftp.c proxy_http.c
Date Fri, 13 Apr 2001 15:30:33 GMT
minfrin     01/04/13 08:30:33

  Modified:    module-2.0 proxy_connect.c proxy_ftp.c proxy_http.c
  Log:
  Fixed all the APR error codes to make sure they end up in the logfiles
  
  Revision  Changes    Path
  1.37      +11 -13    httpd-proxy/module-2.0/proxy_connect.c
  
  Index: proxy_connect.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_connect.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- proxy_connect.c	2001/04/13 09:34:47	1.36
  +++ proxy_connect.c	2001/04/13 15:30:32	1.37
  @@ -104,13 +104,11 @@
   {
       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;
  @@ -193,8 +191,8 @@
       }
   
       /* 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;
       }
  @@ -217,11 +215,11 @@
   	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;
  @@ -296,10 +294,10 @@
   
   /*    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;
       }
  @@ -312,10 +310,10 @@
   
       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,
  
  
  
  1.44      +28 -29    httpd-proxy/module-2.0/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_ftp.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- proxy_ftp.c	2001/04/13 02:30:23	1.43
  +++ proxy_ftp.c	2001/04/13 15:30:32	1.44
  @@ -633,24 +633,24 @@
       }
   
   
  -    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*/
  @@ -678,11 +678,11 @@
   	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;
  @@ -1131,8 +1131,8 @@
   	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;
   	}
  @@ -1140,29 +1140,28 @@
           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;
  -        }
  -
  -	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);
  +        apr_sockaddr_info_get(&local_addr, local_ip, APR_UNSPEC, local_port, 0, r->pool);
  +
  +	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 */
   
  @@ -1473,8 +1472,8 @@
   		 "proxy: FTP: Content-Length set to %s", size);
   	}
       }
  -ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
  -			 "proxy: FTP: Content-Type set to %s", r->content_type);
  +    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
  +		 "proxy: FTP: Content-Type set to %s", r->content_type);
       if (r->content_encoding != NULL && r->content_encoding[0] != '\0') {
   		ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
   			     "proxy: FTP: Content-Encoding set to %s", r->content_encoding);
  @@ -1486,14 +1485,14 @@
           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;
               }
  
  
  
  1.58      +9 -9      httpd-proxy/module-2.0/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_http.c,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- proxy_http.c	2001/04/12 01:57:48	1.57
  +++ proxy_http.c	2001/04/13 15:30:32	1.58
  @@ -334,16 +334,16 @@
   	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
  @@ -368,11 +368,11 @@
   	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;
  @@ -590,7 +590,7 @@
       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,
  
  
  

Mime
View raw message