Return-Path: Delivered-To: apmail-apache-cvs-archive@apache.org Received: (qmail 34699 invoked by uid 500); 5 Apr 2001 18:53:05 -0000 Mailing-List: contact apache-cvs-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-cvs@apache.org Received: (qmail 34688 invoked by uid 500); 5 Apr 2001 18:53:05 -0000 Delivered-To: apmail-httpd-proxy-cvs@apache.org Date: 5 Apr 2001 18:53:04 -0000 Message-ID: <20010405185304.34684.qmail@apache.org> From: minfrin@apache.org To: httpd-proxy-cvs@apache.org Subject: cvs commit: httpd-proxy/module-2.0 mod_proxy.c mod_proxy.h proxy_http.c proxy_util.c minfrin 01/04/05 11:53:04 Modified: . CHANGES module-2.0 mod_proxy.c mod_proxy.h proxy_http.c proxy_util.c Log: Cleanup of dead functions within proxy_util.c. Revision Changes Path 1.15 +3 -0 httpd-proxy/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/httpd-proxy/CHANGES,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- CHANGES 2001/04/05 18:25:03 1.14 +++ CHANGES 2001/04/05 18:53:04 1.15 @@ -1,6 +1,9 @@ mod_proxy changes for 2.0.15 current + *) Cleanup of dead functions within proxy_util.c. + [Graham Leggett ] + *) Reworked the storage of the client socket between keepalive connections to fix some nasty problems with the socket lasting longer than the memory pool it was allocated from. 1.33 +1 -1 httpd-proxy/module-2.0/mod_proxy.c Index: mod_proxy.c =================================================================== RCS file: /home/cvs/httpd-proxy/module-2.0/mod_proxy.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- mod_proxy.c 2001/04/05 18:25:04 1.32 +++ mod_proxy.c 2001/04/05 18:53:04 1.33 @@ -412,7 +412,7 @@ return ap_proxy_http_handler(r, url, NULL, 0); #if FTP if (strcasecmp(scheme, "ftp") == 0) - return ap_proxy_ftp_handler(r, NULL, url); + return ap_proxy_ftp_handler(r, url); #endif else { ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, 1.33 +1 -6 httpd-proxy/module-2.0/mod_proxy.h Index: mod_proxy.h =================================================================== RCS file: /home/cvs/httpd-proxy/module-2.0/mod_proxy.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- mod_proxy.h 2001/04/05 18:25:04 1.32 +++ mod_proxy.h 2001/04/05 18:53:04 1.33 @@ -156,7 +156,6 @@ struct dirconn_entry { char *name; -// struct apr_sockaddr_t *addr; struct in_addr addr, mask; struct hostent *hostentry; int (*matcher) (struct dirconn_entry * This, request_rec *r); @@ -236,10 +235,8 @@ char **passwordp, char **hostp, int *port); const char *ap_proxy_date_canon(apr_pool_t *p, const char *x); apr_table_t *ap_proxy_read_headers(request_rec *r, request_rec *rp, char *buffer, int size, conn_rec *c); -void ap_proxy_send_headers(request_rec *r, const char *respline, apr_table_t *hdrs); int ap_proxy_liststr(const char *list, const char *val); char *ap_proxy_removestr(apr_pool_t *pool, const char *list, const char *val); -void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength); int ap_proxy_hex2sec(const char *x); void ap_proxy_sec2hex(int t, char *y); const char *ap_proxy_host2addr(const char *host, struct hostent *reqhp); @@ -249,8 +246,6 @@ int ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p); int ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p); int ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf, apr_sockaddr_t *uri_addr); -apr_status_t ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r); -/* This function is called by ap_table_do() for all header lines */ -int ap_proxy_send_hdr_line(void *p, const char *key, const char *value); +int ap_proxy_pre_http_connection(conn_rec *c); #endif /*MOD_PROXY_H*/ 1.41 +2 -6 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.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- proxy_http.c 2001/04/05 18:25:04 1.40 +++ proxy_http.c 2001/04/05 18:53:04 1.41 @@ -217,7 +217,7 @@ } ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "proxy: connecting %s to %s:%d", url, uri.hostname, uri.port); + "proxy: HTTP 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); @@ -398,11 +398,8 @@ */ /* set up the connection filters */ - ap_add_input_filter("HTTP_IN", NULL, NULL, origin); - ap_add_input_filter("CORE_IN", NULL, NULL, origin); - ap_add_output_filter("CORE", NULL, NULL, origin); + ap_proxy_pre_http_connection(origin); - /* strip connection listed hop-by-hop headers from the request */ /* even though in theory a connection: close coming from the client * should not affect the connection to the server, it's unlikely @@ -558,7 +555,6 @@ * Get response from the remote server, and pass it up the * filter chain */ - rp = make_fake_req(origin, r); 1.47 +7 -54 httpd-proxy/module-2.0/proxy_util.c Index: proxy_util.c =================================================================== RCS file: /home/cvs/httpd-proxy/module-2.0/proxy_util.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- proxy_util.c 2001/04/04 18:47:42 1.46 +++ proxy_util.c 2001/04/05 18:53:04 1.47 @@ -74,6 +74,7 @@ static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r); static int proxy_match_word(struct dirconn_entry *This, request_rec *r); static struct per_thread_data *get_per_thread_data(void); + /* already called in the knowledge that the characters are hex digits */ int ap_proxy_hex2c(const char *x) { @@ -465,36 +466,7 @@ return headers_out; } -/* - * Sends response line and headers. Uses the client fd and the - * headers_out array from the passed request_rec to talk to the client - * and to properly set the headers it sends for things such as logging. - * - * A timeout should be set before calling this routine. - */ -void ap_proxy_send_headers(request_rec *r, const char *respline, apr_table_t *t) -{ - int i; - apr_socket_t *fp = r->connection->client_socket; - apr_table_entry_t *elts = (apr_table_entry_t *) apr_table_elts(t)->elts; - - char *temp = apr_pstrcat(r->pool, respline, CRLF, NULL); - apr_size_t len = strlen(temp); - apr_send(fp, temp, &len); - - for (i = 0; i < apr_table_elts(t)->nelts; ++i) { - if (elts[i].key != NULL) { - temp = apr_pstrcat(r->pool, elts[i].key, ": ", elts[i].val, CRLF, NULL); - apr_send(fp, temp, &len); - apr_table_addn(r->headers_out, elts[i].key, elts[i].val); - } - } - - len = 2; - apr_send(fp, CRLF, &len); -} - /* * list is a comma-separated list of case-insensitive tokens, with * optional whitespace around the tokens. @@ -1109,34 +1081,15 @@ return OK; } -apr_status_t ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r) +/* set up the minimal filter set */ +int ap_proxy_pre_http_connection(conn_rec *c) { - apr_status_t rv; - apr_sockaddr_t *destsa; - - rv = apr_sockaddr_info_get(&destsa, host, AF_INET, port, 0, r->pool); - if (rv == APR_SUCCESS) { - rv = apr_connect(sock, destsa); - } - else if (rv != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy connect to %s port %d failed", host, port); - } - return rv; + ap_add_input_filter("HTTP_IN", NULL, NULL, c); + ap_add_input_filter("CORE_IN", NULL, NULL, c); + ap_add_output_filter("CORE", NULL, NULL, c); + return OK; } -/* This function is called by apr_table_do() for all header lines */ -/* (from proxy_http.c and proxy_ftp.c) */ -/* It is passed a table_do_args struct pointer and a MIME field and value pair */ -int ap_proxy_send_hdr_line(void *p, const char *key, const char *value) -{ - struct request_rec *r = (struct request_rec *)p; - if (key == NULL || value == NULL || value[0] == '\0') - return 1; - if (!r->assbackwards) - ap_rvputs(r, key, ": ", value, CRLF, NULL); - return 1; /* tell apr_table_do() to continue calling us for more headers */ -} #if defined WIN32