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

Method state_read_server_response_header

src/proxy/http/HttpSM.cc:1916–2096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1914}
1915
1916int
1917HttpSM::state_read_server_response_header(int event, void *data)
1918{
1919 STATE_ENTER(&HttpSM::state_read_server_response_header, event);
1920 // If we had already received EOS, just go away. We would sometimes see
1921 // a WRITE event appear after receiving EOS from the server connection
1922 if (server_entry->eos) {
1923 return 0;
1924 }
1925
1926 ink_assert(server_entry->eos != true);
1927 ink_assert(server_entry->read_vio == (VIO *)data);
1928 ink_assert(t_state.current.server->state == HttpTransact::STATE_UNDEFINED);
1929 ink_assert(t_state.current.state == HttpTransact::STATE_UNDEFINED);
1930
1931 int bytes_used = 0;
1932
1933 switch (event) {
1934 case VC_EVENT_EOS:
1935 server_entry->eos = true;
1936 // If we have received any bytes for this transaction do not retry
1937 if (server_response_hdr_bytes > 0) {
1938 t_state.current.retry_attempts.maximize(t_state.configured_connect_attempts_max_retries());
1939 }
1940 break;
1941
1942 case VC_EVENT_READ_READY:
1943 case VC_EVENT_READ_COMPLETE:
1944 // More data to parse
1945 break;
1946
1947 case VC_EVENT_ERROR:
1948 case VC_EVENT_INACTIVITY_TIMEOUT:
1949 case VC_EVENT_ACTIVE_TIMEOUT:
1950 // Error handling function
1951 handle_server_setup_error(event, data);
1952 return 0;
1953 }
1954
1955 // Reset the inactivity timeout if this is the first
1956 // time we've been called. The timeout had been set to
1957 // the connect timeout when we set up to read the header
1958 //
1959 if (server_response_hdr_bytes == 0) {
1960 ATS_PROBE1(milestone_server_first_read, sm_id);
1961 milestones[TS_MILESTONE_SERVER_FIRST_READ] = ink_get_hrtime();
1962
1963 server_txn->set_inactivity_timeout(get_server_inactivity_timeout());
1964
1965 // For requests that contain a body, we can cancel the ua inactivity timeout.
1966 if (_ua.get_txn() && _ua.get_txn()->has_request_body(t_state.hdr_info.request_content_length,
1967 t_state.client_info.transfer_encoding == HttpTransact::CHUNKED_ENCODING)) {
1968 _ua.get_txn()->cancel_inactivity_timeout();
1969 }
1970 }
1971 /////////////////////
1972 // tokenize header //
1973 /////////////////////

Callers

nothing calls this directly

Calls 15

disable_redirectMethod · 0.95
ink_get_hrtimeFunction · 0.85
http_parser_clearFunction · 0.85
maximizeMethod · 0.80
get_txnMethod · 0.80
version_getMethod · 0.80
is_tunnel_aliveMethod · 0.80
abort_tunnelMethod · 0.80
type_getMethod · 0.80
field_findMethod · 0.80
set_connect_failMethod · 0.80

Tested by

no test coverage detected