MCPcopy Create free account
hub / github.com/apache/httpd / submit_stream

Function submit_stream

modules/http2/h2_proxy_session.c:936–982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

934}
935
936static apr_status_t submit_stream(h2_proxy_session *session, h2_proxy_stream *stream)
937{
938 h2_proxy_ngheader *hd;
939 nghttp2_data_provider *pp = NULL;
940 nghttp2_data_provider provider;
941 int rv, may_have_request_body = 1;
942 apr_status_t status;
943
944 hd = h2_proxy_util_nghd_make_req(stream->pool, stream->req);
945
946 /* If we expect a 100-continue response, we must refrain from reading
947 any input until we get it. Reading the input will possibly trigger
948 HTTP_IN filter to generate the 100-continue itself. */
949 if (stream->waiting_on_100 || stream->waiting_on_ping) {
950 /* make a small test if we get an EOF/EOS immediately */
951 status = ap_get_brigade(stream->r->input_filters, stream->input,
952 AP_MODE_READBYTES, APR_NONBLOCK_READ,
953 APR_BUCKET_BUFF_SIZE);
954 may_have_request_body = APR_STATUS_IS_EAGAIN(status)
955 || (status == APR_SUCCESS
956 && !APR_BUCKET_IS_EOS(APR_BRIGADE_FIRST(stream->input)));
957 }
958
959 if (may_have_request_body) {
960 provider.source.fd = 0;
961 provider.source.ptr = NULL;
962 provider.read_callback = stream_request_data;
963 pp = &provider;
964 }
965
966 rv = nghttp2_submit_request(session->ngh2, NULL,
967 hd->nv, hd->nvlen, pp, stream);
968
969 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, stream->cfront, APLOGNO(03363)
970 "h2_proxy_session(%s): submit %s%s -> %d",
971 session->id, stream->req->authority, stream->req->path,
972 rv);
973 if (rv > 0) {
974 stream->id = rv;
975 stream->state = H2_STREAM_ST_OPEN;
976 h2_proxy_ihash_add(session->streams, stream);
977 dispatch_event(session, H2_PROXYS_EV_STREAM_SUBMITTED, rv, NULL);
978
979 return APR_SUCCESS;
980 }
981 return APR_EGENERAL;
982}
983
984static apr_status_t submit_trailers(h2_proxy_stream *stream)
985{

Callers 1

h2_proxy_session_submitFunction · 0.85

Calls 4

ap_get_brigadeFunction · 0.85
h2_proxy_ihash_addFunction · 0.85
dispatch_eventFunction · 0.85

Tested by

no test coverage detected