You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by di...@locus.apache.org on 2000/03/14 14:32:08 UTC

cvs commit: apache-2.0/src/main http_core.c

dirkx       00/03/14 05:32:08

  Modified:    conf     httpd.conf-dist httpd.conf-dist-win
               src      CHANGES
               src/main http_core.c
  Log:
  Nasty backwards compatibility breaking 'fix' to get rid of
  
  	ErrorDocument	201 "Some string without a closing quote
  
  case which is just pure ugly. I am _NOT_ going to be offended
  if anyone rolls back this patch OR if anyone suggests to have
  an ErrorDocument2 which the proper syntax/semantics.
  
  But I thought lets take my chance whilst everyone is still
  recovering from the apachecon.
  
  Dw.
  
  Revision  Changes    Path
  1.3       +9 -4      apache-2.0/conf/httpd.conf-dist
  
  Index: httpd.conf-dist
  ===================================================================
  RCS file: /home/cvs/apache-2.0/conf/httpd.conf-dist,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -u -r1.2 -r1.3
  --- httpd.conf-dist	1999/08/26 05:17:40	1.2
  +++ httpd.conf-dist	2000/03/14 13:32:07	1.3
  @@ -723,20 +723,25 @@
   #  these come in three flavors
   #
   #    1) plain text
  -#ErrorDocument 500 "The server made a boo boo.
  -#  n.b.  the (") marks it as text, it does not get output
  +#ErrorDocument 500 "The server made a boo boo."
   #
   #    2) local redirects
   #ErrorDocument 404 /missing.html
   #  to redirect to local URL /missing.html
  -#ErrorDocument 404 /cgi-bin/missing_handler.pl
  +#ErrorDocument 404 "/cgi-bin/missing_handlder.pl"
  +#    i.e. any string which starts with a '/' and has
  +#    no spaces. 
   #  N.B.: You can redirect to a script or a document using server-side-includes.
   #
   #    3) external redirects
   #ErrorDocument 402 http://some.other_server.com/subscription_info.html
  +#    i.e. any string whichis a valid  URL.
   #  N.B.: Many of the environment variables associated with the original
   #  request will *not* be available to such a script.
  -
  +#
  +#    4) borderline case
  +#ErrorDocument 402 "http://some.other_server.com/info.html is the place to look"
  +#    treated as case '1' as it has spaces and thus is not a valid URL
   #
   # The following directives modify normal HTTP response behavior.
   # The first directive disables keepalive for Netscape 2.x and browsers that
  
  
  
  1.2       +9 -4      apache-2.0/conf/httpd.conf-dist-win
  
  Index: httpd.conf-dist-win
  ===================================================================
  RCS file: /home/cvs/apache-2.0/conf/httpd.conf-dist-win,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- httpd.conf-dist-win	1999/08/24 05:33:46	1.1
  +++ httpd.conf-dist-win	2000/03/14 13:32:07	1.2
  @@ -655,20 +655,25 @@
   #  these come in three flavors
   #
   #    1) plain text
  -#ErrorDocument 500 "The server made a boo boo.
  -#  n.b.  the (") marks it as text, it does not get output
  +#ErrorDocument 500 "The server made a boo boo."
   #
   #    2) local redirects
   #ErrorDocument 404 /missing.html
   #  to redirect to local URL /missing.html
  -#ErrorDocument 404 /cgi-bin/missing_handler.pl
  +#ErrorDocument 404 "/cgi-bin/missing_handlder.pl"
  +#    i.e. any string which starts with a '/' and has
  +#    no spaces.
   #  N.B.: You can redirect to a script or a document using server-side-includes.
   #
   #    3) external redirects
   #ErrorDocument 402 http://some.other_server.com/subscription_info.html
  +#    i.e. any string whichis a valid  URL.
   #  N.B.: Many of the environment variables associated with the original
   #  request will *not* be available to such a script.
  -
  +#
  +#    4) borderline case
  +#ErrorDocument 402 "http://some.other_server.com/info.html is the place to look"
  +#    treated as case '1' as it has spaces and thus is not a valid URL
   #
   # The following directives disable keepalives and HTTP header flushes.
   # The first directive disables it for Netscape 2.x and browsers which
  
  
  
  1.25      +21 -0     apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -u -r1.24 -r1.25
  --- CHANGES	2000/03/14 12:18:27	1.24
  +++ CHANGES	2000/03/14 13:32:07	1.25
  @@ -1,5 +1,26 @@
   Changes with Apache 2.0a2-dev
   
  +  *) Changed the 'ErrorDocument' syntax in that it NO longer
  +     supports the asymetric
  +
  +		ErrorDocument 301 "Some message
  +
  +     Note the opening " quote, without a closing quote. It now
  +     has either the following syntaxes
  +
  +		ErrorDocument XXX /local/uri
  +		ErrorDocument XXX http://valid/url
  +		ErrorDocument XXX "Some Message"
  +
  +     The recognition heuristic is: if it has a space it
  +     is a message. If it has no spaces and starts with a /
  +     or is a valid URL then treat it that way. Otherwise it
  +     is assumed to be a message.
  +
  +     This breaks backward compatibility but makes live a hell
  +     of a lot easier for GUI's and config file parsers.
  +     [Dirk-Willem van Gulik]
  +
     *) Changed 'CacheNegotiatedDocs' from its present/not-present
        syntax into a 'on' or 'off' syntax. As it currently is the
        only non nesting token which uses NO_ARGS and thus is an
  
  
  
  1.37      +23 -10    apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -u -r1.36 -r1.37
  --- http_core.c	2000/03/13 20:27:18	1.36
  +++ http_core.c	2000/03/14 13:32:08	1.37
  @@ -1080,9 +1080,10 @@
   }
   
   static const char *set_error_document(cmd_parms *cmd, core_dir_config *conf,
  -				      char *line)
  +				      char *errno_str, char *msg)
   {
       int error_number, index_number, idx500;
  +    enum { MSG, LOCAL_PATH, REMOTE_PATH } what = MSG;
       char *w;
                   
       const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
  @@ -1093,10 +1094,7 @@
       /* 1st parameter should be a 3 digit number, which we recognize;
        * convert it into an array index
        */
  -  
  -    w = ap_getword_conf_nc(cmd->pool, &line);
  -    error_number = atoi(w);
  -
  +    error_number = atoi(errno_str);
       idx500 = ap_index_of_response(HTTP_INTERNAL_SERVER_ERROR);
   
       if (error_number == HTTP_INTERNAL_SERVER_ERROR) {
  @@ -1104,13 +1102,22 @@
       }
       else if ((index_number = ap_index_of_response(error_number)) == idx500) {
           return ap_pstrcat(cmd->pool, "Unsupported HTTP response code ",
  -			  w, NULL);
  +			  errno_str, NULL);
       }
   
  +    /* Heuristic to determine second argument. */
  +    if (strchr(msg,' ')) 
  +	what = MSG;
  +    else if (msg[0] == '/')
  +	what = LOCAL_PATH;
  +    else if (ap_is_url(msg))
  +	what = REMOTE_PATH;
  +    else
  +        what = MSG;
  +   
       /* The entry should be ignored if it is a full URL for a 401 error */
   
  -    if (error_number == 401 &&
  -	line[0] != '/' && line[0] != '"') { /* Ignore it... */
  +    if (error_number == 401 && what == REMOTE_PATH) {
   	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, cmd->server,
   		     "cannot use a full URL in a 401 ErrorDocument "
   		     "directive --- ignoring!");
  @@ -1121,7 +1128,13 @@
   		ap_pcalloc(cmd->pool,
   			   sizeof(*conf->response_code_strings) * RESPONSE_CODES);
           }
  -        conf->response_code_strings[index_number] = ap_pstrdup(cmd->pool, line);
  +	/* hack. Prefix a " if it is a msg; as that is what
  +	 * http_protocol.c relies on to distinguish between
  +	 * a msg and a (local) path.
  +	 */
  +        conf->response_code_strings[index_number] = (what == MSG) ?
  +		ap_pstrcat(cmd->pool, "\"",msg,NULL) :
  +		ap_pstrdup(cmd->pool, msg);
       }   
   
       return NULL;
  @@ -2335,7 +2348,7 @@
     "Name(s) of per-directory config files (default: .htaccess)" },
   { "DocumentRoot", set_document_root, NULL, RSRC_CONF, TAKE1,
     "Root directory of the document tree"  },
  -{ "ErrorDocument", set_error_document, NULL, OR_FILEINFO, RAW_ARGS,
  +{ "ErrorDocument", set_error_document, NULL, OR_FILEINFO, TAKE2,
     "Change responses for HTTP errors" },
   { "AllowOverride", set_override, NULL, ACCESS_CONF, RAW_ARGS,
     "Controls what groups of directives can be configured by per-directory "