You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@kiwi.ICS.UCI.EDU> on 1997/01/23 22:35:04 UTC

[PATCH]: "ErrorDocument "somestring

> Date: Tue Jan 21 17:29:16 1997
> From: chris@i-planet.com
> To: apache-bugs%apache.org@organic.com
> Subject: [BUG]: "ErrorDocument "somestring -- outputs the " though
>                  it's not supposed to!" on FreeBSD

The code for ErrorDocument did not take into account the pre-1.2
changes to how index_of_response handles errors.  This patch fixes
that as well as removing the reported problem of stripping a trailing
double-quote character.

....Roy

Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.58
diff -c -r1.58 http_core.c
*** http_core.c	1997/01/20 04:28:08	1.58
--- http_core.c	1997/01/23 21:27:10
***************
*** 416,422 ****
  const char *set_error_document (cmd_parms *cmd, core_dir_config *conf,
  				char *line)
  {
!     int error_number, index_number;
      char *w;
                  
      /* 1st parameter should be a 3 digit number, which we recognize;
--- 416,422 ----
  const char *set_error_document (cmd_parms *cmd, core_dir_config *conf,
  				char *line)
  {
!     int error_number, index_number, idx500;
      char *w;
                  
      /* 1st parameter should be a 3 digit number, which we recognize;
***************
*** 425,439 ****
    
      w = getword_conf_nc (cmd->pool, &line);
      error_number = atoi(w);
!     index_number = index_of_response(error_number);
!   
!     if (index_number < 0)
!         return pstrcat (cmd->pool, "Illegal HTTP response code ", w, NULL);
                  
-     /* Nuke trailing '"', if present */
-     
-     if (line[strlen(line) - 1] == '"') line[strlen(line) - 1] = '\0';
-   
      /* Store it... */
  
      conf->response_code_strings[index_number] = pstrdup (cmd->pool, line);
--- 425,438 ----
    
      w = getword_conf_nc (cmd->pool, &line);
      error_number = atoi(w);
! 
!     idx500 = index_of_response(HTTP_INTERNAL_SERVER_ERROR);
! 
!     if (error_number == HTTP_INTERNAL_SERVER_ERROR)
!         index_number = idx500;
!     else if ((index_number = index_of_response(error_number)) == idx500)
!         return pstrcat(cmd->pool, "Unsupported HTTP response code ", w, NULL);
                  
      /* Store it... */
  
      conf->response_code_strings[index_number] = pstrdup (cmd->pool, line);

Re: [PATCH]: "ErrorDocument "somestring

Posted by Chuck Murcko <ch...@topsail.org>.
+1 also.

Dean Gaudet wrote:
> 
> +1
> 
> Dean
> 
> On Thu, 23 Jan 1997, Roy T. Fielding wrote:
> 
> > > Date: Tue Jan 21 17:29:16 1997
> > > From: chris@i-planet.com
> > > To: apache-bugs%apache.org@organic.com
> > > Subject: [BUG]: "ErrorDocument "somestring -- outputs the " though
> > >                  it's not supposed to!" on FreeBSD
> >
> > The code for ErrorDocument did not take into account the pre-1.2
> > changes to how index_of_response handles errors.  This patch fixes
> > that as well as removing the reported problem of stripping a trailing
> > double-quote character.
> >

-- 
chuck
Chuck Murcko
The Topsail Group, West Chester PA USA
chuck@topsail.org

Re: [PATCH]: "ErrorDocument "somestring

Posted by Dean Gaudet <dg...@arctic.org>.
+1

Dean

On Thu, 23 Jan 1997, Roy T. Fielding wrote:

> > Date: Tue Jan 21 17:29:16 1997
> > From: chris@i-planet.com
> > To: apache-bugs%apache.org@organic.com
> > Subject: [BUG]: "ErrorDocument "somestring -- outputs the " though
> >                  it's not supposed to!" on FreeBSD
> 
> The code for ErrorDocument did not take into account the pre-1.2
> changes to how index_of_response handles errors.  This patch fixes
> that as well as removing the reported problem of stripping a trailing
> double-quote character.
> 
> ....Roy
> 
> Index: http_core.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_core.c,v
> retrieving revision 1.58
> diff -c -r1.58 http_core.c
> *** http_core.c	1997/01/20 04:28:08	1.58
> --- http_core.c	1997/01/23 21:27:10
> ***************
> *** 416,422 ****
>   const char *set_error_document (cmd_parms *cmd, core_dir_config *conf,
>   				char *line)
>   {
> !     int error_number, index_number;
>       char *w;
>                   
>       /* 1st parameter should be a 3 digit number, which we recognize;
> --- 416,422 ----
>   const char *set_error_document (cmd_parms *cmd, core_dir_config *conf,
>   				char *line)
>   {
> !     int error_number, index_number, idx500;
>       char *w;
>                   
>       /* 1st parameter should be a 3 digit number, which we recognize;
> ***************
> *** 425,439 ****
>     
>       w = getword_conf_nc (cmd->pool, &line);
>       error_number = atoi(w);
> !     index_number = index_of_response(error_number);
> !   
> !     if (index_number < 0)
> !         return pstrcat (cmd->pool, "Illegal HTTP response code ", w, NULL);
>                   
> -     /* Nuke trailing '"', if present */
> -     
> -     if (line[strlen(line) - 1] == '"') line[strlen(line) - 1] = '\0';
> -   
>       /* Store it... */
>   
>       conf->response_code_strings[index_number] = pstrdup (cmd->pool, line);
> --- 425,438 ----
>     
>       w = getword_conf_nc (cmd->pool, &line);
>       error_number = atoi(w);
> ! 
> !     idx500 = index_of_response(HTTP_INTERNAL_SERVER_ERROR);
> ! 
> !     if (error_number == HTTP_INTERNAL_SERVER_ERROR)
> !         index_number = idx500;
> !     else if ((index_number = index_of_response(error_number)) == idx500)
> !         return pstrcat(cmd->pool, "Unsupported HTTP response code ", w, NULL);
>                   
>       /* Store it... */
>   
>       conf->response_code_strings[index_number] = pstrdup (cmd->pool, line);
>