httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grega...@apache.org
Subject cvs commit: httpd-2.0/modules/http http_protocol.c
Date Mon, 26 Feb 2001 22:07:05 GMT
gregames    01/02/26 14:07:04

  Modified:    include  util_ebcdic.h
               server   util_ebcdic.c
               modules/http http_protocol.c
  Log:
  insure that canned error msgs are translated to ascii before leaving
  an ebcdic server in worst case scenarios.
  
  Revision  Changes    Path
  1.12      +10 -0     httpd-2.0/include/util_ebcdic.h
  
  Index: util_ebcdic.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/util_ebcdic.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -d -b -u -r1.11 -r1.12
  --- util_ebcdic.h	2001/02/16 04:26:31	1.11
  +++ util_ebcdic.h	2001/02/26 22:06:50	1.12
  @@ -96,6 +96,14 @@
    */
   void ap_xlate_proto_from_ascii(char *buffer, apr_size_t len);
   
  +/**
  + * Convert protocol data from the implementation charater
  + * set to ASCII, then send it.
  + * @param r   the current request
  + * @param ... the strings to write, followed by a NULL pointer
  + */
  +int ap_rvputs_proto_in_ascii(request_rec *r, ...);
  +
   #ifdef __cplusplus
   }
   #endif
  @@ -104,6 +112,8 @@
   
   #define ap_xlate_proto_to_ascii(x,y)          /* NOOP */
   #define ap_xlate_proto_from_ascii(x,y)        /* NOOP */
  +
  +#define ap_rvputs_proto_in_ascii  ap_rvputs
   
   #endif  /* APR_CHARSET_EBCDIC */
       
  
  
  
  1.19      +24 -0     httpd-2.0/server/util_ebcdic.c
  
  Index: util_ebcdic.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_ebcdic.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -d -b -u -r1.18 -r1.19
  --- util_ebcdic.c	2001/02/16 04:26:48	1.18
  +++ util_ebcdic.c	2001/02/26 22:06:56	1.19
  @@ -141,4 +141,28 @@
                             buffer, &outbytes_left);
   }
   
  +int ap_rvputs_proto_in_ascii(request_rec *r, ...)
  +{
  +    va_list va;
  +    const char *s;
  +    char *ascii_s;
  +    apr_size_t len;
  +    apr_size_t written = 0;
  +
  +    va_start(va, r);
  +    while (1) {
  +        s = va_arg(va, const char *);
  +        if (s == NULL)
  +            break;
  +        len = strlen(s);
  +        ascii_s = apr_pstrndup(r->pool, s, len);
  +        ap_xlate_proto_to_ascii(ascii_s, len);
  +        if (ap_rputs(ascii_s, r) < 0)
  +            return -1;
  +        written += len;
  +    }
  +    va_end(va);
  + 
  +    return written;
  +}    
   #endif /* APR_CHARSET_EBCDIC */
  
  
  
  1.303     +11 -5     httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.302
  retrieving revision 1.303
  diff -u -d -b -u -r1.302 -r1.303
  --- http_protocol.c	2001/02/26 04:38:21	1.302
  +++ http_protocol.c	2001/02/26 22:07:00	1.303
  @@ -2043,22 +2043,28 @@
           /* folks decided they didn't want the error code in the H1 text */
           h1 = &title[4];
   
  -        ap_rvputs(rlast,
  +        /* can't count on a charset filter being in place here, 
  +         * so do ebcdic->ascii translation explicity (if needed)
  +         */
  +
  +        ap_rvputs_proto_in_ascii(rlast,
                     DOCTYPE_HTML_2_0
                     "<HTML><HEAD>\n<TITLE>", title,
                     "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",
                     NULL);
           
  -        ap_rputs(get_canned_error_string(status, r, location),rlast); 
  +        ap_rvputs_proto_in_ascii(rlast,
  +                                 get_canned_error_string(status, r, location),
  +                                 NULL); 
   
           if (recursive_error) {
  -            ap_rvputs(rlast, "<P>Additionally, a ",
  +            ap_rvputs_proto_in_ascii(rlast, "<P>Additionally, a ",
                         status_lines[ap_index_of_response(recursive_error)],
                         "\nerror was encountered while trying to use an "
                         "ErrorDocument to handle the request.\n", NULL);
           }
  -        ap_rputs(ap_psignature("<HR>\n", r), rlast);
  -        ap_rputs("</BODY></HTML>\n", rlast);
  +        ap_rvputs_proto_in_ascii(rlast, ap_psignature("<HR>\n", r), NULL);
  +        ap_rvputs_proto_in_ascii(rlast, "</BODY></HTML>\n", NULL);
       }
       ap_finalize_request_protocol(r);
   }
  
  
  

Mime
View raw message