make proxy.config.http.request_buffer_enabled configurable and bug fix
This PR fixes issue #6021, #6022, #6023
diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 8176406..ea7dfb8 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1091,11 +1091,10 @@
.. ts:cv:: CONFIG proxy.config.http.request_buffer_enabled INT 0
:overridable:
- This is a configuration value that is overridable but not configurable. This is most likely an
- implementation error.
-
This enables buffering the content for incoming ``POST`` requests. If enabled no outbound
connection is made until the entire ``POST`` request has been buffered.
+ If enabled, `proxy.config.http.post_copy_size` needs to be set to the maximum of the post body
+ size allowed, otherwise, the post would fail.
.. ts:cv:: CONFIG proxy.config.http.request_line_max_size INT 65535
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index e31cdbb..62547c0 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -339,6 +339,8 @@
,
{RECT_CONFIG, "proxy.config.http.keep_alive_post_out", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
+ {RECT_CONFIG, "proxy.config.http.request_buffer_enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
+ ,
{RECT_CONFIG, "proxy.config.http.chunking_enabled", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.chunking.size", RECD_INT, "4096", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 8b7044e..43574d3 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -3477,12 +3477,10 @@
// server and close the ua
p->handler_state = HTTP_SM_POST_UA_FAIL;
set_ua_abort(HttpTransact::ABORTED, event);
-
+ p->vc->do_io_write(nullptr, 0, nullptr);
+ p->vc->do_io_shutdown(IO_SHUTDOWN_READ);
tunnel.chain_abort_all(p);
server_session = nullptr;
- p->read_vio = nullptr;
- p->vc->do_io_close(EHTTP_ERROR);
-
// the in_tunnel status on both the ua & and
// it's consumer must already be set to true. Previously
// we were setting it again to true but incorrectly in
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 2fbf7be..f5898f0 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -1118,7 +1118,7 @@
{
TxnDebug("http_trans", "START HttpTransact::HandleRequest");
- if (!s->state_machine->is_waiting_for_full_body) {
+ if (!s->state_machine->is_waiting_for_full_body && !s->state_machine->is_using_post_buffer) {
ink_assert(!s->hdr_info.server_request.valid());
HTTP_INCREMENT_DYN_STAT(http_incoming_requests_stat);