You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/04/20 16:36:01 UTC

cvs commit: apache-2.0/src/modules/proxy mod_proxy.h

trawick     00/04/20 07:36:01

  Modified:    src      CHANGES
               src/include httpd.h
               src/main buff.c http_protocol.c rfc1413.c util_script.c
               src/modules/proxy mod_proxy.h
  Log:
  [EBCDIC] Port Paul Gilmartin's CRLF patch from 1.3.  This replaces most
  of the \015, \012, and \015\012 constants with macros.
  Submitted by:	Greg Ames
  Reviewed by:	Jeff Trawick
  
  Revision  Changes    Path
  1.75      +4 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- CHANGES	2000/04/20 02:03:10	1.74
  +++ CHANGES	2000/04/20 14:35:59	1.75
  @@ -1,5 +1,9 @@
   Changes with Apache 2.0a3-dev
   
  +  *) [EBCDIC] Port Paul Gilmartin's CRLF patch from 1.3.  This replaces most
  +     of the \015, \012, and \015\012 constants with macros.
  +     [Greg Ames <gr...@us.ibm.com>]
  +     
     *) Add ap_xlate_open() et al for translation of text between different 
        character sets.  The initial implementation requires iconv().
        [Jeff Trawick]
  
  
  
  1.40      +17 -0     apache-2.0/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- httpd.h	2000/04/19 16:20:07	1.39
  +++ httpd.h	2000/04/20 14:36:00	1.40
  @@ -514,9 +514,26 @@
   #define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
   #define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
   #define DIR_MAGIC_TYPE "httpd/unix-directory"
  +#ifdef CHARSET_EBCDIC
  +#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */
  +#endif /*CHARSET_EBCDIC*/         
   
  +/* Just in case your linefeed isn't the one the other end is expecting. */
  +#ifndef CHARSET_EBCDIC
   #define LF 10
   #define CR 13
  +#define CRLF "\015\012"
  +#else /* CHARSET_EBCDIC */
  +/* For platforms using the EBCDIC charset, the transition ASCII->EBCDIC is done
  + * in the buff package (bread/bputs/bwrite).  Everywhere else, we use
  + * "native EBCDIC" CR and NL characters. These are therefore
  + * defined as
  + * '\r' and '\n'.
  + */
  +#define CR '\r'
  +#define LF '\n'
  +#define CRLF "\r\n"
  +#endif /* CHARSET_EBCDIC */                                   
   
   /* Possible values for request_rec.read_body (set by handling module):
    *    REQUEST_NO_BODY          Send 413 error if message has any body
  
  
  
  1.37      +2 -2      apache-2.0/src/main/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/buff.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- buff.c	2000/04/14 15:58:55	1.36
  +++ buff.c	2000/04/20 14:36:00	1.37
  @@ -478,11 +478,11 @@
   	}
   
   	ch = fb->inptr[i++];
  -	if (ch == '\012') {	/* got LF */
  +	if (ch == LF) {	/* got LF */
   	    if (ct == 0)
   		buff[ct++] = '\n';
   /* if just preceeded by CR, replace CR with LF */
  -	    else if (buff[ct - 1] == '\015')
  +	    else if (buff[ct - 1] == CR)
   		buff[ct - 1] = '\n';
   	    else if (ct < n - 1)
   		buff[ct++] = '\n';
  
  
  
  1.63      +14 -14    apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- http_protocol.c	2000/04/14 17:38:14	1.62
  +++ http_protocol.c	2000/04/20 14:36:00	1.63
  @@ -264,7 +264,7 @@
       if (!**r_range) {
           if (r->byterange > 1) {
               if (realreq)
  -                ap_rvputs(r, "\015\012--", r->boundary, "--\015\012", NULL);
  +                ap_rvputs(r, CRLF "--", r->boundary, "--" CRLF, NULL);
               else
                   *tlength += 4 + strlen(r->boundary) + 4;
           }
  @@ -284,8 +284,8 @@
           ap_snprintf(ts, sizeof(ts), "%ld-%ld/%ld", range_start, range_end,
                       r->clength);
           if (realreq)
  -            ap_rvputs(r, "\015\012--", r->boundary, "\015\012Content-type: ",
  -                   ct, "\015\012Content-range: bytes ", ts, "\015\012\015\012",
  +            ap_rvputs(r, CRLF "--", r->boundary, CRLF "Content-type: ",
  +                   ct, CRLF "Content-range: bytes ", ts, CRLF CRLF,
                      NULL);
           else
               *tlength += 4 + strlen(r->boundary) + 16 + strlen(ct) + 23 +
  @@ -1342,7 +1342,7 @@
   API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r,
       const char *fieldname, const char *fieldval)
   {
  -    return (0 < ap_rvputs(r, fieldname, ": ", fieldval, "\015\012", NULL));
  +    return (0 < ap_rvputs(r, fieldname, ": ", fieldval, CRLF, NULL));
   }
   
   API_EXPORT(void) ap_basic_http_header(request_rec *r)
  @@ -1378,7 +1378,7 @@
   
       /* Output the HTTP/1.x Status-Line and the Date and Server fields */
   
  -    ap_rvputs(r, protocol, " ", r->status_line, "\015\012", NULL);
  +    ap_rvputs(r, protocol, " ", r->status_line, CRLF, NULL);
   
       date = ap_palloc(r->pool, AP_RFC822_DATE_LEN);
       ap_rfc822_date(date, r->request_time);
  @@ -1416,9 +1416,9 @@
   
       ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
       if (bs >= 255 && bs <= 257)
  -        ap_rputs("X-Pad: avoid browser bug\015\012", r);
  +        ap_rputs("X-Pad: avoid browser bug" CRLF, r);
   
  -    ap_rputs("\015\012", r);  /* Send the terminating empty line */
  +    ap_rputs(CRLF, r);  /* Send the terminating empty line */
   }
   
   /* Build the Allow field-value from the request handler method mask.
  @@ -1461,11 +1461,11 @@
   
       /* Now we recreate the request, and echo it back */
   
  -    ap_rvputs(r, r->the_request, "\015\012", NULL);
  +    ap_rvputs(r, r->the_request, CRLF, NULL);
   
       ap_table_do((int (*) (void *, const char *, const char *))
                   ap_send_header_field, (void *) r, r->headers_in, NULL);
  -    ap_rputs("\015\012", r);
  +    ap_rputs(CRLF, r);
   
       return OK;
   }
  @@ -1701,9 +1701,9 @@
           r->chunked = 0;
           ap_bsetflag(r->connection->client, B_CHUNK, 0);
   
  -        ap_rputs("0\015\012", r);
  +        ap_rputs("0" CRLF, r);
           /* If we had footer "headers", we'd send them now */
  -        ap_rputs("\015\012", r);
  +        ap_rputs(CRLF, r);
       }
   }
   
  @@ -1811,7 +1811,7 @@
   
       if (r->expecting_100 && r->proto_num >= HTTP_VERSION(1,1)) {
           /* sending 100 Continue interim response */
  -        ap_rvputs(r, AP_SERVER_PROTOCOL, " ", status_lines[0], "\015\012\015\012",
  +        ap_rvputs(r, AP_SERVER_PROTOCOL, " ", status_lines[0], CRLF CRLF,
                     NULL);
           ap_rflush(r);
       }
  @@ -2690,8 +2690,8 @@
   	    }
   	    break;
   	case BAD_GATEWAY:
  -	    ap_rputs("The proxy server received an invalid\015\012"
  -	             "response from an upstream server.<P>\015\012", r);
  +	    ap_rputs("The proxy server received an invalid" CRLF
  +	             "response from an upstream server.<P>" CRLF, r);
   	    if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) {
   		ap_rvputs(r, error_notes, "<P>\n", NULL);
   	    }
  
  
  
  1.14      +1 -1      apache-2.0/src/main/rfc1413.c
  
  Index: rfc1413.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/rfc1413.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- rfc1413.c	2000/03/31 08:44:20	1.13
  +++ rfc1413.c	2000/04/20 14:36:00	1.14
  @@ -179,7 +179,7 @@
       i = 0;
       memset(buffer, '\0', sizeof(buffer));
       /*
  -     * Note that the strchr function below checks for 10 instead of '\n'
  +     * Note that the strchr function below checks for \012 instead of '\n'
        * this allows it to work on both ASCII and EBCDIC machines.
        */
       while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) {
  
  
  
  1.30      +5 -1      apache-2.0/src/main/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_script.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- util_script.c	2000/04/14 15:58:57	1.29
  +++ util_script.c	2000/04/20 14:36:00	1.30
  @@ -487,8 +487,12 @@
   	/* Delete terminal (CR?)LF */
   
   	p = strlen(w);
  +	     /* Indeed, the host's '\n':
  +	        '\012' for UNIX; '\015' for MacOS; '\025' for OS/390
  +	         -- whatever the script generates.
  +	     */                                  
   	if (p > 0 && w[p - 1] == '\n') {
  -	    if (p > 1 && w[p - 2] == '\015') {
  +	    if (p > 1 && w[p - 2] == CR) {
   		w[p - 2] = '\0';
   	    }
   	    else {
  
  
  
  1.6       +0 -7      apache-2.0/src/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/mod_proxy.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_proxy.h	2000/04/14 15:59:05	1.5
  +++ mod_proxy.h	2000/04/20 14:36:01	1.6
  @@ -129,13 +129,6 @@
   /* maximum  'CacheDirLevels*CacheDirLength' value */
   #define CACHEFILE_LEN 20	/* must be less than HASH_LEN/2 */
   
  -#ifdef CHARSET_EBCDIC
  -#define CRLF   "\r\n"
  -#else /*CHARSET_EBCDIC*/
  -#define CRLF   "\015\012"
  -#endif /*CHARSET_EBCDIC*/
  -
  -
   #define	SEC_ONE_DAY		86400	/* one day, in seconds */
   #define	SEC_ONE_HR		3600	/* one hour, in seconds */