httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy proxy_connect.c
Date Mon, 16 Aug 2004 16:09:49 GMT
trawick     2004/08/16 09:09:49

  Modified:    modules/proxy proxy_connect.c
  Log:
  fix an infinite loop in proxy CONNECT
  (problem was only in 2.1-dev)
  
  Submitted by:	jean-frederic clere <jfrederic.clere fujitsu-siemens.com>
  Reviewed by:	Jeff Trawick
  
  Revision  Changes    Path
  1.69      +27 -10    httpd-2.0/modules/proxy/proxy_connect.c
  
  Index: proxy_connect.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_connect.c,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- proxy_connect.c	13 Aug 2004 23:16:50 -0000	1.68
  +++ proxy_connect.c	16 Aug 2004 16:09:48 -0000	1.69
  @@ -292,8 +292,10 @@
               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, 0, r->server,
  -                     "proxy: CONNECT: woke from select(), i=%d", pollcnt);*/
  +#ifdef DEBUGGING
  +        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +                     "proxy: CONNECT: woke from select(), i=%d", pollcnt);
  +#endif
   
           for (i = 0; i < pollcnt; i++) {
               const apr_pollfd_t *cur = &signalled[i];
  @@ -301,10 +303,13 @@
               if (cur->desc.s == sock) {
                   pollevent = cur->rtnevents;
                   if (pollevent & APR_POLLIN) {
  -/*		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  -                             "proxy: CONNECT: sock was set");*/
  +#ifdef DEBUGGING
  +                    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +                                 "proxy: CONNECT: sock was set");
  +#endif
                       nbytes = sizeof(buffer);
  -                    if (apr_socket_recv(sock, buffer, &nbytes) == APR_SUCCESS) {
  +                    rv = apr_socket_recv(sock, buffer, &nbytes);
  +                    if (rv == APR_SUCCESS) {
                           o = 0;
                           i = nbytes;
                           while(i > 0)
  @@ -316,7 +321,8 @@
        * if ((nbytes = ap_rwrite(buffer + o, nbytes, r)) < 0)
        * rbb
        */
  -                            if (apr_socket_send(client_socket, buffer + o, &nbytes)
!= APR_SUCCESS)
  +                            rv = apr_socket_send(client_socket, buffer + o, &nbytes);
  +                            if (rv != APR_SUCCESS)
                                   break;
                               o += nbytes;
                               i -= nbytes;
  @@ -331,16 +337,24 @@
               else if (cur->desc.s == client_socket) {
                   pollevent = cur->rtnevents;
                   if (pollevent & APR_POLLIN) {
  -/*		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  -                             "proxy: CONNECT: client was set");*/
  +#ifdef DEBUGGING
  +                    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +                                 "proxy: CONNECT: client was set");
  +#endif
                       nbytes = sizeof(buffer);
  -                    if (apr_socket_recv(client_socket, buffer, &nbytes) == APR_SUCCESS)
{
  +                    rv = apr_socket_recv(client_socket, buffer, &nbytes);
  +                    if (rv == APR_SUCCESS) {
                           o = 0;
                           i = nbytes;
  +#ifdef DEBUGGING
  +                        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  +                                     "proxy: CONNECT: read %d from client", i);
  +#endif
                           while(i > 0)
                           {
                               nbytes = i;
  -                            if (apr_socket_send(sock, buffer + o, &nbytes) != APR_SUCCESS)
  +                            rv = apr_socket_send(sock, buffer + o, &nbytes);
  +                            if (rv != APR_SUCCESS)
                                   break;
                               o += nbytes;
                               i -= nbytes;
  @@ -354,6 +368,9 @@
               }
               else
                   break;
  +        }
  +        if (rv != APR_SUCCESS) {
  +            break;
           }
       }
   
  
  
  

Mime
View raw message