You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by be...@hyperreal.org on 1998/06/13 17:23:19 UTC

cvs commit: apache-1.3/src/os/win32 mod_isapi.c

ben         98/06/13 08:23:19

  Modified:    src      CHANGES
               src/include alloc.h httpd.h util_script.h
               src/main alloc.c http_config.c http_protocol.c
                        http_request.c util.c util_script.c
               src/modules/proxy mod_proxy.c mod_proxy.h proxy_cache.c
                        proxy_http.c proxy_util.c
               src/modules/standard mod_actions.c mod_asis.c
                        mod_autoindex.c mod_cern_meta.c mod_cgi.c
                        mod_imap.c mod_include.c mod_log_config.c
                        mod_mime.c mod_negotiation.c mod_rewrite.c
                        mod_speling.c mod_usertrack.c
               src/os/win32 mod_isapi.c
  Log:
  Constify tables.
  
  Revision  Changes    Path
  1.914     +2 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.913
  retrieving revision 1.914
  diff -u -r1.913 -r1.914
  --- CHANGES	1998/06/13 12:05:58	1.913
  +++ CHANGES	1998/06/13 15:22:46	1.914
  @@ -1,5 +1,7 @@
   Changes with Apache 1.3.1
   
  +  *) Make table elements const. This may prevent obscure errors. [Ben Laurie]
  +
     *) Fix parsing of FTP `SIZE' responses in proxy module: The newline was not
        truncated which forced following HTTP headers to be data in the HTTP
        reponse. Although the reponse now is copied out from the response buffer
  
  
  
  1.60      +1 -1      apache-1.3/src/include/alloc.h
  
  Index: alloc.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/alloc.h,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- alloc.h	1998/05/28 22:09:45	1.59
  +++ alloc.h	1998/06/13 15:22:48	1.60
  @@ -179,7 +179,7 @@
   API_EXPORT(table *) ap_make_table(pool *p, int nelts);
   API_EXPORT(table *) ap_copy_table(pool *p, const table *);
   API_EXPORT(void) ap_clear_table(table *);
  -API_EXPORT(char *) ap_table_get(const table *, const char *);
  +API_EXPORT(const char *) ap_table_get(const table *, const char *);
   API_EXPORT(void) ap_table_set(table *, const char *name, const char *val);
   API_EXPORT(void) ap_table_setn(table *, const char *name, const char *val);
   API_EXPORT(void) ap_table_merge(table *, const char *name, const char *more_val);
  
  
  
  1.224     +7 -7      apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.223
  retrieving revision 1.224
  diff -u -r1.223 -r1.224
  --- httpd.h	1998/06/10 09:02:02	1.223
  +++ httpd.h	1998/06/13 15:22:49	1.224
  @@ -600,7 +600,7 @@
       int header_only;		/* HEAD request, as opposed to GET */
       char *protocol;		/* Protocol, as given to us, or HTTP/0.9 */
       int proto_num;		/* Number version of protocol; 1.1 = 1001 */
  -    char *hostname;		/* Host, as set by full URI or Host: */
  +    const char *hostname;	/* Host, as set by full URI or Host: */
   
       time_t request_time;	/* When the request started */
   
  @@ -645,7 +645,7 @@
       int chunked;		/* sending chunked transfer-coding */
       int byterange;		/* number of byte ranges */
       char *boundary;		/* multipart/byteranges boundary */
  -    char *range;		/* The Range: header */
  +    const char *range;		/* The Range: header */
       long clength;		/* The "real" content length */
   
       long remaining;		/* bytes left to read */
  @@ -675,11 +675,11 @@
        * content_languages MUST be lowercased strings.  They may be pointers
        * to static strings; they should not be modified in place.
        */
  -    char *content_type;		/* Break these out --- we dispatch on 'em */
  -    char *handler;		/* What we *really* dispatch on           */
  +    const char *content_type;	/* Break these out --- we dispatch on 'em */
  +    const char *handler;	/* What we *really* dispatch on           */
   
  -    char *content_encoding;
  -    char *content_language;	/* for back-compat. only -- do not use */
  +    const char *content_encoding;
  +    const char *content_language;	/* for back-compat. only -- do not use */
       array_header *content_languages;	/* array of (char*) */
   
       int no_cache;
  @@ -862,7 +862,7 @@
   API_EXPORT(char *) ap_getword_conf(pool *p, const char **line);
   API_EXPORT(char *) ap_getword_conf_nc(pool *p, char **line);
   
  -API_EXPORT(char *) ap_get_token(pool *p, char **accept_line, int accept_white);
  +API_EXPORT(char *) ap_get_token(pool *p, const char **accept_line, int accept_white);
   API_EXPORT(int) ap_find_token(pool *p, const char *line, const char *tok);
   API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok);
   
  
  
  
  1.33      +1 -1      apache-1.3/src/include/util_script.h
  
  Index: util_script.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/util_script.h,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- util_script.h	1998/05/16 16:34:47	1.32
  +++ util_script.h	1998/06/13 15:22:49	1.33
  @@ -77,7 +77,7 @@
   #define scan_script_header(a1,a2) ap_scan_script_header_err(a1,a2,NULL)
   API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, char *buffer);
   API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *f,
  -                                            char *buffer);
  +                                               char *buffer);
   API_EXPORT(void) ap_send_size(size_t size, request_rec *r);
   API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, char **env,
                             int shellcmd);
  
  
  
  1.96      +1 -1      apache-1.3/src/main/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/alloc.c,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- alloc.c	1998/06/08 05:39:55	1.95
  +++ alloc.c	1998/06/13 15:22:52	1.96
  @@ -1117,7 +1117,7 @@
       t->a.nelts = 0;
   }
   
  -API_EXPORT(char *) ap_table_get(const table *t, const char *key)
  +API_EXPORT(const char *) ap_table_get(const table *t, const char *key)
   {
       table_entry *elts = (table_entry *) t->a.elts;
       int i;
  
  
  
  1.117     +2 -1      apache-1.3/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- http_config.c	1998/05/06 15:18:01	1.116
  +++ http_config.c	1998/06/13 15:22:52	1.117
  @@ -476,7 +476,8 @@
   int ap_invoke_handler(request_rec *r)
   {
       fast_handler_rec *handp;
  -    char *handler, *p;
  +    const char *handler;
  +    char *p;
       size_t handler_len;
   
       if (r->handler) {
  
  
  
  1.219     +15 -15    apache-1.3/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
  retrieving revision 1.218
  retrieving revision 1.219
  diff -u -r1.218 -r1.219
  --- http_protocol.c	1998/06/06 19:30:48	1.218
  +++ http_protocol.c	1998/06/13 15:22:53	1.219
  @@ -116,12 +116,12 @@
       return (*start > 0 || *end < clength - 1);
   }
   
  -static int internal_byterange(int, long *, request_rec *, char **, long *,
  +static int internal_byterange(int, long *, request_rec *, const char **, long *,
                                 long *);
   
   API_EXPORT(int) ap_set_byterange(request_rec *r)
   {
  -    char *range, *if_range, *match;
  +    const char *range, *if_range, *match;
       long range_start, range_end;
   
       if (!r->clength || r->assbackwards)
  @@ -206,7 +206,7 @@
    * when done.
    */
   static int internal_byterange(int realreq, long *tlength, request_rec *r,
  -                              char **r_range, long *offset, long *length)
  +                              const char **r_range, long *offset, long *length)
   {
       long range_start, range_end;
       char *range;
  @@ -221,14 +221,14 @@
           return 0;
       }
   
  -    range = ap_getword_nc(r->pool, r_range, ',');
  +    range = ap_getword(r->pool, r_range, ',');
       if (!parse_byterange(range, r->clength, &range_start, &range_end))
           /* Skip this one */
           return internal_byterange(realreq, tlength, r, r_range, offset,
                                     length);
   
       if (r->byterange > 1) {
  -        char *ct = r->content_type ? r->content_type : ap_default_type(r);
  +        const char *ct = r->content_type ? r->content_type : ap_default_type(r);
           char ts[MAX_STRING_LEN];
   
           ap_snprintf(ts, sizeof(ts), "%ld-%ld/%ld", range_start, range_end,
  @@ -264,7 +264,7 @@
       int ka_sent = 0;
       int wimpy = ap_find_token(r->pool,
                              ap_table_get(r->headers_out, "Connection"), "close");
  -    char *conn = ap_table_get(r->headers_in, "Connection");
  +    const char *conn = ap_table_get(r->headers_in, "Connection");
   
       /* The following convoluted conditional determines whether or not
        * the current connection should remain persistent after this response
  @@ -375,8 +375,8 @@
   
   API_EXPORT(int) ap_meets_conditions(request_rec *r)
   {
  -    char *etag = ap_table_get(r->headers_out, "ETag");
  -    char *if_match, *if_modified_since, *if_unmodified, *if_nonematch;
  +    const char *etag = ap_table_get(r->headers_out, "ETag");
  +    const char *if_match, *if_modified_since, *if_unmodified, *if_nonematch;
       time_t mtime;
   
       /* Check for conditional requests --- note that we only want to do
  @@ -1198,7 +1198,7 @@
    */
   static int use_range_x(request_rec *r)
   {
  -    char *ua;
  +    const char *ua;
       return (ap_table_get(r->headers_in, "Request-Range") ||
               ((ua = ap_table_get(r->headers_in, "User-Agent"))
                && strstr(ua, "MSIE 3")));
  @@ -1356,8 +1356,8 @@
   
   API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy)
   {
  -    char *tenc = ap_table_get(r->headers_in, "Transfer-Encoding");
  -    char *lenp = ap_table_get(r->headers_in, "Content-Length");
  +    const char *tenc = ap_table_get(r->headers_in, "Transfer-Encoding");
  +    const char *lenp = ap_table_get(r->headers_in, "Content-Length");
   
       r->read_body = read_policy;
       r->read_chunked = 0;
  @@ -1378,7 +1378,7 @@
           r->read_chunked = 1;
       }
       else if (lenp) {
  -        char *pos = lenp;
  +        const char *pos = lenp;
   
           while (isdigit(*pos) || isspace(*pos))
               ++pos;
  @@ -1960,7 +1960,7 @@
       int status = r->status;
       int idx = ap_index_of_response(status);
       char *custom_response;
  -    char *location = ap_table_get(r->headers_out, "Location");
  +    const char *location = ap_table_get(r->headers_out, "Location");
   
       /* We need to special-case the handling of 204 and 304 responses,
        * since they have specific HTTP requirements and do not include a
  @@ -2064,7 +2064,7 @@
       {
           char *title = status_lines[idx];
           char *h1;
  -        char *error_notes;
  +        const char *error_notes;
   
           /* Accept a status_line set by a module, but only if it begins
            * with the 3 digit status code
  @@ -2142,7 +2142,7 @@
                   /* fall through */
               case MULTIPLE_CHOICES:
                   {
  -                    char *list;
  +                    const char *list;
                       if ((list = ap_table_get(r->notes, "variant-list")))
                           ap_bputs(list, fd);
                   }
  
  
  
  1.123     +1 -1      apache-1.3/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_request.c,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- http_request.c	1998/05/27 22:56:00	1.122
  +++ http_request.c	1998/06/13 15:22:53	1.123
  @@ -943,7 +943,7 @@
               ap_table_setn(r->headers_out, "Location", custom_response);
           }
           else if (custom_response[0] == '/') {
  -            char *error_notes;
  +            const char *error_notes;
               r->no_local_copy = 1;       /* Do NOT send USE_LOCAL_COPY for
                                            * error documents! */
               /*
  
  
  
  1.121     +3 -3      apache-1.3/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- util.c	1998/06/10 09:02:09	1.120
  +++ util.c	1998/06/13 15:22:54	1.121
  @@ -961,10 +961,10 @@
    * by whitespace at the caller's option.
    */
   
  -API_EXPORT(char *) ap_get_token(pool *p, char **accept_line, int accept_white)
  +API_EXPORT(char *) ap_get_token(pool *p, const char **accept_line, int accept_white)
   {
  -    char *ptr = *accept_line;
  -    char *tok_start;
  +    const char *ptr = *accept_line;
  +    const char *tok_start;
       char *token;
       int tok_len;
   
  
  
  
  1.117     +5 -3      apache-1.3/src/main/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util_script.c,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- util_script.c	1998/06/10 09:02:09	1.116
  +++ util_script.c	1998/06/13 15:22:54	1.117
  @@ -458,6 +458,7 @@
   	    ++l;
   
   	if (!strcasecmp(w, "Content-type")) {
  +	    char *tmp;
   
   	    /* Nuke trailing whitespace */
   
  @@ -465,8 +466,9 @@
   	    while (endp > l && isspace(*endp))
   		*endp-- = '\0';
   
  -	    r->content_type = ap_pstrdup(r->pool, l);
  -	    ap_content_type_tolower(r->content_type);
  +	    tmp = ap_pstrdup(r->pool, l);
  +	    ap_content_type_tolower(tmp);
  +	    r->content_type = tmp;
   	}
   	/*
   	 * If the script returned a specific status, that's what
  @@ -525,7 +527,7 @@
   }
   
   API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *fb,
  -					    char *buffer)
  +					       char *buffer)
   {
       return scan_script_header_err_core(r, buffer, getsfunc_BUFF, fb);
   }
  
  
  
  1.54      +2 -1      apache-1.3/src/modules/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- mod_proxy.c	1998/05/27 22:56:02	1.53
  +++ mod_proxy.c	1998/06/13 15:22:58	1.54
  @@ -244,7 +244,8 @@
   /* The "ProxyDomain" directive determines what domain will be appended */
   static int proxy_needsdomain(request_rec *r, const char *url, const char *domain)
   {
  -    char *nuri, *ref;
  +    char *nuri;
  +    const char *ref;
   
       /* We only want to worry about GETs */
       if (!r->proxyreq || r->method_number != M_GET || !r->parsed_uri.hostname)
  
  
  
  1.36      +5 -5      apache-1.3/src/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/mod_proxy.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- mod_proxy.h	1998/06/02 12:50:46	1.35
  +++ mod_proxy.h	1998/06/13 15:22:59	1.36
  @@ -211,8 +211,8 @@
   } proxy_server_conf;
   
   struct hdr_entry {
  -    char *field;
  -    char *value;
  +    const char *field;
  +    const char *value;
   };
   
   /* caching information about a request */
  @@ -272,12 +272,12 @@
   		     int isenc);
   char *ap_proxy_canon_netloc(pool *p, char **const urlp, char **userp,
   			 char **passwordp, char **hostp, int *port);
  -char *ap_proxy_date_canon(pool *p, char *x);
  +const char *ap_proxy_date_canon(pool *p, const char *x);
   array_header *ap_proxy_read_headers(pool *p, char *buffer, int size, BUFF *f);
   long int ap_proxy_send_fb(BUFF *f, request_rec *r, BUFF *f2, struct cache_req *c);
   struct hdr_entry *ap_proxy_get_header(array_header *hdrs_arr, const char *name);
  -struct hdr_entry *ap_proxy_add_header(array_header *hdrs_arr, char *field,
  -				   char *value, int rep);
  +struct hdr_entry *ap_proxy_add_header(array_header *hdrs_arr, const char *field,
  +				      const char *value, int rep);
   void ap_proxy_del_header(array_header *hdrs_arr, const char *field);
   void ap_proxy_send_headers(request_rec *r, const char *respline,
   			array_header *hdrs_arr);
  
  
  
  1.44      +2 -1      apache-1.3/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- proxy_cache.c	1998/06/09 21:17:54	1.43
  +++ proxy_cache.c	1998/06/13 15:22:59	1.44
  @@ -619,7 +619,8 @@
   int ap_proxy_cache_check(request_rec *r, char *url, struct cache_conf *conf,
   		      struct cache_req **cr)
   {
  -    char hashfile[66], *imstr, *pragma, *auth;
  +    char hashfile[66];
  +    const char *imstr, *pragma, *auth;
       struct cache_req *c;
       time_t now;
       BUFF *cachefp;
  
  
  
  1.49      +15 -11    apache-1.3/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- proxy_http.c	1998/06/08 14:23:50	1.48
  +++ proxy_http.c	1998/06/13 15:23:01	1.49
  @@ -111,7 +111,7 @@
       return OK;
   }
    
  -static char *proxy_location_reverse_map(request_rec *r, char *url)
  +static const char *proxy_location_reverse_map(request_rec *r, const char *url)
   {
       void *sconf;
       proxy_server_conf *conf;
  @@ -136,8 +136,11 @@
   /* Clear all connection-based headers from the incoming headers table */
   static void clear_connection(table *headers)
   {
  -    char *name;
  -    char *next = ap_table_get(headers, "Connection");
  +    const char *name;
  +    /* Although we shouldn't alter the return from ap_table_get, in this case
  +       its OK, coz we're going to delete the entry anyway
  +    */
  +    char *next = (char *)ap_table_get(headers, "Connection");
   
       ap_table_unset(headers, "Proxy-Connection");
       if (!next)
  @@ -168,7 +171,8 @@
   int ap_proxy_http_handler(request_rec *r, struct cache_req *c, char *url,
   		       const char *proxyhost, int proxyport)
   {
  -    char *strp;
  +    const char *strp;
  +    char *strp2;
       const char *err, *desthost;
       int i, j, sock, len, backasswards;
       array_header *reqhdrs_arr, *resp_hdrs;
  @@ -183,7 +187,7 @@
       const long int zero = 0L;
       int destport = 0;
       char *destportstr = NULL;
  -    char *urlptr = NULL;
  +    const char *urlptr = NULL;
   
       void *sconf = r->server->module_config;
       proxy_server_conf *conf =
  @@ -215,12 +219,12 @@
   	desthost = q;
       }
   
  -    strp = strchr(desthost, ':');
  -    if (strp != NULL) {
  -	*(strp++) = '\0';
  -	if (isdigit(*strp)) {
  -	    destport = atoi(strp);
  -	    destportstr = strp;
  +    strp2 = strchr(desthost, ':');
  +    if (strp2 != NULL) {
  +	*(strp2++) = '\0';
  +	if (isdigit(*strp2)) {
  +	    destport = atoi(strp2);
  +	    destportstr = strp2;
   	}
       }
   
  
  
  
  1.63      +15 -14    apache-1.3/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- proxy_util.c	1998/05/29 18:20:59	1.62
  +++ proxy_util.c	1998/06/13 15:23:01	1.63
  @@ -304,8 +304,8 @@
    * sscanf and sprintf. However, if the date is already correctly
    * formatted, then it exits very quickly.
    */
  -char *
  -     ap_proxy_date_canon(pool *p, char *x)
  +const char *
  +     ap_proxy_date_canon(pool *p, const char *x)
   {
       int wk, mday, year, hour, min, sec, mon;
       char *q, month[4], zone[4], week[4];
  @@ -353,11 +353,10 @@
       if (mon == 12)
   	return x;
   
  -    if (strlen(x)+1 < 30)
  -	x = ap_palloc(p, 30);
  -    ap_snprintf(x, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[wk], mday,
  +    q = ap_palloc(p, 30);
  +    ap_snprintf(q, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[wk], mday,
   		ap_month_snames[mon], year, hour, min, sec);
  -    return x;
  +    return q;
   }
   
   /*
  @@ -371,6 +370,7 @@
       array_header *resp_hdrs;
       struct hdr_entry *hdr;
       char *strp;
  +    const char *strcp;
   
       resp_hdrs = ap_make_array(p, 10, sizeof(struct hdr_entry));
       hdr = NULL;
  @@ -430,11 +430,12 @@
   
       hdr = (struct hdr_entry *) resp_hdrs->elts;
       for (i = 0; i < resp_hdrs->nelts; i++) {
  -	strp = hdr[i].value;
  -	j = strlen(strp);
  -	while (j > 0 && (strp[j - 1] == ' ' || strp[j - 1] == '\t'))
  +	strcp = hdr[i].value;
  +	j = strlen(strcp);
  +	while (j > 0 && (strcp[j - 1] == ' ' || strcp[j - 1] == '\t'))
   	    j--;
  -	strp[j] = '\0';
  +	/* Note that this is OK, coz we created the header above */
  +	((char *)strcp)[j] = '\0';
       }
   
       return resp_hdrs;
  @@ -526,7 +527,7 @@
    * is not subsequently overwritten
    */
   struct hdr_entry *
  -          ap_proxy_add_header(array_header *hdrs_arr, char *field, char *value,
  +          ap_proxy_add_header(array_header *hdrs_arr, const char *field, const char *value,
   			   int rep)
   {
       int i;
  @@ -828,7 +829,7 @@
       return NULL;
   }
   
  -static char *
  +static const char *
        proxy_get_host_of_request(request_rec *r)
   {
       char *url, *user = NULL, *password = NULL, *err, *host;
  @@ -1127,7 +1128,7 @@
   static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r)
   {
       char *host = This->name;
  -    char *host2 = proxy_get_host_of_request(r);
  +    const char *host2 = proxy_get_host_of_request(r);
       int h2_len;
       int h1_len;
   
  @@ -1165,7 +1166,7 @@
   /* Return TRUE if string "str2" occurs literally in "str1" */
   static int proxy_match_word(struct dirconn_entry *This, request_rec *r)
   {
  -    char *host = proxy_get_host_of_request(r);
  +    const char *host = proxy_get_host_of_request(r);
       return host != NULL && strstr(host, This->name) != NULL;
   }
   
  
  
  
  1.27      +2 -2      apache-1.3/src/modules/standard/mod_actions.c
  
  Index: mod_actions.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_actions.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_actions.c	1998/04/11 12:00:43	1.26
  +++ mod_actions.c	1998/06/13 15:23:04	1.27
  @@ -159,8 +159,8 @@
   {
       action_dir_config *conf =
       (action_dir_config *) ap_get_module_config(r->per_dir_config, &action_module);
  -    char *t, *action = r->handler ? r->handler : r->content_type;
  -    char *script = NULL;
  +    const char *t, *action = r->handler ? r->handler : r->content_type;
  +    const char *script = NULL;
   
       /* Set allowed stuff */
       if (conf->get)
  
  
  
  1.28      +1 -1      apache-1.3/src/modules/standard/mod_asis.c
  
  Index: mod_asis.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_asis.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- mod_asis.c	1998/04/11 12:00:43	1.27
  +++ mod_asis.c	1998/06/13 15:23:05	1.28
  @@ -66,7 +66,7 @@
   static int asis_handler(request_rec *r)
   {
       FILE *f;
  -    char *location;
  +    const char *location;
   
       r->allowed |= (1 << M_GET);
       if (r->method_number != M_GET)
  
  
  
  1.81      +2 -2      apache-1.3/src/modules/standard/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- mod_autoindex.c	1998/06/12 17:42:42	1.80
  +++ mod_autoindex.c	1998/06/13 15:23:08	1.81
  @@ -444,8 +444,8 @@
   
   static char *find_item(request_rec *r, array_header *list, int path_only)
   {
  -    char *content_type = r->content_type;
  -    char *content_encoding = r->content_encoding;
  +    const char *content_type = r->content_type;
  +    const char *content_encoding = r->content_encoding;
       char *path = r->filename;
   
       struct item *items = (struct item *) list->elts;
  
  
  
  1.31      +4 -3      apache-1.3/src/modules/standard/mod_cern_meta.c
  
  Index: mod_cern_meta.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_cern_meta.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- mod_cern_meta.c	1998/06/10 09:02:12	1.30
  +++ mod_cern_meta.c	1998/06/13 15:23:08	1.31
  @@ -261,15 +261,16 @@
   	    ++l;
   
   	if (!strcasecmp(w, "Content-type")) {
  -
  +	    char *tmp;
   	    /* Nuke trailing whitespace */
   
   	    char *endp = l + strlen(l) - 1;
   	    while (endp > l && isspace(*endp))
   		*endp-- = '\0';
   
  -	    r->content_type = ap_pstrdup(r->pool, l);
  -	    ap_content_type_tolower(r->content_type);
  +	    tmp = ap_pstrdup(r->pool, l);
  +	    ap_content_type_tolower(tmp);
  +	    r->content_type = tmp;
   	}
   	else if (!strcasecmp(w, "Status")) {
   	    sscanf(l, "%d", &r->status);
  
  
  
  1.81      +4 -3      apache-1.3/src/modules/standard/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_cgi.c,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- mod_cgi.c	1998/05/28 22:09:56	1.80
  +++ mod_cgi.c	1998/06/13 15:23:08	1.81
  @@ -88,7 +88,7 @@
   
   static int is_scriptaliased(request_rec *r)
   {
  -    char *t = ap_table_get(r->notes, "alias-forced-type");
  +    const char *t = ap_table_get(r->notes, "alias-forced-type");
       return t && (!strcasecmp(t, "cgi-script"));
   }
   
  @@ -193,7 +193,7 @@
   }
   
   static int log_script(request_rec *r, cgi_server_conf * conf, int ret,
  -		  char *dbuf, char *sbuf, BUFF *script_in, BUFF *script_err)
  +		  char *dbuf, const char *sbuf, BUFF *script_in, BUFF *script_err)
   {
       array_header *hdrs_arr = table_elts(r->headers_in);
       table_entry *hdrs = (table_entry *) hdrs_arr->elts;
  @@ -491,7 +491,8 @@
   
       /* Handle script return... */
       if (script_in && !nph) {
  -	char *location, sbuf[MAX_STRING_LEN];
  +	const char *location;
  +	char sbuf[MAX_STRING_LEN];
   	int ret;
   
   	if ((ret = ap_scan_script_header_err_buff(r, script_in, sbuf))) {
  
  
  
  1.46      +1 -1      apache-1.3/src/modules/standard/mod_imap.c
  
  Index: mod_imap.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_imap.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- mod_imap.c	1998/04/11 12:00:47	1.45
  +++ mod_imap.c	1998/06/13 15:23:08	1.46
  @@ -355,7 +355,7 @@
       char *string_pos = NULL;
       const char *string_pos_const = NULL;
       char *directory = NULL;
  -    char *referer = NULL;
  +    const char *referer = NULL;
       char *my_base;
   
       if (!strcasecmp(value, "map") || !strcasecmp(value, "menu")) {
  
  
  
  1.95      +2 -2      apache-1.3/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_include.c,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- mod_include.c	1998/05/29 08:18:51	1.94
  +++ mod_include.c	1998/06/13 15:23:09	1.95
  @@ -607,7 +607,7 @@
   
       rr_status = ap_run_sub_req(rr);
       if (is_HTTP_REDIRECT(rr_status)) {
  -        char *location = ap_table_get(rr->headers_out, "Location");
  +        const char *location = ap_table_get(rr->headers_out, "Location");
           location = ap_escape_html(rr->pool, location);
           ap_rvputs(r, "<A HREF=\"", location, "\">", location, "</A>", NULL);
       }
  @@ -893,7 +893,7 @@
               return 1;
           }
           if (!strcmp(tag, "var")) {
  -            char *val = ap_table_get(r->subprocess_env, tag_val);
  +            const char *val = ap_table_get(r->subprocess_env, tag_val);
   
               if (val) {
                   ap_rputs(val, r);
  
  
  
  1.61      +6 -6      apache-1.3/src/modules/standard/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- mod_log_config.c	1998/06/09 04:36:47	1.60
  +++ mod_log_config.c	1998/06/13 15:23:09	1.61
  @@ -343,14 +343,14 @@
       }
   }
   
  -static char *log_header_in(request_rec *r, char *a)
  +static const char *log_header_in(request_rec *r, char *a)
   {
       return ap_table_get(r->headers_in, a);
   }
   
  -static char *log_header_out(request_rec *r, char *a)
  +static const char *log_header_out(request_rec *r, char *a)
   {
  -    char *cp = ap_table_get(r->headers_out, a);
  +    const char *cp = ap_table_get(r->headers_out, a);
       if (!strcasecmp(a, "Content-type") && r->content_type) {
           cp = r->content_type;
       }
  @@ -360,11 +360,11 @@
       return ap_table_get(r->err_headers_out, a);
   }
   
  -static char *log_note(request_rec *r, char *a)
  +static const char *log_note(request_rec *r, char *a)
   {
       return ap_table_get(r->notes, a);
   }
  -static char *log_env_var(request_rec *r, char *a)
  +static const char *log_env_var(request_rec *r, char *a)
   {
       return ap_table_get(r->subprocess_env, a);
   }
  @@ -803,7 +803,7 @@
   {
       multi_log_state *base = (multi_log_state *) basev;
       multi_log_state *add = (multi_log_state *) addv;
  -    char *format;
  +    const char *format;
       const char *dummy;
   
       add->server_config_logs = base->config_logs;
  
  
  
  1.42      +4 -2      apache-1.3/src/modules/standard/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- mod_mime.c	1998/05/29 08:18:52	1.41
  +++ mod_mime.c	1998/06/13 15:23:10	1.42
  @@ -245,7 +245,9 @@
       const char *fn = strrchr(r->filename, '/');
       mime_dir_config *conf =
       (mime_dir_config *) ap_get_module_config(r->per_dir_config, &mime_module);
  -    char *ext, *type, *orighandler = r->handler;
  +    char *ext;
  +    const char *orighandler = r->handler;
  +    const char *type;
   
       if (S_ISDIR(r->finfo.st_mode)) {
           r->content_type = DIR_MAGIC_TYPE;
  @@ -273,7 +275,7 @@
   
           /* Check for Content-Language */
           if ((type = ap_table_get(conf->language_types, ext))) {
  -            char **new;
  +            const char **new;
   
               r->content_language = type;         /* back compat. only */
               if (!r->content_languages)
  
  
  
  1.81      +9 -9      apache-1.3/src/modules/standard/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_negotiation.c,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- mod_negotiation.c	1998/05/30 19:15:38	1.80
  +++ mod_negotiation.c	1998/06/13 15:23:10	1.81
  @@ -180,7 +180,7 @@
       request_rec *sub_req;       /* May be NULL (is, for map files) */
       char *type_name;		/* MUST be lowercase */
       char *file_name;
  -    char *content_encoding;
  +    const char *content_encoding;
       array_header *content_languages;    /* list of languages for this variant */
       char *content_charset;
       char *description;
  @@ -297,7 +297,7 @@
    * enter the values we recognize into the argument accept_rec
    */
   
  -static char *get_entry(pool *p, accept_rec *result, char *accept_line)
  +static const char *get_entry(pool *p, accept_rec *result, const char *accept_line)
   {
       result->quality = 1.0f;
       result->max_bytes = 0.0f;
  @@ -409,7 +409,7 @@
    * and charset is only valid in Accept.
    */
   
  -static array_header *do_header_line(pool *p, char *accept_line)
  +static array_header *do_header_line(pool *p, const char *accept_line)
   {
       array_header *accept_recs = ap_make_array(p, 40, sizeof(accept_rec));
   
  @@ -461,7 +461,7 @@
       accept_rec *elts;
       table *hdrs = r->headers_in;
       int i;
  -    char *hdr;
  +    const char *hdr;
   
       new->pool = r->pool;
       new->r = r;
  @@ -1446,7 +1446,7 @@
    * use 7bit, 8bin or binary in their var files??
    */
   
  -static int is_identity_encoding(char *enc)
  +static int is_identity_encoding(const char *enc)
   {
       return (!enc || !enc[0] || !strcmp(enc, "7bit") || !strcmp(enc, "8bit")
               || !strcmp(enc, "binary"));
  @@ -1456,7 +1456,7 @@
   {
       int i;
       accept_rec *accept_recs = (accept_rec *) neg->accept_encodings->elts;
  -    char *enc = variant->content_encoding;
  +    const char *enc = variant->content_encoding;
   
       if (!enc || is_identity_encoding(enc)) {
           return;
  @@ -1805,7 +1805,7 @@
       var_rec *avail_recs = (var_rec *) neg->avail_vars->elts;
       char *sample_type = NULL;
       char *sample_language = NULL;
  -    char *sample_encoding = NULL;
  +    const char *sample_encoding = NULL;
       char *sample_charset = NULL;
       int vary_by_type = 0;
       int vary_by_language = 0;
  @@ -1973,7 +1973,7 @@
   static int setup_choice_response(request_rec *r, negotiation_state *neg, var_rec *variant)
   {
       request_rec *sub_req;
  -    char *sub_vary;
  +    const char *sub_vary;
   
       if (!variant->sub_req) {
           int status;
  @@ -2232,7 +2232,7 @@
    */
   static int fix_encoding(request_rec *r)
   {
  -    char *enc = r->content_encoding;
  +    const char *enc = r->content_encoding;
       char *x_enc = NULL;
       array_header *accept_encodings;
       accept_rec *accept_recs;
  
  
  
  1.116     +4 -3      apache-1.3/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- mod_rewrite.c	1998/06/09 09:35:07	1.115
  +++ mod_rewrite.c	1998/06/13 15:23:11	1.116
  @@ -942,9 +942,10 @@
   {
       void *sconf;
       rewrite_server_conf *conf;
  -    char *var;
  +    const char *var;
       const char *thisserver;
  -    char *thisport, *thisurl;
  +    char *thisport;
  +    const char *thisurl;
       char buf[512];
       char docroot[512];
       char *cp, *cp2;
  @@ -1202,7 +1203,7 @@
   
   static int hook_mimetype(request_rec *r)
   {
  -    char *t;
  +    const char *t;
   
       /* now check if we have to force a MIME-type */
       t = ap_table_get(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR);
  
  
  
  1.20      +2 -1      apache-1.3/src/modules/standard/mod_speling.c
  
  Index: mod_speling.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_speling.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- mod_speling.c	1998/05/30 01:53:05	1.19
  +++ mod_speling.c	1998/06/13 15:23:12	1.20
  @@ -322,7 +322,8 @@
   
       if (candidates->nelts != 0) {
           /* Wow... we found us a mispelling. Construct a fixed url */
  -        char *nuri, *ref;
  +        char *nuri;
  +	const char *ref;
           misspelled_file *variant = (misspelled_file *) candidates->elts;
           int i;
   
  
  
  
  1.36      +1 -1      apache-1.3/src/modules/standard/mod_usertrack.c
  
  Index: mod_usertrack.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_usertrack.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- mod_usertrack.c	1998/06/08 06:09:52	1.35
  +++ mod_usertrack.c	1998/06/13 15:23:12	1.36
  @@ -202,7 +202,7 @@
   {
       int *enable = (int *) ap_get_module_config(r->per_dir_config,
                                               &usertrack_module);
  -    char *cookie;
  +    const char *cookie;
       char *value;
   
       if (!*enable)
  
  
  
  1.12      +5 -3      apache-1.3/src/os/win32/mod_isapi.c
  
  Index: mod_isapi.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/mod_isapi.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- mod_isapi.c	1998/05/09 15:09:31	1.11
  +++ mod_isapi.c	1998/06/13 15:23:18	1.12
  @@ -297,7 +297,7 @@
   			       LPVOID lpvBuffer, LPDWORD lpdwSizeofBuffer) {
       request_rec *r = ((isapi_cid *)hConn)->r;
       table *e = r->subprocess_env;
  -    char *result;
  +    const char *result;
       
       /* Mostly, we just grab it from the environment, but there are
        * a couple of special cases
  @@ -467,13 +467,15 @@
   	     */
   
   	    if (!strcasecmp(data, "Content-Type")) {
  +		char *tmp;
   		/* Nuke trailing whitespace */
   		
   		char *endp = value + strlen(value) - 1;
   		while (endp > value && isspace(*endp)) *endp-- = '\0';
               
  -		r->content_type = ap_pstrdup (r->pool, value);
  -		ap_str_tolower(r->content_type);
  +		tmp = ap_pstrdup (r->pool, value);
  +		ap_str_tolower(tmp);
  +		r->content_type = tmp;
   	    }
   	    else if (!strcasecmp(data, "Content-Length")) {
   		ap_table_set(r->headers_out, data, value);
  
  
  

Re: cvs commit: apache-1.3/src/os/win32 mod_isapi.c

Posted by Dean Gaudet <dg...@arctic.org>.
Thanks Ben, I'm happy to see this change.

On 13 Jun 1998 ben@hyperreal.org wrote:

>   @@ -136,8 +136,11 @@
>    /* Clear all connection-based headers from the incoming headers table */
>    static void clear_connection(table *headers)
>    {
>   -    char *name;
>   -    char *next = ap_table_get(headers, "Connection");
>   +    const char *name;
>   +    /* Although we shouldn't alter the return from ap_table_get, in this case
>   +       its OK, coz we're going to delete the entry anyway
>   +    */
>   +    char *next = (char *)ap_table_get(headers, "Connection");
>    
>        ap_table_unset(headers, "Proxy-Connection");
>        if (!next)

Nope it's not OK.  Search for '"Connection"' in the code:

./main/http_protocol.c:                           ap_table_get(r->headers_out, "Connection"), "close");
./main/http_protocol.c:    const char *conn = ap_table_get(r->headers_in, "Connection");
./main/http_protocol.c:            ap_table_mergen(r->headers_out, "Connection", "Keep-Alive");
./main/http_protocol.c: ap_table_mergen(r->headers_out, "Connection", "close");
./main/http_protocol.c:                    "Connection",
./modules/proxy/proxy_http.c:    char *next = (char *)ap_table_get(headers, "Connection");
./modules/proxy/proxy_http.c:    ap_table_unset(headers, "Connection");

Notice the mergens.  In almost all situations those will cause the value
returned for next above to point at a static string, which of course
must not be modified.

Also, If we ever change the implementation of tables the above could
be wrong...  for example, we may discover that a single extensible hash
for all strings gives us big performance wins (and thus the next above
would point to shared data).

Dean