Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 19323 invoked by uid 500); 11 Jan 2002 14:45:36 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 19312 invoked by uid 500); 11 Jan 2002 14:45:35 -0000 Delivered-To: apmail-httpd-proxy-cvs@apache.org Date: 11 Jan 2002 14:45:35 -0000 Message-ID: <20020111144535.54691.qmail@icarus.apache.org> From: chuck@apache.org To: httpd-proxy-cvs@apache.org Subject: cvs commit: httpd-proxy/module-1.0 mod_proxy.c mod_proxy.h proxy_connect.c proxy_ftp.c proxy_http.c proxy_util.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N chuck 02/01/11 06:45:35 Modified: module-1.0 mod_proxy.c mod_proxy.h proxy_connect.c proxy_ftp.c proxy_http.c proxy_util.c Log: Aw heck let's get rid of all the tabs clean up some butt ugly formatting too might as well have another reason to put this in 1.3.23 Revision Changes Path 1.3 +193 -193 httpd-proxy/module-1.0/mod_proxy.c Index: mod_proxy.c =================================================================== RCS file: /home/cvs/httpd-proxy/module-1.0/mod_proxy.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -b -u -r1.2 -r1.3 1.5 +77 -66 httpd-proxy/module-1.0/mod_proxy.h Index: mod_proxy.h =================================================================== RCS file: /home/cvs/httpd-proxy/module-1.0/mod_proxy.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -b -u -r1.4 -r1.5 --- mod_proxy.h 5 Oct 2001 08:47:59 -0000 1.4 +++ mod_proxy.h 11 Jan 2002 14:45:35 -0000 1.5 @@ -212,15 +212,22 @@ typedef struct { request_rec *req; /* the request */ char *url; /* the URL requested */ - char *filename; /* name of the cache file, or NULL if no cache */ - char *tempfile; /* name of the temporary file, of NULL if not caching */ - time_t ims; /* if-Modified-Since date of request; -1 if no header */ - time_t ius; /* if-Unmodified-Since date of request; -1 if no header */ - const char *im; /* if-Match etag of request; NULL if no header */ - const char *inm; /* if-None-Match etag of request; NULL if no header */ - BUFF *fp; /* the cache file descriptor if the file is cached - and may be returned, or NULL if the file is - not cached (or must be reloaded) */ + char *filename; /* name of the cache file, + or NULL if no cache */ + char *tempfile; /* name of the temporary file, + or NULL if not caching */ + time_t ims; /* if-Modified-Since date of request, + -1 if no header */ + time_t ius; /* if-Unmodified-Since date of request, + -1 if no header */ + const char *im; /* if-Match etag of request, + NULL if no header */ + const char *inm; /* if-None-Match etag of request, + NULL if no header */ + BUFF *fp; /* the cache file descriptor if the file + is cached and may be returned, + or NULL if the file is not cached + (or must be reloaded) */ BUFF *origfp; /* the old cache file descriptor if the file has been revalidated and is being rewritten to disk */ @@ -231,14 +238,18 @@ time_t resp_time; /* the time the response was received */ int version; /* update count of the file */ off_t len; /* content length */ - char *protocol; /* Protocol, and major/minor number, e.g. HTTP/1.1 */ + char *protocol; /* Protocol, and major/minor number, + e.g. HTTP/1.1 */ int status; /* the status of the cached file */ unsigned int written; /* total *content* bytes written to cache */ float cache_completion; /* specific to this request */ - char *resp_line; /* the whole status line (protocol, code + message) */ - table *req_hdrs; /* the original request headers when it was made */ - table *hdrs; /* the original HTTP response headers of the file */ - char *xcache; /* the X-Cache header value to be sent to client */ + char *resp_line; /* the whole status line + (protocol, code + message) */ + table *req_hdrs; /* the original request headers */ + table *hdrs; /* the original HTTP response headers + of the file */ + char *xcache; /* the X-Cache header value + to be sent to client */ } cache_req; struct per_thread_data { 1.3 +113 -105 httpd-proxy/module-1.0/proxy_connect.c Index: proxy_connect.c =================================================================== RCS file: /home/cvs/httpd-proxy/module-1.0/proxy_connect.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -b -u -r1.2 -r1.3 --- proxy_connect.c 5 Oct 2001 08:47:59 -0000 1.2 +++ proxy_connect.c 11 Jan 2002 14:45:35 -0000 1.3 @@ -126,7 +126,7 @@ void *sconf = r->server->module_config; proxy_server_conf *conf = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts; + struct noproxy_entry *npent = (struct noproxy_entry *)conf->noproxies->elts; memset(&server, '\0', sizeof(server)); server.sin_family = AF_INET; @@ -146,7 +146,8 @@ destaddr.s_addr = ap_inet_addr(host); for (i = 0; i < conf->noproxies->nelts; i++) { if ((npent[i].name != NULL && strstr(host, npent[i].name) != NULL) - || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*') + || destaddr.s_addr == npent[i].addr.s_addr + || npent[i].name[0] == '*') return ap_proxyerror(r, HTTP_FORBIDDEN, "Connect to remote machine blocked"); } @@ -165,10 +166,12 @@ return HTTP_FORBIDDEN; if (proxyhost) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "CONNECT to remote proxy %s on port %d", proxyhost, proxyport); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, + "CONNECT to remote proxy %s on port %d", proxyhost, proxyport); } else { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "CONNECT to %s on port %d", host, port); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, + "CONNECT to %s on port %d", host, port); } server.sin_port = (proxyport ? htons(proxyport) : htons(port)); @@ -176,13 +179,11 @@ if (err != NULL) return ap_proxyerror(r, - proxyhost ? HTTP_BAD_GATEWAY : HTTP_INTERNAL_SERVER_ERROR, - err); + proxyhost ? HTTP_BAD_GATEWAY : HTTP_INTERNAL_SERVER_ERROR, err); sock = ap_psocket(r->pool, PF_INET, SOCK_STREAM, IPPROTO_TCP); if (sock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating socket"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error creating socket"); return HTTP_INTERNAL_SERVER_ERROR; } @@ -210,8 +211,7 @@ if (i == -1) { ap_pclosesocket(r->pool, sock); return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, ap_pstrcat(r->pool, - "Could not connect to remote machine:
", - strerror(errno), NULL)); + "Could not connect to remote machine:
", strerror(errno), NULL)); } /* If we are connecting through a remote proxy, we need to pass @@ -222,16 +222,17 @@ * have no alternative. Error checking ignored. Also, we force * a HTTP/1.0 request to keep things simple. */ - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "Sending the CONNECT request to the remote proxy"); - ap_snprintf(buffer, sizeof(buffer), "CONNECT %s HTTP/1.0" CRLF, - r->uri); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, + "Sending the CONNECT request to the remote proxy"); + ap_snprintf(buffer, sizeof(buffer), "CONNECT %s HTTP/1.0" CRLF, r->uri); send(sock, buffer, strlen(buffer),0); ap_snprintf(buffer, sizeof(buffer), "Proxy-agent: %s" CRLF CRLF, ap_get_server_version()); send(sock, buffer, strlen(buffer),0); } else { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "Returning 200 OK Status"); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, + "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_bflush(r->connection->client); @@ -242,34 +243,41 @@ FD_SET(sock, &fds); FD_SET(ap_bfileno(r->connection->client, B_WR), &fds); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "Going to sleep (select)"); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, + "Going to sleep (select)"); i = ap_select((ap_bfileno(r->connection->client, B_WR) > sock ? ap_bfileno(r->connection->client, B_WR) + 1 : sock + 1), &fds, NULL, NULL, NULL); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "Woke from select(), i=%d", i); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, + "Woke from select(), i=%d", i); if (i) { if (FD_ISSET(sock, &fds)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "sock was set"); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, + "sock was set"); if ((nbytes = recv(sock, buffer, HUGE_STRING_LEN,0)) != 0) { if (nbytes == -1) break; - if (send(ap_bfileno(r->connection->client, B_WR), buffer, nbytes,0) == EOF) + if (send(ap_bfileno(r->connection->client, B_WR), buffer, + nbytes,0) == EOF) break; - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "Wrote %d bytes to client", nbytes); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, + r->server, "Wrote %d bytes to client", nbytes); } else break; } else if (FD_ISSET(ap_bfileno(r->connection->client, B_WR), &fds)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "client->fd was set"); - if ((nbytes = recv(ap_bfileno(r->connection->client, B_WR), buffer, - HUGE_STRING_LEN, 0)) != 0) { + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, + "client->fd was set"); + if ((nbytes = recv(ap_bfileno(r->connection->client, B_WR), + buffer, HUGE_STRING_LEN, 0)) != 0) { if (nbytes == -1) break; if (send(sock, buffer, nbytes, 0) == EOF) break; - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "Wrote %d bytes to server", nbytes); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, + r->server, "Wrote %d bytes to server", nbytes); } else break; 1.5 +635 -635 httpd-proxy/module-1.0/proxy_ftp.c Index: proxy_ftp.c =================================================================== RCS file: /home/cvs/httpd-proxy/module-1.0/proxy_ftp.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -b -u -r1.4 -r1.5 1.5 +193 -193 httpd-proxy/module-1.0/proxy_http.c Index: proxy_http.c =================================================================== RCS file: /home/cvs/httpd-proxy/module-1.0/proxy_http.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -b -u -r1.4 -r1.5 1.8 +457 -457 httpd-proxy/module-1.0/proxy_util.c Index: proxy_util.c =================================================================== RCS file: /home/cvs/httpd-proxy/module-1.0/proxy_util.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -b -u -r1.7 -r1.8