You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dg...@hyperreal.org on 1998/01/28 12:33:32 UTC

cvs commit: apache-1.3/src/modules/standard mod_access.c mod_autoindex.c mod_cgi.c mod_include.c mod_rewrite.c

dgaudet     98/01/28 03:33:32

  Modified:    src      CHANGES
               src/main http_protocol.c http_vhost.c util.c
               src/modules/proxy mod_proxy.c
               src/modules/standard mod_access.c mod_autoindex.c mod_cgi.c
                        mod_include.c mod_rewrite.c
  Log:
  RFC2068 says pretty much everything is case-insensitive... there are
  only a few exceptions.  Clean up a bunch of cases where we got it wrong.
  Also clean up a few cases where modules used both case-sensitive and
  insensitive parsing of their parms.
  
  Revision  Changes    Path
  1.604     +3 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.603
  retrieving revision 1.604
  diff -u -r1.603 -r1.604
  --- CHANGES	1998/01/28 10:00:25	1.603
  +++ CHANGES	1998/01/28 11:33:19	1.604
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3b4
   
  +  *) Some case-sensitivity issues cleaned up to be consistent with
  +     RFC2068.  [Dean Gaudet]
  +
     *) SIGURG doesn't exist everywhere.
        [Mark Andrew Heinrich <he...@tinderbox.Stanford.EDU>]
   
  
  
  
  1.182     +2 -2      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.181
  retrieving revision 1.182
  diff -u -r1.181 -r1.182
  --- http_protocol.c	1998/01/26 19:50:13	1.181
  +++ http_protocol.c	1998/01/28 11:33:21	1.182
  @@ -137,7 +137,7 @@
       if (!(range = table_get(r->headers_in, "Range")))
           range = table_get(r->headers_in, "Request-Range");
   
  -    if (!range || strncmp(range, "bytes=", 6)) {
  +    if (!range || strncasecmp(range, "bytes=", 6)) {
           table_setn(r->headers_out, "Accept-Ranges", "bytes");
           return 0;
       }
  @@ -630,7 +630,7 @@
       unsigned port;
   
       /* This routine parses full URLs, if they match the server */
  -    if (strncmp(uri, "http://", 7))
  +    if (strncasecmp(uri, "http://", 7))
           return uri;
       name = pstrdup(r->pool, uri + 7);
   
  
  
  
  1.4       +2 -2      apache-1.3/src/main/http_vhost.c
  
  Index: http_vhost.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_vhost.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- http_vhost.c	1998/01/07 16:46:17	1.3
  +++ http_vhost.c	1998/01/28 11:33:22	1.4
  @@ -191,7 +191,7 @@
   	my_addr = htonl(INADDR_ANY);
   	is_an_ip_addr = 1;
       }
  -    else if (strcmp(w, "_default_") == 0
  +    else if (strcasecmp(w, "_default_") == 0
   	     || strcmp(w, "255.255.255.255") == 0) {
   	my_addr = DEFAULT_VHOST_ADDR;
   	is_an_ip_addr = 1;
  @@ -678,7 +678,7 @@
   found:
       /* s is the first matching server, we're done */
       r->server = r->connection->server = s;
  -    if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
  +    if (r->hostlen && !strncasecmp(r->uri, "http://", 7)) {
   	r->uri += r->hostlen;
   	parse_uri(r, r->uri);
       }
  
  
  
  1.90      +1 -1      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.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- util.c	1998/01/21 22:11:02	1.89
  +++ util.c	1998/01/28 11:33:22	1.90
  @@ -1526,7 +1526,7 @@
       if (ind(p->h_name, '.') == -1) {
   	for (x = 0; p->h_aliases[x]; ++x) {
   	    if ((ind(p->h_aliases[x], '.') != -1) &&
  -		(!strncmp(p->h_aliases[x], p->h_name, strlen(p->h_name))))
  +		(!strncasecmp(p->h_aliases[x], p->h_name, strlen(p->h_name))))
   		return pstrdup(a, p->h_aliases[x]);
   	}
   	return NULL;
  
  
  
  1.34      +7 -7      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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- mod_proxy.c	1998/01/26 19:50:17	1.33
  +++ mod_proxy.c	1998/01/28 11:33:24	1.34
  @@ -302,7 +302,7 @@
       /* Check URI's destination host against NoProxy hosts */
       /* Bypass ProxyRemote server lookup if configured as NoProxy */
       /* we only know how to handle communication to a proxy via http */
  -    /*if (strcmp(scheme, "http") == 0) */
  +    /*if (strcasecmp(scheme, "http") == 0) */
       {
   	int ii;
   	struct dirconn_entry *list = (struct dirconn_entry *) conf->dirconn->elts;
  @@ -331,9 +331,9 @@
   	for (i = 0; i < proxies->nelts; i++) {
   	    p = strchr(ents[i].scheme, ':');	/* is it a partial URL? */
   	    if (strcmp(ents[i].scheme, "*") == 0 ||
  -		(p == NULL && strcmp(scheme, ents[i].scheme) == 0) ||
  +		(p == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||
   		(p != NULL &&
  -	       strncmp(url, ents[i].scheme, strlen(ents[i].scheme)) == 0)) {
  +	       strncasecmp(url, ents[i].scheme, strlen(ents[i].scheme)) == 0)) {
   		/* CONNECT is a special method that bypasses the normal
   		 * proxy code.
   		 */
  @@ -341,7 +341,7 @@
   		    rc = proxy_connect_handler(r, cr, url, ents[i].hostname,
   					       ents[i].port);
   /* we only know how to handle communication to a proxy via http */
  -		else if (strcmp(ents[i].protocol, "http") == 0)
  +		else if (strcasecmp(ents[i].protocol, "http") == 0)
   		    rc = proxy_http_handler(r, cr, url, ents[i].hostname,
   					    ents[i].port);
   		else
  @@ -361,9 +361,9 @@
       /* handle the scheme */
       if (r->method_number == M_CONNECT)
   	return proxy_connect_handler(r, cr, url, NULL, 0);
  -    if (strcmp(scheme, "http") == 0)
  +    if (strcasecmp(scheme, "http") == 0)
   	return proxy_http_handler(r, cr, url, NULL, 0);
  -    if (strcmp(scheme, "ftp") == 0)
  +    if (strcasecmp(scheme, "ftp") == 0)
   	return proxy_ftp_handler(r, cr, url);
       else
   	return NOT_IMPLEMENTED;
  @@ -427,7 +427,7 @@
       if (port == -1) {
   	int i;
   	for (i = 0; defports[i].scheme != NULL; i++)
  -	    if (strcmp(defports[i].scheme, r) == 0)
  +	    if (strcasecmp(defports[i].scheme, r) == 0)
   		break;
   	port = defports[i].port;
       }
  
  
  
  1.30      +2 -2      apache-1.3/src/modules/standard/mod_access.c
  
  Index: mod_access.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_access.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- mod_access.c	1998/01/07 16:46:42	1.29
  +++ mod_access.c	1998/01/28 11:33:25	1.30
  @@ -152,12 +152,12 @@
       a->x.from = where = pstrdup(cmd->pool, where);
       a->limited = cmd->limited;
   
  -    if (!strncmp(where, "env=", 4)) {
  +    if (!strncasecmp(where, "env=", 4)) {
   	a->type = T_ENV;
   	a->x.from += 4;
   
       }
  -    else if (!strcmp(where, "all")) {
  +    else if (!strcasecmp(where, "all")) {
   	a->type = T_ALL;
   
       }
  
  
  
  1.64      +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.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- mod_autoindex.c	1998/01/26 18:24:37	1.63
  +++ mod_autoindex.c	1998/01/28 11:33:26	1.64
  @@ -612,8 +612,8 @@
   	return NULL;
       }
       if (r->content_type
  -	&& (!strcmp(r->content_type, "text/html")
  -	    || !strcmp(r->content_type, INCLUDES_MAGIC_TYPE))
  +	&& (!strcasecmp(r->content_type, "text/html")
  +	    || !strcasecmp(r->content_type, INCLUDES_MAGIC_TYPE))
   	&& !r->content_encoding) {
   	if (!(thefile = pfopen(r->pool, r->filename, "r")))
   	         return NULL;
  
  
  
  1.69      +1 -1      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.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- mod_cgi.c	1998/01/26 16:46:14	1.68
  +++ mod_cgi.c	1998/01/28 11:33:27	1.69
  @@ -85,7 +85,7 @@
   static int is_scriptaliased(request_rec *r)
   {
       char *t = table_get(r->notes, "alias-forced-type");
  -    return t && (!strcmp(t, "cgi-script"));
  +    return t && (!strcasecmp(t, "cgi-script"));
   }
   
   /* Configuration stuff */
  
  
  
  1.69      +1 -1      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.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- mod_include.c	1998/01/27 02:46:56	1.68
  +++ mod_include.c	1998/01/28 11:33:29	1.69
  @@ -662,7 +662,7 @@
               }
   
               if (!error_fmt && noexec && rr->content_type
  -                && (strncmp(rr->content_type, "text/", 5))) {
  +                && (strncasecmp(rr->content_type, "text/", 5))) {
                   error_fmt = "unable to include potential exec \"%s\" "
                       "in parsed file %s";
               }
  
  
  
  1.64      +19 -19    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.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- mod_rewrite.c	1998/01/26 19:50:23	1.63
  +++ mod_rewrite.c	1998/01/28 11:33:30	1.64
  @@ -991,13 +991,13 @@
               return OK; 
           }
           else if (  (strlen(r->filename) > 7 &&
  -                    strncmp(r->filename, "http://", 7) == 0)
  +                    strncasecmp(r->filename, "http://", 7) == 0)
                   || (strlen(r->filename) > 8 &&
  -                    strncmp(r->filename, "https://", 8) == 0)
  +                    strncasecmp(r->filename, "https://", 8) == 0)
                   || (strlen(r->filename) > 9 &&
  -                    strncmp(r->filename, "gopher://", 9) == 0)
  +                    strncasecmp(r->filename, "gopher://", 9) == 0)
                   || (strlen(r->filename) > 6 &&
  -                    strncmp(r->filename, "ftp://", 6) == 0)    ) {
  +                    strncasecmp(r->filename, "ftp://", 6) == 0)    ) {
               /* it was finally rewritten to a remote URL */
   
               /* skip 'scheme:' */
  @@ -1773,10 +1773,10 @@
       i = strlen(r->filename);
       if (   prefixstrip
           && !(   r->filename[0] == '/'
  -             || (    (i > 7 && strncmp(r->filename, "http://", 7)   == 0)
  -                  || (i > 8 && strncmp(r->filename, "https://", 8)  == 0)
  -                  || (i > 9 && strncmp(r->filename, "gopher://", 9) == 0)
  -                  || (i > 6 && strncmp(r->filename, "ftp://", 6)    == 0)))) {
  +             || (    (i > 7 && strncasecmp(r->filename, "http://", 7)   == 0)
  +                  || (i > 8 && strncasecmp(r->filename, "https://", 8)  == 0)
  +                  || (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0)
  +                  || (i > 6 && strncasecmp(r->filename, "ftp://", 6)    == 0)))) {
           rewritelog(r, 3, "[per-dir %s] add per-dir prefix: %s -> %s%s",
                      perdir, r->filename, perdir, r->filename);
           r->filename = pstrcat(r->pool, perdir, r->filename, NULL);
  @@ -1837,10 +1837,10 @@
        *  directly force an external HTTP redirect.
        */
       i = strlen(r->filename);
  -    if (   (i > 7 && strncmp(r->filename, "http://", 7)   == 0)
  -        || (i > 8 && strncmp(r->filename, "https://", 8)  == 0)
  -        || (i > 9 && strncmp(r->filename, "gopher://", 9) == 0)
  -        || (i > 6 && strncmp(r->filename, "ftp://", 6)    == 0)) {
  +    if (   (i > 7 && strncasecmp(r->filename, "http://", 7)   == 0)
  +        || (i > 8 && strncasecmp(r->filename, "https://", 8)  == 0)
  +        || (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0)
  +        || (i > 6 && strncasecmp(r->filename, "ftp://", 6)    == 0)) {
           if (perdir == NULL)
               rewritelog(r, 2, 
                          "implicitly forcing redirect (rc=%d) with %s",
  @@ -2097,11 +2097,11 @@
   
   #ifdef APACHE_SSL
       if (   (!r->connection->client->ssl &&
  -            strncmp(r->filename, "http://", 7) == 0)
  +            strncasecmp(r->filename, "http://", 7) == 0)
           || (r->connection->client->ssl &&
  -            strncmp(r->filename, "https://", 8) == 0)) {
  +            strncasecmp(r->filename, "https://", 8) == 0)) {
   #else
  -    if (strncmp(r->filename, "http://", 7) == 0) {
  +    if (strncasecmp(r->filename, "http://", 7) == 0) {
   #endif
           /* there was really a rewrite to a remote path */
   
  @@ -2175,10 +2175,10 @@
       char port[32];
   
       i = strlen(r->filename);
  -    if (!(   (i > 7 && strncmp(r->filename, "http://", 7)   == 0)
  -          || (i > 8 && strncmp(r->filename, "https://", 8)  == 0)
  -          || (i > 9 && strncmp(r->filename, "gopher://", 9) == 0)
  -          || (i > 6 && strncmp(r->filename, "ftp://", 6)    == 0))) {
  +    if (!(   (i > 7 && strncasecmp(r->filename, "http://", 7)   == 0)
  +          || (i > 8 && strncasecmp(r->filename, "https://", 8)  == 0)
  +          || (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0)
  +          || (i > 6 && strncasecmp(r->filename, "ftp://", 6)    == 0))) {
   #ifdef APACHE_SSL
           if (is_default_port(r->server->port,r))
   #else