MCPcopy Create free account
hub / github.com/apache/trafficserver / do_drain_request_body

Method do_drain_request_body

src/proxy/http/HttpSM.cc:6271–6298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6269}
6270
6271void
6272HttpSM::do_drain_request_body(HTTPHdr &response)
6273{
6274 int64_t content_length = t_state.hdr_info.client_request.get_content_length();
6275 int64_t avail = _ua.get_txn()->get_remote_reader()->read_avail();
6276
6277 if (t_state.client_info.transfer_encoding == HttpTransact::CHUNKED_ENCODING) {
6278 SMDbg(dbg_ctl_http, "Chunked body, setting the response to non-keepalive");
6279 goto close_connection;
6280 }
6281
6282 if (content_length > 0) {
6283 if (avail >= content_length) {
6284 SMDbg(dbg_ctl_http, "entire body is in the buffer, consuming");
6285 int64_t act_on = (avail < content_length) ? avail : content_length;
6286 client_request_body_bytes = act_on;
6287 _ua.get_txn()->get_remote_reader()->consume(act_on);
6288 } else {
6289 SMDbg(dbg_ctl_http, "entire body is not in the buffer, setting the response to non-keepalive");
6290 goto close_connection;
6291 }
6292 }
6293 return;
6294
6295close_connection:
6296 t_state.client_info.keep_alive = HTTP_NO_KEEPALIVE;
6297 _ua.get_txn()->set_close_connection(response);
6298}
6299
6300void
6301HttpSM::do_setup_client_request_body_tunnel(HttpVC_t to_vc_type)

Callers

nothing calls this directly

Calls 6

get_content_lengthMethod · 0.80
get_txnMethod · 0.80
read_availMethod · 0.45
get_remote_readerMethod · 0.45
consumeMethod · 0.45
set_close_connectionMethod · 0.45

Tested by

no test coverage detected