From: Chuck Murcko Date: Fri, 13 Apr 2001 17:46:54 +0000 (+0000) Subject: Not sure what I was thinking, but this clarifies the logic for nbytes > X-Git-Tag: 2.0.17~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=631725022928c463d8cd50d2d69dbe1d774c16b1;p=apache Not sure what I was thinking, but this clarifies the logic for nbytes > sizeof(buffer) towards the end of proxy_connect.c git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88849 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_connect.c b/modules/proxy/proxy_connect.c index 8db5f3ae53..d79b09728d 100644 --- a/modules/proxy/proxy_connect.c +++ b/modules/proxy/proxy_connect.c @@ -106,7 +106,7 @@ int ap_proxy_connect_handler(request_rec *r, char *url, apr_socket_t *sock; apr_status_t err, rv; char buffer[HUGE_STRING_LEN]; - int i; + int i, o; apr_size_t nbytes; apr_pollfd_t *pollfd; @@ -326,14 +326,15 @@ int ap_proxy_connect_handler(request_rec *r, char *url, "proxy: CONNECT: sock was set");*/ nbytes = sizeof(buffer); if (apr_recv(sock, buffer, &nbytes) == APR_SUCCESS) { - int o = 0; - while(nbytes) + o = 0; + i = nbytes; + while(i > 0) { + nbytes = i; if (apr_send(r->connection->client_socket, buffer + o, &nbytes) != APR_SUCCESS) break; - i = nbytes; - o += i; - nbytes -= i; + o += nbytes; + i -= nbytes; } } else @@ -349,14 +350,15 @@ int ap_proxy_connect_handler(request_rec *r, char *url, "proxy: CONNECT: client was set");*/ nbytes = sizeof(buffer); if (apr_recv(r->connection->client_socket, buffer, &nbytes) == APR_SUCCESS) { - int o = 0; - while(nbytes) + o = 0; + i = nbytes; + while(i > 0) { + nbytes = i; if (apr_send(sock, buffer + o, &nbytes) != APR_SUCCESS) break; - i = nbytes; - o += i; - nbytes -= i; + o += nbytes; + i -= nbytes; } } else