]> granicus.if.org Git - apache/commitdiff
Remove all compiler warnings from the proxy code. There are no garauntees
authorRyan Bloom <rbb@apache.org>
Sun, 8 Oct 2000 03:23:05 +0000 (03:23 +0000)
committerRyan Bloom <rbb@apache.org>
Sun, 8 Oct 2000 03:23:05 +0000 (03:23 +0000)
that this still works, but most of the changes were just const-safeness
changes.
PR: 6631

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86440 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h
modules/proxy/proxy_connect.c
modules/proxy/proxy_ftp.c
modules/proxy/proxy_http.c
modules/proxy/proxy_util.c

index 828b1c944e903a47cae314953090907002b23adc..5c3a3d7ef2d7e4257b29cfe4ceaa55164d79e6f5 100644 (file)
@@ -64,6 +64,7 @@
 #include "http_vhost.h"
 #include "http_request.h"
 #include "util_date.h"
+#include "apr_strings.h"
 
 /* Some WWW schemes and their default ports; this is basically /etc/services */
 /* This will become global when the protocol abstraction comes */
@@ -282,6 +283,7 @@ static int proxy_needsdomain(request_rec *r, const char *url, const char *domain
 static int proxy_handler(request_rec *r)
 {
     char *url, *scheme, *p;
+    const char *p2;
     void *sconf = r->server->module_config;
     proxy_server_conf *conf = (proxy_server_conf *)
         ap_get_module_config(sconf, &proxy_module);
@@ -404,10 +406,10 @@ static int proxy_handler(request_rec *r)
 
     if (!direct_connect)
         for (i = 0; i < proxies->nelts; i++) {
-            p = strchr(ents[i].scheme, ':');    /* is it a partial URL? */
+            p2 = ap_strchr_c(ents[i].scheme, ':');  /* is it a partial URL? */
             if (strcmp(ents[i].scheme, "*") == 0 ||
-                (p == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||
-                (p != NULL &&
+                (p2 == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||
+                (p2 != NULL &&
                  strncasecmp(url, ents[i].scheme, strlen(ents[i].scheme)) == 0)) {
                 /* CONNECT is a special method that bypasses the normal
                  * proxy code.
@@ -468,15 +470,18 @@ static void *create_proxy_config(apr_pool_t *p, server_rec *s)
 }
 
 static const char *
-     add_proxy(cmd_parms *cmd, void *dummy, char *f, char *r)
+     add_proxy(cmd_parms *cmd, void *dummy, const char *f1, const char *r1)
 {
     server_rec *s = cmd->server;
     proxy_server_conf *conf =
     (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module);
     struct proxy_remote *new;
     char *p, *q;
+    char *r, *f;
     int port;
 
+    r = apr_pstrdup(cmd->pool, r1);
+    f = apr_pstrdup(cmd->pool, f1);
     p = strchr(r, ':');
     if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0')
     return "ProxyRemote: Bad syntax for a remote proxy server";
@@ -510,7 +515,7 @@ static const char *
 }
 
 static const char *
-     set_cache_exclude(cmd_parms *cmd, void *dummy, char *arg)
+     set_cache_exclude(cmd_parms *cmd, void *dummy, const char *arg)
 {
     server_rec *s = cmd->server;
     proxy_server_conf *psf = (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module);
@@ -530,8 +535,9 @@ static const char *
         new = apr_push_array(psf->nocaches);
         new->name = arg;
         /* Don't do name lookups on things that aren't dotted */
-        if (strchr(arg, '.') != NULL && ap_proxy_host2addr(new->name, &hp) == NULL)
-            /*@@@FIXME: This copies only the first of (possibly many) IP addrs */
+        if (ap_strchr_c(arg, '.') != NULL && 
+            ap_proxy_host2addr(new->name, &hp) == NULL)
+           /*@@@FIXME: This copies only the first of (possibly many) IP addrs */
             memcpy(&new->addr, hp.h_addr, sizeof(struct in_addr));
         else
             new->addr.s_addr = 0;
@@ -540,7 +546,7 @@ static const char *
 }
 
 static const char *
-     add_pass(cmd_parms *cmd, void *dummy, char *f, char *r)
+     add_pass(cmd_parms *cmd, void *dummy, const char *f, const char *r)
 {
     server_rec *s = cmd->server;
     proxy_server_conf *conf =
@@ -554,7 +560,7 @@ static const char *
 }
 
 static const char *
-    add_pass_reverse(cmd_parms *cmd, void *dummy, char *f, char *r)
+    add_pass_reverse(cmd_parms *cmd, void *dummy, const char *f, const char *r)
 {
     server_rec *s = cmd->server;
     proxy_server_conf *conf;
@@ -568,7 +574,7 @@ static const char *
     return NULL;
 }
 
-static const char *set_proxy_exclude(cmd_parms *parms, void *dummy, char *arg)
+static const char *set_proxy_exclude(cmd_parms *parms, void *dummy, const char *arg)
 {
     server_rec *s = parms->server;
     proxy_server_conf *conf =
@@ -589,7 +595,7 @@ static const char *set_proxy_exclude(cmd_parms *parms, void *dummy, char *arg)
     new = apr_push_array(conf->noproxies);
     new->name = arg;
     /* Don't do name lookups on things that aren't dotted */
-    if (strchr(arg, '.') != NULL && ap_proxy_host2addr(new->name, &hp) == NULL)
+    if (ap_strchr_c(arg, '.') != NULL && ap_proxy_host2addr(new->name, &hp) == NULL)
         /*@@@FIXME: This copies only the first of (possibly many) IP addrs */
         memcpy(&new->addr, hp.h_addr, sizeof(struct in_addr));
     else
@@ -602,7 +608,7 @@ static const char *set_proxy_exclude(cmd_parms *parms, void *dummy, char *arg)
  * Set the ports CONNECT can use
  */
 static const char *
-    set_allowed_ports(cmd_parms *parms, void *dummy, char *arg)
+    set_allowed_ports(cmd_parms *parms, void *dummy, const char *arg)
 {
     server_rec *s = parms->server;
     proxy_server_conf *conf =
@@ -621,7 +627,7 @@ static const char *
  * which should never be accessed via the configured ProxyRemote servers
  */
 static const char *
-     set_proxy_dirconn(cmd_parms *parms, void *dummy, char *arg)
+     set_proxy_dirconn(cmd_parms *parms, void *dummy, const char *arg)
 {
     server_rec *s = parms->server;
     proxy_server_conf *conf =
@@ -639,7 +645,7 @@ static const char *
 
     if (!found) {
     New = apr_push_array(conf->dirconn);
-    New->name = arg;
+    New->name = apr_pstrdup(parms->pool, arg);
     New->hostentry = NULL;
 
     if (ap_proxy_is_ipaddr(New, parms->pool)) {
@@ -676,7 +682,7 @@ static const char *
 }
 
 static const char *
-     set_proxy_domain(cmd_parms *parms, void *dummy, char *arg)
+     set_proxy_domain(cmd_parms *parms, void *dummy, const char *arg)
 {
     proxy_server_conf *psf =
     ap_get_module_config(parms->server->module_config, &proxy_module);
@@ -700,7 +706,7 @@ static const char *
 
 
 static const char *
-     set_recv_buffer_size(cmd_parms *parms, void *dummy, char *arg)
+     set_recv_buffer_size(cmd_parms *parms, void *dummy, const char *arg)
 {
     proxy_server_conf *psf =
     ap_get_module_config(parms->server->module_config, &proxy_module);
@@ -714,7 +720,7 @@ static const char *
 }
 
 static const char*
-    set_via_opt(cmd_parms *parms, void *dummy, char *arg)
+    set_via_opt(cmd_parms *parms, void *dummy, const char *arg)
 {
     proxy_server_conf *psf = ap_get_module_config(parms->server->module_config, &proxy_module);
 
@@ -735,7 +741,7 @@ static const char*
 }
 
 static const char*
-    set_cache_completion(cmd_parms *parms, void *dummy, char *arg)
+    set_cache_completion(cmd_parms *parms, void *dummy, const char *arg)
 {
     proxy_server_conf *psf = ap_get_module_config(parms->server->module_config, &proxy_module);
     int s = atoi(arg);
@@ -757,30 +763,30 @@ static const handler_rec proxy_handlers[] =
 
 static const command_rec proxy_cmds[] =
 {
-    {"ProxyRequests", set_proxy_req, NULL, RSRC_CONF, FLAG,
-     "on if the true proxy requests should be accepted"},
-    {"ProxyRemote", add_proxy, NULL, RSRC_CONF, TAKE2,
-     "a scheme, partial URL or '*' and a proxy server"},
-    {"ProxyPass", add_pass, NULL, RSRC_CONF, TAKE2,
-     "a virtual path and a URL"},
-    {"ProxyPassReverse", add_pass_reverse, NULL, RSRC_CONF, TAKE2,
-     "a virtual path and a URL for reverse proxy behaviour"},
-    {"ProxyBlock", set_proxy_exclude, NULL, RSRC_CONF, ITERATE,
-     "A list of names, hosts or domains to which the proxy will not connect"},
-    {"ProxyReceiveBufferSize", set_recv_buffer_size, NULL, RSRC_CONF, TAKE1,
-     "Receive buffer size for outgoing HTTP and FTP connections in bytes"},
-    {"NoProxy", set_proxy_dirconn, NULL, RSRC_CONF, ITERATE,
-     "A list of domains, hosts, or subnets to which the proxy will connect directly"},
-    {"ProxyDomain", set_proxy_domain, NULL, RSRC_CONF, TAKE1,
-     "The default intranet domain name (in absence of a domain in the URL)"},
-    {"AllowCONNECT", set_allowed_ports, NULL, RSRC_CONF, ITERATE,
-     "A list of ports which CONNECT may connect to"},
-    {"ProxyVia", set_via_opt, NULL, RSRC_CONF, TAKE1,
-     "Configure Via: proxy header header to one of: on | off | block | full"},
-    {"ProxyNoCache", set_cache_exclude, NULL, RSRC_CONF, ITERATE,
-     "A list of names, hosts or domains for which caching is *not* provided"},
-    {"ProxyForceCacheCompletion", set_cache_completion, NULL, RSRC_CONF, TAKE1,
-     "Force a http cache completion after this percentage is loaded"},
+    AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF,
+     "on if the true proxy requests should be accepted"),
+    AP_INIT_TAKE2("ProxyRemote", add_proxy, NULL, RSRC_CONF,
+     "a scheme, partial URL or '*' and a proxy server"),
+    AP_INIT_TAKE2("ProxyPass", add_pass, NULL, RSRC_CONF,
+     "a virtual path and a URL"),
+    AP_INIT_TAKE2("ProxyPassReverse", add_pass_reverse, NULL, RSRC_CONF,
+     "a virtual path and a URL for reverse proxy behaviour"),
+    AP_INIT_ITERATE("ProxyBlock", set_proxy_exclude, NULL, RSRC_CONF,
+     "A list of names, hosts or domains to which the proxy will not connect"),
+    AP_INIT_TAKE1("ProxyReceiveBufferSize", set_recv_buffer_size, NULL, RSRC_CONF,
+     "Receive buffer size for outgoing HTTP and FTP connections in bytes"),
+    AP_INIT_ITERATE("NoProxy", set_proxy_dirconn, NULL, RSRC_CONF,
+     "A list of domains, hosts, or subnets to which the proxy will connect directly"),
+    AP_INIT_TAKE1("ProxyDomain", set_proxy_domain, NULL, RSRC_CONF,
+     "The default intranet domain name (in absence of a domain in the URL)"),
+    AP_INIT_ITERATE("AllowCONNECT", set_allowed_ports, NULL, RSRC_CONF,
+     "A list of ports which CONNECT may connect to"),
+    AP_INIT_TAKE1("ProxyVia", set_via_opt, NULL, RSRC_CONF,
+     "Configure Via: proxy header header to one of: on | off | block | full"),
+    AP_INIT_ITERATE("ProxyNoCache", set_cache_exclude, NULL, RSRC_CONF,
+     "A list of names, hosts or domains for which caching is *not* provided"),
+    AP_INIT_TAKE1("ProxyForceCacheCompletion", set_cache_completion, NULL, RSRC_CONF,
+     "Force a http cache completion after this percentage is loaded"),
 
     {NULL}
 };
index 594fb96b67381b646963b609b5381c480233e4fb..e413105e6c52fd9a8a6fdec4762b5b82f2bcd9c3 100644 (file)
 #include "http_config.h"
 #include "http_protocol.h"
 #include "ap_cache.h"
-
+/*   XXX There is no explain.h in Apache 2.0
 #include "explain.h"
-
+*/
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
@@ -171,8 +171,8 @@ struct proxy_remote {
 };
 
 struct proxy_alias {
-    char *real;
-    char *fake;
+    const char *real;
+    const char *fake;
 };
 
 struct dirconn_entry {
@@ -183,12 +183,12 @@ struct dirconn_entry {
 };
 
 struct noproxy_entry {
-    char *name;
+    const char *name;
     struct in_addr addr;
 };
 
 struct nocache_entry {
-    char *name;
+    const char *name;
     struct in_addr addr;
 };
 
@@ -200,7 +200,7 @@ typedef struct {
     apr_array_header_t *dirconn;
     apr_array_header_t *nocaches;
     apr_array_header_t *allowed_connect_ports;
-    char *domain;              /* domain name to use in absence of a domain name in the request */
+    const char *domain;                /* domain name to use in absence of a domain name in the request */
     int req;                   /* true if proxy requests are enabled */
     float cache_completion;    /* Force cache completion after this point */
     enum {
index b8fe622863b728713fdf290eedea0f3120add120..00ae97ceb68f5b55a213e021599bd6f95f6fcff3 100644 (file)
@@ -58,6 +58,7 @@
 
 /* CONNECT method for Apache proxy */
 
+#include "apr_strings.h"
 #include "mod_proxy.h"
 #include "http_log.h"
 #include "http_main.h"
@@ -145,7 +146,7 @@ int ap_proxy_connect_handler(request_rec *r, ap_cache_el  *c, char *url,
 /* check if ProxyBlock directive on this host */
     destaddr.s_addr = apr_inet_addr(host);
     for (i = 0; i < conf->noproxies->nelts; i++) {
-    if ((npent[i].name != NULL && strstr(host, npent[i].name) != NULL)
+    if ((npent[i].name != NULL && ap_strstr_c(host, npent[i].name) != NULL)
         || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*')
         return ap_proxyerror(r, HTTP_FORBIDDEN,
                  "Connect to remote machine blocked");
index 62c85cfaca7dda879034e96b5aa0f1b574e6df05..477b6e03bd134ca49d51897b1b61d74df2cd32e2 100644 (file)
@@ -58,6 +58,7 @@
 
 /* FTP routines for Apache proxy */
 
+#include "apr_strings.h"
 #include "mod_proxy.h"
 #include "http_main.h"
 #include "http_log.h"
@@ -287,7 +288,7 @@ static long int send_dir(BUFF *f, request_rec *r, ap_cache_el  *c, char *cwd)
     register int n, o, w;
     conn_rec *con = r->connection;
     char *dir, *path, *reldir, *site;
-    BUFF *cachefp = NULL;
+    apr_file_t *cachefp = NULL;
 
     if(c) ap_cache_el_data(c, &cachefp);
     
@@ -398,7 +399,8 @@ static long int send_dir(BUFF *f, request_rec *r, ap_cache_el  *c, char *cwd)
     o = 0;
     total_bytes_sent += n;
 
-    if (cachefp && ap_bwrite(cachefp, buf, n, &cntr) != n) {
+    cntr = n;
+    if (cachefp && apr_write(cachefp, buf, &cntr) != APR_SUCCESS) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                       "proxy: error writing to cache");
         ap_proxy_cache_error(&c);
@@ -468,7 +470,8 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el  *c, char *url)
     int port, i, j, len, rc, nocache = 0;
     apr_socket_t *csd;
     struct in_addr destaddr;
-    BUFF *f, *cachefp = NULL;
+    BUFF *f;
+    apr_file_t *cachefp = NULL;
     BUFF *data = NULL;
     apr_pool_t *p = r->pool;
     int one = 1;
@@ -547,7 +550,7 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el  *c, char *url)
 /* check if ProxyBlock directive on this host */
     destaddr.s_addr = apr_inet_addr(host);
     for (i = 0; i < conf->noproxies->nelts; i++) {
-    if ((npent[i].name != NULL && strstr(host, npent[i].name) != NULL)
+    if ((npent[i].name != NULL && ap_strstr_c(host, npent[i].name) != NULL)
         || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*')
         return ap_proxyerror(r, HTTP_FORBIDDEN,
                  "Connect to remote machine blocked");
@@ -1116,7 +1119,7 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el  *c, char *url)
     
 /* check if NoCache directive on this host */
     for (i = 0; i < conf->nocaches->nelts; i++) {
-    if ((ncent[i].name != NULL && strstr(host, ncent[i].name) != NULL)
+    if ((ncent[i].name != NULL && ap_strstr_c(host, ncent[i].name) != NULL)
         || destaddr.s_addr == ncent[i].addr.s_addr || ncent[i].name[0] == '*')
         nocache = 1;
     }
@@ -1156,7 +1159,7 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el  *c, char *url)
 /* write status line */
     if (!r->assbackwards)
     ap_rvputs(r, "HTTP/1.0 ", r->status_line, CRLF, NULL);
-    if (cachefp    && ap_bvputs(cachefp, "HTTP/1.0 ", r->status_line, CRLF, NULL) == -1) {
+    if (cachefp    && apr_puts(apr_pstrcat(r->pool, "HTTP/1.0 ", r->status_line, CRLF, NULL), cachefp) != APR_SUCCESS) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                       "proxy: error writing CRLF to cache");
         ap_proxy_cache_error(&c);
@@ -1167,7 +1170,7 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el  *c, char *url)
     ap_cache_el_header_walk(c, ap_proxy_send_hdr_line, r, NULL);
     if (!r->assbackwards)
         ap_rputs(CRLF, r);
-    if (cachefp && ap_bputs(CRLF, cachefp) == -1) {
+    if (cachefp && apr_puts(CRLF, cachefp) == -1) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                       "proxy: error writing CRLF to cache");
         ap_proxy_cache_error(&c);
index 0f7b550ce6a864aa1f14fd4393c3df4fe6306cc2..ff5e28634a2716cc69a52e53caf785dd646d700b 100644 (file)
@@ -58,6 +58,7 @@
 
 /* HTTP routines for Apache proxy */
 
+#include "apr_strings.h"
 #include "mod_proxy.h"
 #include "http_log.h"
 #include "http_main.h"
@@ -171,7 +172,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
 {
     const char *strp;
     char *strp2;
-    const char *desthost;
+    char *desthost;
     apr_socket_t *sock;
     int i, len, backasswards, content_length=-1;
     apr_array_header_t *reqhdrs_arr;
@@ -179,7 +180,8 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
     apr_table_entry_t *reqhdrs;
     struct sockaddr_in server;
     struct in_addr destaddr;
-    BUFF *f, *cachefp=NULL;
+    BUFF *f;
+    apr_file_t *cachefp=NULL;
     char buffer[HUGE_STRING_LEN];
     char portstr[32];
     apr_pool_t *p = r->pool;
@@ -207,7 +209,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
         return HTTP_BAD_REQUEST;
     urlptr += 3;
     destport = DEFAULT_HTTP_PORT;
-    strp = strchr(urlptr, '/');
+    strp = ap_strchr_c(urlptr, '/');
     if (strp == NULL) {
         desthost = apr_pstrdup(p, urlptr);
         urlptr = "/";
@@ -220,7 +222,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
         desthost = q;
     }
 
-    strp2 = strchr(desthost, ':');
+    strp2 = ap_strchr(desthost, ':');
     if (strp2 != NULL) {
         *(strp2++) = '\0';
         if (apr_isdigit(*strp2)) {
@@ -232,7 +234,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
 /* check if ProxyBlock directive on this host */
     destaddr.s_addr = apr_inet_addr(desthost);
     for (i = 0; i < conf->noproxies->nelts; i++) {
-        if ((npent[i].name != NULL && strstr(desthost, npent[i].name) != NULL)
+        if ((npent[i].name != NULL && ap_strstr_c(desthost, npent[i].name) != NULL)
             || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*')
             return ap_proxyerror(r, HTTP_FORBIDDEN,
                                  "Connect to remote machine blocked");
@@ -421,7 +423,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
         content_length = atoi(clen ? clen : "-1");
 
     for (i = 0; i < conf->nocaches->nelts; i++) {
-        if ((ncent[i].name != NULL && strstr(desthost, ncent[i].name) != NULL)
+        if ((ncent[i].name != NULL && ap_strstr_c(desthost, ncent[i].name) != NULL)
             || destaddr.s_addr == ncent[i].addr.s_addr || ncent[i].name[0] == '*')
             nocache = 1;
     }
@@ -434,7 +436,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
 /* write status line */
     if (!r->assbackwards)
         ap_rvputs(r, "HTTP/1.0 ", r->status_line, CRLF, NULL);
-    if (cachefp &&    ap_bvputs(cachefp, "HTTP/1.0 ", r->status_line, CRLF, NULL) == -1) {
+    if (cachefp &&    apr_puts(apr_pstrcat(r->pool, "HTTP/1.0 ", r->status_line, CRLF, NULL), cachefp) != APR_SUCCESS) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                       "proxy: error writing status line to cache");
         ap_proxy_cache_error(&c);
@@ -452,7 +454,8 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el  *c, char *url,
 /* Is it an HTTP/0.9 respose? If so, send the extra data */
     if (backasswards) {
         ap_bwrite(r->connection->client, buffer, len, &cntr);
-        if (cachefp && ap_bwrite(cachefp, buffer, len, &cntr) != len) {
+        cntr = len;
+        if (cachefp && apr_write(cachefp, buffer, &cntr) != APR_SUCCESS) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                           "proxy: error writing extra data to cache %ld",
                           (long)cachefp);
index 4590f02b37ceece3c9c28844bbcb822ab5245f0a..e346114e674448a4a39702d5d7f49411f84f84e9 100644 (file)
@@ -57,6 +57,7 @@
  */
 
 /* Utility routines for Apache proxy */
+#include "apr_strings.h"
 #include "mod_proxy.h"
 #include "http_main.h"
 #include "apr_md5.h"
@@ -141,8 +142,8 @@ char *
 {
     int i, j, ch;
     char *y;
-    const char *allowed;    /* characters which should not be encoded */
-    const char *reserved;    /* characters which much not be en/de-coded */
+    char *allowed;    /* characters which should not be encoded */
+    char *reserved;    /* characters which much not be en/de-coded */
 
 /* N.B. in addition to :@&=, this allows ';' in an http path
  * and '?' in an ftp path -- this may be revised
@@ -311,8 +312,9 @@ static const char * const lwday[7] =
  * formatted, then it exits very quickly.
  */
 const char *
-     ap_proxy_date_canon(apr_pool_t *p, const char *x)
+     ap_proxy_date_canon(apr_pool_t *p, const char *x1)
 {
+    char *x = apr_pstrdup(p, x1);
     int wk, mday, year, hour, min, sec, mon;
     char *q, month[4], zone[4], week[4];
 
@@ -500,7 +502,7 @@ long int ap_proxy_send_fb(proxy_completion *completion, BUFF *f, request_rec *r,
     register int n, o;
     conn_rec *con = r->connection;
     int alternate_timeouts = 1;    /* 1 if we alternate between soft & hard timeouts */
-    BUFF *cachefp = NULL;
+    apr_file_t *cachefp = NULL;
     int written = 0, wrote_to_cache;
     
     total_bytes_rcvd = 0;
@@ -554,7 +556,8 @@ long int ap_proxy_send_fb(proxy_completion *completion, BUFF *f, request_rec *r,
     
         /* Write to cache first. */
         /*@@@ XXX FIXME: Assuming that writing the cache file won't time out?!!? */
-        if (cachefp && ap_bwrite(cachefp, &buf[0], cntr, &wrote_to_cache) != APR_SUCCESS) {
+        wrote_to_cache = cntr;
+        if (cachefp && apr_write(cachefp, &buf[0], &wrote_to_cache) != APR_SUCCESS) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                           "proxy: error writing to cache");
             ap_proxy_cache_error(&c);
@@ -636,7 +639,7 @@ int ap_proxy_liststr(const char *list, const char *val)
     len = strlen(val);
 
     while (list != NULL) {
-    p = strchr(list, ',');
+    p = ap_strchr_c(list, ',');
     if (p != NULL) {
         i = p - list;
         do
@@ -1125,7 +1128,7 @@ int ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p)
 static int proxy_match_word(struct dirconn_entry *This, request_rec *r)
 {
     const char *host = proxy_get_host_of_request(r);
-    return host != NULL && strstr(host, This->name) != NULL;
+    return host != NULL && ap_strstr_c(host, This->name) != NULL;
 }
 
 int ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r)
@@ -1173,16 +1176,17 @@ int ap_proxy_send_hdr_line(void *p, const char *key, const char *value)
 unsigned ap_proxy_bputs2(const char *data, BUFF *client, ap_cache_el  *cache)
 {
     unsigned len = ap_bputs(data, client);
-    BUFF *cachefp = NULL;
+    apr_file_t *cachefp = NULL;
     
     if (ap_cache_el_data(cache, &cachefp) == APR_SUCCESS)
-        ap_bputs(data, cachefp);
+        apr_puts(data, cachefp);
     return len;
 }
 
 int ap_proxy_cache_send(request_rec *r, ap_cache_el *c)
 {
-    BUFF *cachefp = NULL, *fp = r->connection->client;
+    apr_file_t *cachefp = NULL;
+    BUFF *fp = r->connection->client;
     char buffer[500];
     
     ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
@@ -1190,13 +1194,18 @@ int ap_proxy_cache_send(request_rec *r, ap_cache_el *c)
     if(ap_cache_el_data(c, &cachefp) != APR_SUCCESS)
         return HTTP_INTERNAL_SERVER_ERROR;
     /* send the response */
-    if(ap_bgets(buffer, sizeof(buffer), cachefp))
+    if(apr_fgets(buffer, sizeof(buffer), cachefp))
         ap_bvputs(fp, buffer, NULL);
     /* send headers */
     ap_cache_el_header_walk(c, ap_proxy_send_hdr_line, r, NULL);
     ap_bputs(CRLF, fp);
     /* send data */
-    if(!r->header_only && !ap_proxy_send_fb(0, cachefp, r, NULL))
+    /* XXX I changed the ap_proxy_send_fb call to use fp instead of cachefp.
+     *     this compiles cleanly, but it is probably the completely wrong
+     *     solution.  We need to go through the proxy code, and remove all
+     *     of the BUFF's.  rbb
+     */
+    if(!r->header_only && !ap_proxy_send_fb(0, fp, r, NULL))
         return HTTP_INTERNAL_SERVER_ERROR;
     return OK;
 }