From 6d89d14d4e7846c9f17df77cf38e3c020112b2ca Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Fri, 3 Nov 2000 17:34:59 +0000 Subject: [PATCH] Remove REQUEST_CHUNKED_PASS and change ap_discard_request_body() to use REQUEST_CHUNKED_DECHUNK. Because of this change, the need for handle_request_body() is gone, so we remove that as well. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86827 13f79535-47bb-0310-9956-ffa450edef68 --- include/http_protocol.h | 1 - include/httpd.h | 2 -- modules/http/http_core.c | 25 +------------------------ modules/http/http_protocol.c | 9 +-------- 4 files changed, 2 insertions(+), 35 deletions(-) diff --git a/include/http_protocol.h b/include/http_protocol.h index fe2c9a4ac0..953ab92bdd 100644 --- a/include/http_protocol.h +++ b/include/http_protocol.h @@ -388,7 +388,6 @@ AP_DECLARE(const char *) ap_get_status_line(int status); * REQUEST_NO_BODY Send 413 error if message has any body * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me. - * REQUEST_CHUNKED_PASS Pass the chunks to me without removal. * * @return either OK or an error code * @deffunc int ap_setup_cleint_block(request_rec *r, int read_policy) diff --git a/include/httpd.h b/include/httpd.h index 39682d72c1..12b62b63e3 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -540,12 +540,10 @@ struct ap_method_list_t { * REQUEST_NO_BODY Send 413 error if message has any body * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me. - * REQUEST_CHUNKED_PASS Pass the chunks to me without removal. */ #define REQUEST_NO_BODY 0 #define REQUEST_CHUNKED_ERROR 1 #define REQUEST_CHUNKED_DECHUNK 2 -#define REQUEST_CHUNKED_PASS 3 /* Things which may vary per file-lookup WITHIN a request --- * e.g., state of MIME config. Basically, the name of an object, info diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 2f9c985afa..6bbaa86257 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -2908,25 +2908,6 @@ AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r) static int do_nothing(request_rec *r) { return OK; } -#define POST_CHUNK_SIZE 4096 - -static int handle_request_body(request_rec *r) -{ - int rv; - char buf[POST_CHUNK_SIZE]; - long n; - - if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) - return rv; - - if ((rv = ap_should_client_block(r)) == 0) - return APR_SUCCESS; - - while ((n = ap_get_client_block(r, buf, POST_CHUNK_SIZE)) > 0); - - return APR_SUCCESS; -} - static int default_handler(request_rec *r) { core_dir_config *d = @@ -2949,11 +2930,7 @@ static int default_handler(request_rec *r) ap_allow_methods(r, MERGE_ALLOW, "GET", "OPTIONS", "POST", NULL); - if (r->method_number == M_POST) { - if ((errstatus = handle_request_body(r)) != APR_SUCCESS) { - return errstatus; - } - } else if ((errstatus = ap_discard_request_body(r)) != OK) { + if ((errstatus = ap_discard_request_body(r)) != OK) { return errstatus; } diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index a3aa5db38f..e987bd2c63 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -816,7 +816,6 @@ struct dechunk_ctx { apr_ssize_t chunk_size; apr_ssize_t bytes_delivered; enum {WANT_HDR /* must have value zero */, WANT_BODY, WANT_TRL} state; - int remove_chunk_proto; }; static long get_chunk_size(char *); @@ -833,7 +832,6 @@ apr_status_t ap_dechunk_filter(ap_filter_t *f, ap_bucket_brigade *bb, if (!ctx) { f->ctx = ctx = apr_pcalloc(f->r->pool, sizeof(struct dechunk_ctx)); - ctx->remove_chunk_proto = f->r->read_body != REQUEST_CHUNKED_PASS; } do { @@ -2487,7 +2485,6 @@ AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r) * REQUEST_NO_BODY Send 413 error if message has any body * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me. - * REQUEST_CHUNKED_PASS Pass the chunks to me without removal. * * In order to use the last two options, the caller MUST provide a buffer * large enough to hold a chunk-size line, including any extensions. @@ -2530,10 +2527,6 @@ AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy) } r->read_chunked = 1; - if (r->read_body == REQUEST_CHUNKED_PASS) { - /* can't filter the body *and* preserve the chunk headers */ - r->input_filters = r->connection->input_filters; - } ap_add_input_filter("DECHUNK", NULL, r, r->connection); } else if (lenp) { @@ -2718,7 +2711,7 @@ AP_DECLARE(int) ap_discard_request_body(request_rec *r) { int rv; - if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_PASS))) + if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) return rv; /* In order to avoid sending 100 Continue when we already know the -- 2.40.0