mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
[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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84998 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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_TYPE "text/x-server-parsed-html"
|
||||||
#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
|
#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
|
||||||
#define DIR_MAGIC_TYPE "httpd/unix-directory"
|
#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 LF 10
|
||||||
#define CR 13
|
#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):
|
/* Possible values for request_rec.read_body (set by handling module):
|
||||||
* REQUEST_NO_BODY Send 413 error if message has any body
|
* REQUEST_NO_BODY Send 413 error if message has any body
|
||||||
|
@@ -264,7 +264,7 @@ static int internal_byterange(int realreq, long *tlength, request_rec *r,
|
|||||||
if (!**r_range) {
|
if (!**r_range) {
|
||||||
if (r->byterange > 1) {
|
if (r->byterange > 1) {
|
||||||
if (realreq)
|
if (realreq)
|
||||||
ap_rvputs(r, "\015\012--", r->boundary, "--\015\012", NULL);
|
ap_rvputs(r, CRLF "--", r->boundary, "--" CRLF, NULL);
|
||||||
else
|
else
|
||||||
*tlength += 4 + strlen(r->boundary) + 4;
|
*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,
|
ap_snprintf(ts, sizeof(ts), "%ld-%ld/%ld", range_start, range_end,
|
||||||
r->clength);
|
r->clength);
|
||||||
if (realreq)
|
if (realreq)
|
||||||
ap_rvputs(r, "\015\012--", r->boundary, "\015\012Content-type: ",
|
ap_rvputs(r, CRLF "--", r->boundary, CRLF "Content-type: ",
|
||||||
ct, "\015\012Content-range: bytes ", ts, "\015\012\015\012",
|
ct, CRLF "Content-range: bytes ", ts, CRLF CRLF,
|
||||||
NULL);
|
NULL);
|
||||||
else
|
else
|
||||||
*tlength += 4 + strlen(r->boundary) + 16 + strlen(ct) + 23 +
|
*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,
|
API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r,
|
||||||
const char *fieldname, const char *fieldval)
|
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)
|
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 */
|
/* 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);
|
date = ap_palloc(r->pool, AP_RFC822_DATE_LEN);
|
||||||
ap_rfc822_date(date, r->request_time);
|
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);
|
ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
|
||||||
if (bs >= 255 && bs <= 257)
|
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.
|
/* 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 */
|
/* 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_table_do((int (*) (void *, const char *, const char *))
|
||||||
ap_send_header_field, (void *) r, r->headers_in, NULL);
|
ap_send_header_field, (void *) r, r->headers_in, NULL);
|
||||||
ap_rputs("\015\012", r);
|
ap_rputs(CRLF, r);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -1701,9 +1701,9 @@ API_EXPORT(void) ap_finalize_request_protocol(request_rec *r)
|
|||||||
r->chunked = 0;
|
r->chunked = 0;
|
||||||
ap_bsetflag(r->connection->client, B_CHUNK, 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 */
|
/* 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)) {
|
if (r->expecting_100 && r->proto_num >= HTTP_VERSION(1,1)) {
|
||||||
/* sending 100 Continue interim response */
|
/* 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);
|
NULL);
|
||||||
ap_rflush(r);
|
ap_rflush(r);
|
||||||
}
|
}
|
||||||
@@ -2690,8 +2690,8 @@ API_EXPORT(void) ap_send_error_response(request_rec *r, int recursive_error)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BAD_GATEWAY:
|
case BAD_GATEWAY:
|
||||||
ap_rputs("The proxy server received an invalid\015\012"
|
ap_rputs("The proxy server received an invalid" CRLF
|
||||||
"response from an upstream server.<P>\015\012", r);
|
"response from an upstream server.<P>" CRLF, r);
|
||||||
if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) {
|
if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) {
|
||||||
ap_rvputs(r, error_notes, "<P>\n", NULL);
|
ap_rvputs(r, error_notes, "<P>\n", NULL);
|
||||||
}
|
}
|
||||||
|
@@ -129,13 +129,6 @@ enum enctype {
|
|||||||
/* maximum 'CacheDirLevels*CacheDirLength' value */
|
/* maximum 'CacheDirLevels*CacheDirLength' value */
|
||||||
#define CACHEFILE_LEN 20 /* must be less than HASH_LEN/2 */
|
#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_DAY 86400 /* one day, in seconds */
|
||||||
#define SEC_ONE_HR 3600 /* one hour, in seconds */
|
#define SEC_ONE_HR 3600 /* one hour, in seconds */
|
||||||
|
|
||||||
|
@@ -179,7 +179,7 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
|
|||||||
i = 0;
|
i = 0;
|
||||||
memset(buffer, '\0', sizeof(buffer));
|
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.
|
* this allows it to work on both ASCII and EBCDIC machines.
|
||||||
*/
|
*/
|
||||||
while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) {
|
while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) {
|
||||||
|
@@ -487,8 +487,12 @@ API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
|
|||||||
/* Delete terminal (CR?)LF */
|
/* Delete terminal (CR?)LF */
|
||||||
|
|
||||||
p = strlen(w);
|
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 > 0 && w[p - 1] == '\n') {
|
||||||
if (p > 1 && w[p - 2] == '\015') {
|
if (p > 1 && w[p - 2] == CR) {
|
||||||
w[p - 2] = '\0';
|
w[p - 2] = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user