Ahh... So none of this is really needed then. At least, it should be reverted.
On Sep 17, 2013, at 3:10 PM, "Roy T. Fielding" <[email protected]> wrote: > Umm, 2616 hasn't been the spec-of-record for HTTP/1.1 for almost > six years. The current spec says > > If a Transfer-Encoding header field > is present in a request and the chunked transfer coding is not > the final encoding, the message body length cannot be determined > reliably; the server MUST respond with the 400 (Bad Request) > status code and then close the connection. > > http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-23#page-31 > > Note that this impacts the following bits in protocol.c > (because the filter doesn't know whether it is reading a > request or a response, so we have to check here): > > On Sep 17, 2013, at 11:37 AM, [email protected] wrote: > >> Modified: httpd/httpd/trunk/server/protocol.c >> URL: >> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1524161&r1=1524160&r2=1524161&view=diff >> ============================================================================== >> --- httpd/httpd/trunk/server/protocol.c (original) >> +++ httpd/httpd/trunk/server/protocol.c Tue Sep 17 18:37:18 2013 >> @@ -1091,6 +1091,8 @@ request_rec *ap_read_request(conn_rec *c >> } >> >> if (!r->assbackwards) { >> + const char *tenc, *clen; >> + >> ap_get_mime_headers_core(r, tmp_bb); >> if (r->status != HTTP_OK) { >> ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00567) >> @@ -1102,13 +1104,37 @@ request_rec *ap_read_request(conn_rec *c >> goto traceout; >> } >> >> - if (apr_table_get(r->headers_in, "Transfer-Encoding") >> - && apr_table_get(r->headers_in, "Content-Length")) { >> + if ((tenc = apr_table_get(r->headers_in, "Transfer-Encoding"))) { >> /* 2616 section 4.4, point 3: "if both Transfer-Encoding >> * and Content-Length are received, the latter MUST be >> - * ignored"; so unset it here to prevent any confusion >> - * later. */ >> - apr_table_unset(r->headers_in, "Content-Length"); >> + * ignored"; unless the former is "identity". So unset >> + * the one concerned here to prevent any confusion later. >> + */ >> + if ((clen = apr_table_get(r->headers_in, "Content-Length"))) { >> + if (strcasecmp(tenc, "chunked") == 0) { >> + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, >> APLOGNO(2537) >> + "client sent both Transfer-Encoding >> (chunked)" >> + " and Content-Length; using TE"); >> + apr_table_unset(r->headers_in, "Content-Length"); >> + } >> + else { >> + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, >> APLOGNO(2538) >> + "client sent identity or unknown >> Transfer-Encoding (%s);" >> + " using Content-Length", tenc); >> + apr_table_unset(r->headers_in, "Transfer-Encoding"); >> + } >> + } >> + else if (strcasecmp(tenc, "chunked") != 0) { >> + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(2539) >> + "client sent unknown Transfer-Encoding;" >> + " not implemented: %s", tenc); >> + r->status = HTTP_NOT_IMPLEMENTED; >> + ap_send_error_response(r, 0); >> + ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r); >> + ap_run_log_transaction(r); >> + apr_brigade_destroy(tmp_bb); >> + goto traceout; >> + } >> } >> } >> else { > > Almost done, > > ....Roy
