Lines Matching refs:downstream
63 auto downstream = dconn->get_downstream(); in timeoutcb() local
64 auto upstream = downstream->get_upstream(); in timeoutcb()
66 auto &resp = downstream->response(); in timeoutcb()
78 void retry_downstream_connection(Downstream *downstream, in retry_downstream_connection() argument
80 auto upstream = downstream->get_upstream(); in retry_downstream_connection()
83 assert(!downstream->get_request_header_sent()); in retry_downstream_connection()
85 downstream->add_retry(); in retry_downstream_connection()
87 if (downstream->no_more_retry()) { in retry_downstream_connection()
92 downstream->pop_downstream_connection(); in retry_downstream_connection()
93 auto buf = downstream->get_request_buf(); in retry_downstream_connection()
99 auto ndconn = handler->get_downstream_connection(rv, downstream); in retry_downstream_connection()
103 if (downstream->attach_downstream_connection(std::move(ndconn)) != 0) { in retry_downstream_connection()
106 if (downstream->push_request_headers() == 0) { in retry_downstream_connection()
111 downstream->set_request_state(DownstreamState::CONNECT_FAIL); in retry_downstream_connection()
114 rv = upstream->on_downstream_abort_request_with_https_redirect(downstream); in retry_downstream_connection()
116 rv = upstream->on_downstream_abort_request(downstream, status_code); in retry_downstream_connection()
137 auto downstream = dconn->get_downstream(); in connect_timeoutcb() local
139 retry_downstream_connection(downstream, 504); in connect_timeoutcb()
144 void backend_retry(Downstream *downstream) { in backend_retry() argument
145 retry_downstream_connection(downstream, 502); in backend_retry()
154 auto downstream = dconn->get_downstream(); in readcb() local
155 auto upstream = downstream->get_upstream(); in readcb()
161 backend_retry(downstream); in readcb()
175 auto downstream = dconn->get_downstream(); in writecb() local
176 auto upstream = downstream->get_upstream(); in writecb()
181 backend_retry(downstream); in writecb()
195 auto downstream = dconn->get_downstream(); in connectcb() local
197 backend_retry(downstream); in connectcb()
237 int HttpDownstreamConnection::attach_downstream(Downstream *downstream) { in attach_downstream() argument
241 DCLOG(INFO, this) << "Attaching to DOWNSTREAM:" << downstream; in attach_downstream()
244 downstream_ = downstream; in attach_downstream()
340 auto downstream = this->downstream_; in initiate_connection() local
341 backend_retry(downstream); in initiate_connection()
864 void HttpDownstreamConnection::detach_downstream(Downstream *downstream) { in detach_downstream() argument
866 DCLOG(INFO, this) << "Detaching from DOWNSTREAM:" << downstream; in detach_downstream()
909 auto downstream = static_cast<Downstream *>(htp->data); in htp_msg_begincb() local
911 if (downstream->get_response_state() != DownstreamState::INITIAL) { in htp_msg_begincb()
921 auto downstream = static_cast<Downstream *>(htp->data); in htp_hdrs_completecb() local
922 auto upstream = downstream->get_upstream(); in htp_hdrs_completecb()
924 const auto &req = downstream->request(); in htp_hdrs_completecb()
925 auto &resp = downstream->response(); in htp_hdrs_completecb()
928 auto &balloc = downstream->get_block_allocator(); in htp_hdrs_completecb()
947 auto dconn = downstream->get_downstream_connection(); in htp_hdrs_completecb()
949 downstream->set_downstream_addr_group(dconn->get_downstream_addr_group()); in htp_hdrs_completecb()
950 downstream->set_addr(dconn->get_addr()); in htp_hdrs_completecb()
979 downstream->set_response_state(DownstreamState::MSG_BAD_HEADER); in htp_hdrs_completecb()
985 downstream->check_upgrade_fulfilled_http1(); in htp_hdrs_completecb()
987 if (downstream->get_non_final_response()) { in htp_hdrs_completecb()
994 rv = upstream->on_downstream_header_complete(downstream); in htp_hdrs_completecb()
1005 downstream->set_response_state(DownstreamState::HEADER_COMPLETE); in htp_hdrs_completecb()
1006 downstream->inspect_http1_response(); in htp_hdrs_completecb()
1007 if (downstream->get_upgraded()) { in htp_hdrs_completecb()
1012 downstream->set_chunked_response(false); in htp_hdrs_completecb()
1017 downstream->set_chunked_response(false); in htp_hdrs_completecb()
1018 } else if (!downstream->expect_response_body()) { in htp_hdrs_completecb()
1019 downstream->set_chunked_response(false); in htp_hdrs_completecb()
1022 if (loggingconf.access.write_early && downstream->accesslog_ready()) { in htp_hdrs_completecb()
1023 handler->write_accesslog(downstream); in htp_hdrs_completecb()
1024 downstream->set_accesslog_written(true); in htp_hdrs_completecb()
1027 if (upstream->on_downstream_header_complete(downstream) != 0) { in htp_hdrs_completecb()
1031 if (downstream->get_upgraded()) { in htp_hdrs_completecb()
1033 if (upstream->resume_read(SHRPX_NO_BUFFER, downstream, 0) != 0) { in htp_hdrs_completecb()
1036 downstream->set_request_state(DownstreamState::HEADER_COMPLETE); in htp_hdrs_completecb()
1039 << downstream->get_stream_id(); in htp_hdrs_completecb()
1056 int ensure_header_field_buffer(const Downstream *downstream, in ensure_header_field_buffer() argument
1058 auto &resp = downstream->response(); in ensure_header_field_buffer()
1062 DLOG(INFO, downstream) << "Too large header header field size=" in ensure_header_field_buffer()
1073 int ensure_max_header_fields(const Downstream *downstream, in ensure_max_header_fields() argument
1075 auto &resp = downstream->response(); in ensure_max_header_fields()
1079 DLOG(INFO, downstream) in ensure_max_header_fields()
1091 auto downstream = static_cast<Downstream *>(htp->data); in htp_hdr_keycb() local
1092 auto &resp = downstream->response(); in htp_hdr_keycb()
1095 if (ensure_header_field_buffer(downstream, httpconf, len) != 0) { in htp_hdr_keycb()
1099 if (downstream->get_response_state() == DownstreamState::INITIAL) { in htp_hdr_keycb()
1103 if (ensure_max_header_fields(downstream, httpconf) != 0) { in htp_hdr_keycb()
1113 if (ensure_max_header_fields(downstream, httpconf) != 0) { in htp_hdr_keycb()
1128 auto downstream = static_cast<Downstream *>(htp->data); in htp_hdr_valcb() local
1129 auto &resp = downstream->response(); in htp_hdr_valcb()
1132 if (ensure_header_field_buffer(downstream, httpconf, len) != 0) { in htp_hdr_valcb()
1136 if (downstream->get_response_state() == DownstreamState::INITIAL) { in htp_hdr_valcb()
1147 auto downstream = static_cast<Downstream *>(htp->data); in htp_bodycb() local
1148 auto &resp = downstream->response(); in htp_bodycb()
1152 return downstream->get_upstream()->on_downstream_body( in htp_bodycb()
1153 downstream, reinterpret_cast<const uint8_t *>(data), len, true); in htp_bodycb()
1159 auto downstream = static_cast<Downstream *>(htp->data); in htp_msg_completecb() local
1160 auto &resp = downstream->response(); in htp_msg_completecb()
1161 auto &balloc = downstream->get_block_allocator(); in htp_msg_completecb()
1171 if (downstream->get_upgraded()) { in htp_msg_completecb()
1175 if (downstream->get_non_final_response()) { in htp_msg_completecb()
1176 downstream->reset_response(); in htp_msg_completecb()
1181 downstream->set_response_state(DownstreamState::MSG_COMPLETE); in htp_msg_completecb()
1185 downstream->pause_read(SHRPX_MSG_BLOCK); in htp_msg_completecb()
1186 return downstream->get_upstream()->on_downstream_body_complete(downstream); in htp_msg_completecb()