Lines Matching refs:http

81 static int check_pseudo_header(nghttp3_http_state *http,
83 if ((http->flags & flag) || nv->value->len == 0) {
86 http->flags |= flag;
90 static int expect_response_body(nghttp3_http_state *http) {
91 return (http->flags & NGHTTP3_HTTP_FLAG_METH_HEAD) == 0 &&
92 http->status_code / 100 != 1 && http->status_code != 304 &&
93 http->status_code != 204;
96 /* For "http" or "https" URIs, OPTIONS request may have "*" in :path
101 static int check_path_flags(nghttp3_http_state *http) {
102 return (http->flags & NGHTTP3_HTTP_FLAG_SCHEME_HTTP) == 0 ||
103 ((http->flags & NGHTTP3_HTTP_FLAG_PATH_REGULAR) ||
104 ((http->flags & NGHTTP3_HTTP_FLAG_METH_OPTIONS) &&
105 (http->flags & NGHTTP3_HTTP_FLAG_PATH_ASTERISK)));
824 static int http_request_on_header(nghttp3_http_state *http,
831 (http->flags & NGHTTP3_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED)) {
838 if (!check_pseudo_header(http, nv, NGHTTP3_HTTP_FLAG__AUTHORITY)) {
843 if (!check_pseudo_header(http, nv, NGHTTP3_HTTP_FLAG__METHOD)) {
849 http->flags |= NGHTTP3_HTTP_FLAG_METH_HEAD;
856 http->flags |= NGHTTP3_HTTP_FLAG_METH_CONNECT;
861 http->flags |= NGHTTP3_HTTP_FLAG_METH_OPTIONS;
869 if (!check_pseudo_header(http, nv, NGHTTP3_HTTP_FLAG__PATH)) {
873 http->flags |= NGHTTP3_HTTP_FLAG_PATH_REGULAR;
875 http->flags |= NGHTTP3_HTTP_FLAG_PATH_ASTERISK;
879 if (!check_pseudo_header(http, nv, NGHTTP3_HTTP_FLAG__SCHEME)) {
884 if (lstrieq("http", nv->value->base, nv->value->len) ||
886 http->flags |= NGHTTP3_HTTP_FLAG_SCHEME_HTTP;
894 if (!check_pseudo_header(http, nv, NGHTTP3_HTTP_FLAG__PROTOCOL)) {
899 if (!check_pseudo_header(http, nv, NGHTTP3_HTTP_FLAG_HOST)) {
911 if (http->content_length != -1) {
914 http->content_length = parse_uint(nv->value->base, nv->value->len);
915 if (http->content_length == -1) {
933 if (!trailers && !(http->flags & NGHTTP3_HTTP_FLAG_BAD_PRIORITY)) {
934 pri.urgency = nghttp3_pri_uint8_urgency(http->pri);
935 pri.inc = nghttp3_pri_uint8_inc(http->pri);
938 http->pri = nghttp3_pri_to_uint8(&pri);
939 http->flags |= NGHTTP3_HTTP_FLAG_PRIORITY;
941 http->flags &= ~NGHTTP3_HTTP_FLAG_PRIORITY;
942 http->flags |= NGHTTP3_HTTP_FLAG_BAD_PRIORITY;
955 static int http_response_on_header(nghttp3_http_state *http,
959 (http->flags & NGHTTP3_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED)) {
966 if (!check_pseudo_header(http, nv, NGHTTP3_HTTP_FLAG__STATUS)) {
972 http->status_code = (int16_t)parse_uint(nv->value->base, nv->value->len);
973 if (http->status_code < 100 || http->status_code == 101) {
986 if (http->status_code == 204) {
990 if (http->content_length != -1) {
997 http->content_length = 0;
1000 if (http->status_code / 100 == 1) {
1004 if (http->status_code / 100 == 2 &&
1005 (http->flags & NGHTTP3_HTTP_FLAG_METH_CONNECT)) {
1008 if (http->content_length != -1) {
1011 http->content_length = parse_uint(nv->value->base, nv->value->len);
1012 if (http->content_length == -1) {
1299 int nghttp3_http_on_header(nghttp3_http_state *http, nghttp3_qpack_nv *nv,
1319 http->flags |= NGHTTP3_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED;
1356 http->flags |= NGHTTP3_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED;
1361 rv = http_request_on_header(http, nv, trailers, connect_protocol);
1363 rv = http_response_on_header(http, nv, trailers);
1370 http->flags |= NGHTTP3_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED;
1378 int nghttp3_http_on_request_headers(nghttp3_http_state *http) {
1379 if (!(http->flags & NGHTTP3_HTTP_FLAG__PROTOCOL) &&
1380 (http->flags & NGHTTP3_HTTP_FLAG_METH_CONNECT)) {
1381 if ((http->flags & (NGHTTP3_HTTP_FLAG__SCHEME | NGHTTP3_HTTP_FLAG__PATH)) ||
1382 (http->flags & NGHTTP3_HTTP_FLAG__AUTHORITY) == 0) {
1385 http->content_length = -1;
1387 if ((http->flags & NGHTTP3_HTTP_FLAG_REQ_HEADERS) !=
1389 (http->flags &
1393 if ((http->flags & NGHTTP3_HTTP_FLAG__PROTOCOL) &&
1394 ((http->flags & NGHTTP3_HTTP_FLAG_METH_CONNECT) == 0 ||
1395 (http->flags & NGHTTP3_HTTP_FLAG__AUTHORITY) == 0)) {
1398 if (!check_path_flags(http)) {
1406 int nghttp3_http_on_response_headers(nghttp3_http_state *http) {
1407 if ((http->flags & NGHTTP3_HTTP_FLAG__STATUS) == 0) {
1411 if (http->status_code / 100 == 1) {
1413 http->flags = (http->flags & NGHTTP3_HTTP_FLAG_METH_ALL) |
1415 http->content_length = -1;
1416 http->status_code = -1;
1420 http->flags &= ~NGHTTP3_HTTP_FLAG_EXPECT_FINAL_RESPONSE;
1422 if (!expect_response_body(http)) {
1423 http->content_length = 0;
1424 } else if (http->flags & NGHTTP3_HTTP_FLAG_METH_CONNECT) {
1425 http->content_length = -1;
1432 if ((stream->rx.http.flags & NGHTTP3_HTTP_FLAG_EXPECT_FINAL_RESPONSE) ||
1433 (stream->rx.http.content_length != -1 &&
1434 stream->rx.http.content_length != stream->rx.http.recv_content_length)) {
1442 stream->rx.http.recv_content_length += (int64_t)n;
1444 if ((stream->rx.http.flags & NGHTTP3_HTTP_FLAG_EXPECT_FINAL_RESPONSE) ||
1445 (stream->rx.http.content_length != -1 &&
1446 stream->rx.http.recv_content_length > stream->rx.http.content_length)) {
1466 stream->rx.http.flags |= NGHTTP3_HTTP_FLAG_METH_CONNECT;
1470 stream->rx.http.flags |= NGHTTP3_HTTP_FLAG_METH_HEAD;