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

Function h2_stream_end_headers

modules/http2/h2_stream.c:864–998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862}
863
864apr_status_t h2_stream_end_headers(h2_stream *stream, int eos, size_t raw_bytes)
865{
866 apr_status_t status;
867 val_len_check_ctx ctx;
868 int is_http_or_https;
869 h2_request *req = stream->rtmp;
870
871 H2_STRM_ASSERT_MAGIC(stream, H2_STRM_MAGIC_OK);
872 status = h2_request_end_headers(req, stream->pool, raw_bytes);
873 if (APR_SUCCESS != status || req->http_status != H2_HTTP_STATUS_UNSET) {
874 goto cleanup;
875 }
876
877 /* keep on returning APR_SUCCESS for error responses, so that we
878 * send it and do not RST the stream.
879 */
880 set_policy_for(stream, req);
881
882 ctx.maxlen = stream->session->s->limit_req_fieldsize;
883 ctx.failed_key = NULL;
884 apr_table_do(table_check_val_len, &ctx, req->headers, NULL);
885 if (ctx.failed_key) {
886 if (!h2_stream_is_ready(stream)) {
887 ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, stream->session->c1,
888 H2_STRM_LOG(APLOGNO(10230), stream,"Request header exceeds "
889 "LimitRequestFieldSize: %.*s"),
890 (int)H2MIN(strlen(ctx.failed_key), 80), ctx.failed_key);
891 }
892 set_error_response(stream, HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE);
893 goto cleanup;
894 }
895
896 /* http(s) scheme. rfc7540, ch. 8.1.2.3:
897 * This [:path] pseudo-header field MUST NOT be empty for "http" or "https"
898 * URIs; "http" or "https" URIs that do not contain a path component
899 * MUST include a value of '/'. The exception to this rule is an
900 * OPTIONS request for an "http" or "https" URI that does not include
901 * a path component; these MUST include a ":path" pseudo-header field
902 * with a value of '*'
903 *
904 * All HTTP/2 requests MUST include exactly one valid value for the
905 * ":method", ":scheme", and ":path" pseudo-header fields, unless it is
906 * a CONNECT request.
907 */
908 is_http_or_https = (!req->scheme
909 || !(ap_cstr_casecmpn(req->scheme, "http", 4) != 0
910 || (req->scheme[4] != '\0'
911 && (apr_tolower(req->scheme[4]) != 's'
912 || req->scheme[5] != '\0'))));
913
914 /* CONNECT. rfc7540, ch. 8.3:
915 * In HTTP/2, the CONNECT method is used to establish a tunnel over a
916 * single HTTP/2 stream to a remote host for similar purposes. The HTTP
917 * header field mapping works as defined in Section 8.1.2.3 ("Request
918 * Pseudo-Header Fields"), with a few differences. Specifically:
919 * o The ":method" pseudo-header field is set to "CONNECT".
920 * o The ":scheme" and ":path" pseudo-header fields MUST be omitted.
921 * o The ":authority" pseudo-header field contains the host and port to

Callers 2

h2_stream_send_frameFunction · 0.85
h2_stream_recv_frameFunction · 0.85

Calls 8

h2_request_end_headersFunction · 0.85
set_policy_forFunction · 0.85
h2_stream_is_readyFunction · 0.85
set_error_responseFunction · 0.85
ap_cstr_casecmpnFunction · 0.85
ap_cstr_casecmpFunction · 0.85
ap_ssl_conn_is_sslFunction · 0.85
ap_escape_logitemFunction · 0.85

Tested by

no test coverage detected