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
Date Sat, 07 Apr 2001 21:09:37 GMT
minfrin     01/04/07 14:09:37

  Modified:    module-2.0 proxy_connect.c
  Log:
  *) Made log entries consistent with proxy: CONNECT:
  *) checked that sockets were being closed on error
  
  Revision  Changes    Path
  1.27      +22 -19    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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- proxy_connect.c	2001/04/07 20:57:05	1.26
  +++ proxy_connect.c	2001/04/07 21:09:37	1.27
  @@ -139,7 +139,7 @@
       }
   
       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
  -		 "proxy: CONNECT connecting %s to %s:%d", url, uri.hostname, uri.port);
  +		 "proxy: CONNECT: connecting %s to %s:%d", url, uri.hostname, uri.port);
   
       /* do a DNS lookup for the destination host */
       err = apr_sockaddr_info_get(&uri_addr, uri.hostname, APR_UNSPEC, uri.port, 0, p);
  @@ -148,17 +148,15 @@
       if (proxyname) {
   	connectname = proxyname;
   	connectport = proxyport;
  -        ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  -            "CONNECT to remote proxy %s on port %d", proxyname, proxyport);
           err = apr_sockaddr_info_get(&connect_addr, proxyname, APR_UNSPEC, proxyport,
0, p);
       }
       else {
   	connectname = uri.hostname;
   	connectport = uri.port;
   	connect_addr = uri_addr;
  -        ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  -            "CONNECT to %s on port %d", connectname, connectport);
       }
  +    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  +		 "proxy: CONNECT: connecting to remote proxy %s on port %d", connectname, connectport);
   
       /* check if ProxyBlock directive on this host */
       if (OK != ap_proxy_checkproxyblock(r, conf, uri_addr)) {
  @@ -225,7 +223,7 @@
   	    /* if an error occurred, loop round and try again */
               if (err != APR_SUCCESS) {
   		ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server,
  -			     "proxy: attempt to connect to %pI (%s) failed", connect_addr, connectname);
  +			     "proxy: CONNECT: attempt to connect to %pI (%s) failed", connect_addr, connectname);
   		connect_addr = connect_addr->next;
   		continue;
               }
  @@ -237,6 +235,7 @@
   
   	/* handle a permanent error from the above loop */
   	if (failed) {
  +	    apr_socket_close(sock);
   	    if (proxyname) {
   		return DECLINED;
   	    }
  @@ -261,17 +260,17 @@
   	 * a HTTP/1.0 request to keep things simple.
   	 */
           ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  -             "Sending the CONNECT request to the remote proxy");
  +		     "proxy: CONNECT: sending the CONNECT request to the remote proxy");
           nbytes = apr_snprintf(buffer, sizeof(buffer),
  -             "CONNECT %s HTTP/1.1" CRLF, r->uri);
  +			      "CONNECT %s HTTP/1.1" CRLF, r->uri);
           apr_send(sock, buffer, &nbytes);
           nbytes = apr_snprintf(buffer, sizeof(buffer),
  -             "Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
  +			      "Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
           apr_send(sock, buffer, &nbytes);
       }
       else {
           ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  -            "Returning 200 OK Status");
  +		     "proxy: CONNECT: Returning 200 OK Status");
           ap_rvputs(r, "HTTP/1.0 200 Connection established" CRLF, NULL);
           ap_rvputs(r, "Proxy-agent: ", ap_get_server_version(), CRLF CRLF, NULL);
           ap_rflush(r);
  @@ -286,8 +285,9 @@
   
       if(apr_poll_setup(&pollfd, 2, r->pool) != APR_SUCCESS)
       {
  +	apr_socket_close(sock);
           ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -            "proxy: error apr_poll_setup()");
  +            "proxy: CONNECT: error apr_poll_setup()");
           return HTTP_INTERNAL_SERVER_ERROR;
       }
   
  @@ -302,8 +302,9 @@
           (apr_os_sock_t *)get_socket(r->connection->client),
                         r->pool) != APR_SUCCESS)
       {
  +	apr_socket_close(sock);
           ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  -            "proxy: error creating client apr_socket_t");
  +            "proxy: CONNECT: error creating client apr_socket_t");
           return HTTP_INTERNAL_SERVER_ERROR;
       }
       apr_poll_socket_add(pollfd, client_sock, APR_POLLIN);
  @@ -313,20 +314,21 @@
       apr_poll_socket_add(pollfd, sock, APR_POLLIN);
   
       while (1) { /* Infinite loop until error (one side closes the connection) */
  -        ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, "Going to sleep (poll)");
  +        ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, "proxy: CONNECT: going
to sleep (poll)");
           if(apr_poll(pollfd, &pollcnt, -1) != APR_SUCCESS)
           {
  -            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: error apr_poll()");
  +	    apr_socket_close(sock);
  +            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: CONNECT: error apr_poll()");
               return HTTP_INTERNAL_SERVER_ERROR;
           }
           ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  -                     "Woke from select(), i=%d", pollcnt);
  +                     "proxy: CONNECT: woke from select(), i=%d", pollcnt);
   
           if (pollcnt) {
               apr_poll_revents_get(&pollevent, sock, pollfd);
               if (pollevent & APR_POLLIN) {
                   ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  -                             "sock was set");
  +                             "proxy: CONNECT: sock was set");
                   nbytes = HUGE_STRING_LEN;
                   if(apr_recv(sock, buffer, &nbytes) == APR_SUCCESS) {
                       int o = 0;
  @@ -337,7 +339,8 @@
                           o += i;
                           nbytes -= i;
                       }
  -                    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,      
                          "Wrote %d bytes to client", nbytes);
  +                    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  +				 "proxy: CONNECT: wrote %d bytes to client", nbytes);
                   }
                   else
                       break;
  @@ -346,7 +349,7 @@
               apr_poll_revents_get(&pollevent, client_sock, pollfd);
               if (pollevent & APR_POLLIN) {
                   ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
  -                             "client was set");
  +                             "proxy: CONNECT: client was set");
                   nbytes = HUGE_STRING_LEN;
                   if(apr_recv(r->connection->client_socket, buffer, &nbytes) ==
APR_SUCCESS) {
                       int o = 0;
  @@ -358,7 +361,7 @@
                           nbytes -= i;
                       }
                       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0,
  -                        NULL, "Wrote %d bytes to server", nbytes);
  +                        NULL, "proxy: CONNECT: wrote %d bytes to server", nbytes);
                   }
                   else
                       break;
  
  
  

Mime
View raw message