Lines 1113-1126
Link Here
|
1113 |
#if APR_CHARSET_EBCDIC |
1113 |
#if APR_CHARSET_EBCDIC |
1114 |
char *headfield; |
1114 |
char *headfield; |
1115 |
apr_size_t len; |
1115 |
apr_size_t len; |
1116 |
apr_size_t name_len; |
1116 |
apr_size_t name_len; |
1117 |
apr_size_t val_len; |
1117 |
apr_size_t val_len; |
1118 |
char *next; |
1118 |
char *next; |
1119 |
|
1119 |
|
|
|
1120 |
if (!fieldval) { |
1121 |
/* Header not set to anything useful; just skip it */ |
1122 |
return 1; |
1123 |
} |
1124 |
|
1120 |
name_len = strlen(fieldname); |
1125 |
name_len = strlen(fieldname); |
1121 |
val_len = strlen(fieldval); |
1126 |
val_len = strlen(fieldval); |
1122 |
len = name_len + val_len + 4; /* 4 for ": " plus CRLF */ |
1127 |
len = name_len + val_len + 4; /* 4 for ": " plus CRLF */ |
1123 |
headfield = (char *)apr_palloc(h->pool, len + 1); |
1128 |
headfield = (char *)apr_palloc(h->pool, len + 1); |
1124 |
memcpy(headfield, fieldname, name_len); |
1129 |
memcpy(headfield, fieldname, name_len); |
1125 |
next = headfield + name_len; |
1130 |
next = headfield + name_len; |
1126 |
*next++ = ':'; |
1131 |
*next++ = ':'; |
Lines 1131-1144
Link Here
|
1131 |
*next++ = LF; |
1136 |
*next++ = LF; |
1132 |
*next = 0; |
1137 |
*next = 0; |
1133 |
ap_xlate_proto_to_ascii(headfield, len); |
1138 |
ap_xlate_proto_to_ascii(headfield, len); |
1134 |
apr_brigade_write(h->bb, NULL, NULL, headfield, len); |
1139 |
apr_brigade_write(h->bb, NULL, NULL, headfield, len); |
1135 |
#else |
1140 |
#else |
1136 |
struct iovec vec[4]; |
1141 |
struct iovec vec[4]; |
1137 |
struct iovec *v = vec; |
1142 |
struct iovec *v = vec; |
|
|
1143 |
if (!fieldval) { |
1144 |
/* Header not set to anything useful; just skip it */ |
1145 |
return 1; |
1146 |
} |
1147 |
|
1138 |
v->iov_base = (void *)fieldname; |
1148 |
v->iov_base = (void *)fieldname; |
1139 |
v->iov_len = strlen(fieldname); |
1149 |
v->iov_len = strlen(fieldname); |
1140 |
v++; |
1150 |
v++; |
1141 |
v->iov_base = ": "; |
1151 |
v->iov_base = ": "; |
1142 |
v->iov_len = sizeof(": ") - 1; |
1152 |
v->iov_len = sizeof(": ") - 1; |
1143 |
v++; |
1153 |
v++; |
1144 |
v->iov_base = (void *)fieldval; |
1154 |
v->iov_base = (void *)fieldval; |
Lines 1495-1509
Link Here
|
1495 |
conn_rec *c = r->connection; |
1505 |
conn_rec *c = r->connection; |
1496 |
const char *clheader; |
1506 |
const char *clheader; |
1497 |
const char *protocol; |
1507 |
const char *protocol; |
1498 |
apr_bucket *e; |
1508 |
apr_bucket *e; |
1499 |
apr_bucket_brigade *b2; |
1509 |
apr_bucket_brigade *b2; |
1500 |
header_struct h; |
1510 |
header_struct h; |
1501 |
header_filter_ctx *ctx = f->ctx; |
1511 |
header_filter_ctx *ctx = f->ctx; |
1502 |
|
1512 |
const char * content_type; |
|
|
1513 |
|
1503 |
AP_DEBUG_ASSERT(!r->main); |
1514 |
AP_DEBUG_ASSERT(!r->main); |
1504 |
|
1515 |
|
1505 |
if (r->header_only) { |
1516 |
if (r->header_only) { |
1506 |
if (!ctx) { |
1517 |
if (!ctx) { |
1507 |
ctx = f->ctx = apr_pcalloc(r->pool, sizeof(header_filter_ctx)); |
1518 |
ctx = f->ctx = apr_pcalloc(r->pool, sizeof(header_filter_ctx)); |
1508 |
} |
1519 |
} |
1509 |
else if (ctx->headers_sent) { |
1520 |
else if (ctx->headers_sent) { |
Lines 1567-1582
Link Here
|
1567 |
ap_set_keepalive(r); |
1578 |
ap_set_keepalive(r); |
1568 |
|
1579 |
|
1569 |
if (r->chunked) { |
1580 |
if (r->chunked) { |
1570 |
apr_table_mergen(r->headers_out, "Transfer-Encoding", "chunked"); |
1581 |
apr_table_mergen(r->headers_out, "Transfer-Encoding", "chunked"); |
1571 |
apr_table_unset(r->headers_out, "Content-Length"); |
1582 |
apr_table_unset(r->headers_out, "Content-Length"); |
1572 |
} |
1583 |
} |
1573 |
|
1584 |
|
1574 |
apr_table_setn(r->headers_out, "Content-Type", |
1585 |
content_type = ap_make_content_type(r, r->content_type); |
1575 |
ap_make_content_type(r, r->content_type)); |
1586 |
if (content_type) { |
|
|
1587 |
apr_table_setn(r->headers_out, "Content-Type", content_type); |
1588 |
} |
1576 |
|
1589 |
|
1577 |
if (r->content_encoding) { |
1590 |
if (r->content_encoding) { |
1578 |
apr_table_setn(r->headers_out, "Content-Encoding", |
1591 |
apr_table_setn(r->headers_out, "Content-Encoding", |
1579 |
r->content_encoding); |
1592 |
r->content_encoding); |
1580 |
} |
1593 |
} |
1581 |
|
1594 |
|
1582 |
if (!apr_is_empty_array(r->content_languages)) { |
1595 |
if (!apr_is_empty_array(r->content_languages)) { |
Lines 2843-2858
Link Here
|
2843 |
ap_set_content_type(r, apr_pstrcat(r->pool, "multipart", |
2856 |
ap_set_content_type(r, apr_pstrcat(r->pool, "multipart", |
2844 |
use_range_x(r) ? "/x-" : "/", |
2857 |
use_range_x(r) ? "/x-" : "/", |
2845 |
"byteranges; boundary=", |
2858 |
"byteranges; boundary=", |
2846 |
ctx->boundary, NULL)); |
2859 |
ctx->boundary, NULL)); |
2847 |
|
2860 |
|
2848 |
ctx->bound_head = apr_pstrcat(r->pool, |
2861 |
ctx->bound_head = apr_pstrcat(r->pool, |
2849 |
CRLF "--", ctx->boundary, |
2862 |
CRLF "--", ctx->boundary, |
2850 |
CRLF "Content-type: ", |
2863 |
orig_ct ? CRLF "Content-type: " : "", |
2851 |
orig_ct, |
2864 |
orig_ct ? orig_ct : "", |
2852 |
CRLF "Content-range: bytes ", |
2865 |
CRLF "Content-range: bytes ", |
2853 |
NULL); |
2866 |
NULL); |
2854 |
ap_xlate_proto_to_ascii(ctx->bound_head, strlen(ctx->bound_head)); |
2867 |
ap_xlate_proto_to_ascii(ctx->bound_head, strlen(ctx->bound_head)); |
2855 |
} |
2868 |
} |
2856 |
} |
2869 |
} |
2857 |
|
2870 |
|
2858 |
/* We can't actually deal with byte-ranges until we have the whole brigade |
2871 |
/* We can't actually deal with byte-ranges until we have the whole brigade |