]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
[EBCDIC] Port Paul Gilmartin's CRLF patch from 1.3. This replaces most
authorJeff Trawick <trawick@apache.org>
Thu, 20 Apr 2000 14:36:01 +0000 (14:36 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 20 Apr 2000 14:36:01 +0000 (14:36 +0000)
of the \015, \012, and \015\012 constants with macros.
Submitted by: Greg Ames
Reviewed by: Jeff Trawick

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84998 13f79535-47bb-0310-9956-ffa450edef68

include/httpd.h
modules/http/http_protocol.c
modules/proxy/mod_proxy.h
server/rfc1413.c
server/util_script.c

index df0023cd7b716f4e059169b337f224f58f7bb720..bdea38affdac2f78a6d2f423b35d3b2685f17e9b 100644 (file)
@@ -514,9 +514,26 @@ API_EXPORT(const char *) ap_get_server_built(void);
 #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
index 9608ddd3435bdad1113f07da534282be81d6fdc7..925d00b54d6fc2e36b6c41c35b39a3f90504f180 100644 (file)
@@ -264,7 +264,7 @@ static int internal_byterange(int realreq, long *tlength, request_rec *r,
     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 @@ static int internal_byterange(int realreq, long *tlength, request_rec *r,
         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(int) ap_index_of_response(int status)
 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 @@ API_EXPORT(void) ap_basic_http_header(request_rec *r)
 
     /* 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 @@ static void terminate_header(request_rec *r)
 
     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 @@ API_EXPORT(int) ap_send_http_trace(request_rec *r)
 
     /* 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 @@ API_EXPORT(void) ap_finalize_request_protocol(request_rec *r)
         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 @@ API_EXPORT(int) ap_should_client_block(request_rec *r)
 
     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 @@ API_EXPORT(void) ap_send_error_response(request_rec *r, int recursive_error)
            }
            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);
            }
index 3c3350739476e727a36514212fbba75011444715..7d0a5753ea2855048f08395ac559f08aa1de2bd2 100644 (file)
@@ -129,13 +129,6 @@ enum enctype {
 /* 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 */
 
index 2a0fac3e196de995a198cd681afca3ccd9475a07..7dbf8252eaa82c5919376104b340e76d50d1ae92 100644 (file)
@@ -179,7 +179,7 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
     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) {
index 96d0796053c31fc4eb9be2c1299f048003c832e1..b6de51c5dcc792d3a79ff5af7fd09e578f3f5dc6 100644 (file)
@@ -487,8 +487,12 @@ API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
        /* 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 {