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

Method state_read_client_request_header

src/proxy/http/HttpSM.cc:531–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

529}
530
531int
532HttpSM::state_read_client_request_header(int event, void *data)
533{
534 STATE_ENTER(&HttpSM::state_read_client_request_header, event);
535
536 ink_assert(_ua.get_entry()->read_vio == (VIO *)data);
537 ink_assert(server_entry == nullptr);
538 ink_assert(server_txn == nullptr);
539
540 int bytes_used = 0;
541 ink_assert(_ua.get_entry()->eos == false);
542
543 NetVConnection *netvc = _ua.get_txn()->get_netvc();
544 if (!netvc && event != VC_EVENT_EOS) {
545 return 0;
546 }
547
548 switch (event) {
549 case VC_EVENT_READ_READY:
550 case VC_EVENT_READ_COMPLETE:
551 // More data to parse
552 break;
553
554 case VC_EVENT_EOS:
555 _ua.get_entry()->eos = true;
556 if ((client_request_hdr_bytes > 0) && is_transparent_passthrough_allowed() && (_ua.get_raw_buffer_reader() != nullptr)) {
557 break;
558 }
559 // Fall through
560 case VC_EVENT_ERROR:
561 case VC_EVENT_INACTIVITY_TIMEOUT:
562 case VC_EVENT_ACTIVE_TIMEOUT:
563 // The user agent is hosed. Close it &
564 // bail on the state machine
565 vc_table.cleanup_entry(_ua.get_entry());
566 _ua.set_entry(nullptr);
567 set_ua_abort(HttpTransact::ABORTED, event);
568 terminate_sm = true;
569 return 0;
570 }
571
572 // Reset the inactivity timeout if this is the first
573 // time we've been called. The timeout had been set to
574 // the accept timeout by the ProxyTransaction
575 //
576 if ((_ua.get_txn()->get_remote_reader()->read_avail() > 0) && (client_request_hdr_bytes == 0)) {
577 ATS_PROBE1(milestone_ua_first_read, sm_id);
578 milestones[TS_MILESTONE_UA_FIRST_READ] = ink_get_hrtime();
579 _ua.get_txn()->set_inactivity_timeout(HRTIME_SECONDS(t_state.txn_conf->transaction_no_activity_timeout_in));
580 }
581 /////////////////////
582 // tokenize header //
583 /////////////////////
584
585 ParseResult state = t_state.hdr_info.client_request.parse_req(&http_parser, _ua.get_txn()->get_remote_reader(), &bytes_used,
586 _ua.get_entry()->eos, t_state.http_config_param->strict_uri_parsing,
587 t_state.http_config_param->http_request_line_max_size,
588 t_state.http_config_param->http_hdr_field_max_size);

Callers

nothing calls this directly

Calls 15

ink_get_hrtimeFunction · 0.85
http_parser_clearFunction · 0.85
hdrtoken_index_to_wksFunction · 0.85
buffer_size_to_indexFunction · 0.85
free_MIOBufferFunction · 0.85
get_entryMethod · 0.80
get_txnMethod · 0.80
get_raw_buffer_readerMethod · 0.80
cleanup_entryMethod · 0.80
set_entryMethod · 0.80

Tested by

no test coverage detected