Lines Matching refs:client
41 static void print_http_frames(struct http_client_ctx *client) in print_http_frames() argument
55 struct http2_frame *frame = &client->current_frame; in print_http_frames()
67 struct http_client_ctx *client, uint32_t stream_id) in find_http_stream_context() argument
69 ARRAY_FOR_EACH(client->streams, i) { in find_http_stream_context()
70 if (client->streams[i].stream_id == stream_id) { in find_http_stream_context()
71 return &client->streams[i]; in find_http_stream_context()
79 struct http_client_ctx *client, uint32_t stream_id) in allocate_http_stream_context() argument
81 ARRAY_FOR_EACH(client->streams, i) { in allocate_http_stream_context()
82 if (client->streams[i].stream_state == HTTP2_STREAM_IDLE) { in allocate_http_stream_context()
83 client->streams[i].stream_id = stream_id; in allocate_http_stream_context()
84 client->streams[i].stream_state = HTTP2_STREAM_OPEN; in allocate_http_stream_context()
85 client->streams[i].window_size = in allocate_http_stream_context()
87 client->streams[i].headers_sent = false; in allocate_http_stream_context()
88 client->streams[i].end_stream_sent = false; in allocate_http_stream_context()
89 return &client->streams[i]; in allocate_http_stream_context()
96 static void release_http_stream_context(struct http_client_ctx *client, in release_http_stream_context() argument
99 ARRAY_FOR_EACH(client->streams, i) { in release_http_stream_context()
100 if (client->streams[i].stream_id == stream_id) { in release_http_stream_context()
101 client->streams[i].stream_id = 0; in release_http_stream_context()
102 client->streams[i].stream_state = HTTP2_STREAM_IDLE; in release_http_stream_context()
103 client->streams[i].current_detail = NULL; in release_http_stream_context()
109 static int add_header_field(struct http_client_ctx *client, uint8_t **buf, in add_header_field() argument
114 client->header_field.name = name; in add_header_field()
115 client->header_field.name_len = strlen(name); in add_header_field()
116 client->header_field.value = value; in add_header_field()
117 client->header_field.value_len = strlen(value); in add_header_field()
119 ret = http_hpack_encode_header(*buf, *buflen, &client->header_field); in add_header_field()
141 static int send_headers_frame(struct http_client_ctx *client, enum http_status status, in send_headers_frame() argument
160 ret = add_header_field(client, &buf, &buflen, ":status", status_str); in send_headers_frame()
176 ret = add_header_field(client, &buf, &buflen, hdr->name, hdr->value); in send_headers_frame()
183 ret = add_header_field(client, &buf, &buflen, "content-encoding", in send_headers_frame()
191 ret = add_header_field(client, &buf, &buflen, "content-type", in send_headers_frame()
204 ret = http_server_sendall(client, headers_frame, in send_headers_frame()
214 static int send_data_frame(struct http_client_ctx *client, const char *payload, in send_data_frame() argument
225 ret = http_server_sendall(client, frame_header, sizeof(frame_header)); in send_data_frame()
230 ret = http_server_sendall(client, payload, length); in send_data_frame()
240 int send_settings_frame(struct http_client_ctx *client, bool ack) in send_settings_frame() argument
274 ret = http_server_sendall(client, settings_frame, len); in send_settings_frame()
283 int send_window_update_frame(struct http_client_ctx *client, in send_window_update_frame() argument
297 window_update = HTTP_SERVER_INITIAL_WINDOW_SIZE - client->window_size; in send_window_update_frame()
298 client->window_size = HTTP_SERVER_INITIAL_WINDOW_SIZE; in send_window_update_frame()
308 ret = http_server_sendall(client, window_update_frame, in send_window_update_frame()
318 static int send_http2_404(struct http_client_ctx *client, in send_http2_404() argument
323 ret = send_headers_frame(client, HTTP_404_NOT_FOUND, frame->stream_identifier, NULL, 0, in send_http2_404()
330 ret = send_data_frame(client, content_404, sizeof(content_404), in send_http2_404()
340 static int send_http2_409(struct http_client_ctx *client, in send_http2_409() argument
345 ret = send_headers_frame(client, HTTP_409_CONFLICT, frame->stream_identifier, NULL, in send_http2_409()
356 struct http2_frame *frame, struct http_client_ctx *client) in handle_http2_static_resource() argument
366 if (client->current_stream == NULL) { in handle_http2_static_resource()
373 ret = send_headers_frame(client, HTTP_200_OK, frame->stream_identifier, in handle_http2_static_resource()
380 client->current_stream->headers_sent = true; in handle_http2_static_resource()
382 ret = send_data_frame(client, content_200, content_len, in handle_http2_static_resource()
390 client->current_stream->end_stream_sent = true; in handle_http2_static_resource()
398 struct http_client_ctx *client) in handle_http2_static_fs_resource() argument
420 if (client->current_stream == NULL) { in handle_http2_static_fs_resource()
425 len = strlen(client->url_buffer); in handle_http2_static_fs_resource()
430 http_server_get_content_type_from_extension(client->url_buffer, content_type, in handle_http2_static_fs_resource()
433 client->url_buffer); in handle_http2_static_fs_resource()
437 ret = http_server_find_file(fname, sizeof(fname), &client->data_len, &gzipped); in handle_http2_static_fs_resource()
441 ret = send_headers_frame(client, HTTP_404_NOT_FOUND, frame->stream_identifier, NULL, in handle_http2_static_fs_resource()
461 ret = send_headers_frame(client, HTTP_200_OK, frame->stream_identifier, &res_detail, 0, in handle_http2_static_fs_resource()
468 client->current_stream->headers_sent = true; in handle_http2_static_fs_resource()
471 remaining = client->data_len; in handle_http2_static_fs_resource()
480 ret = send_data_frame(client, tmp, len, frame->stream_identifier, in handle_http2_static_fs_resource()
488 client->current_stream->end_stream_sent = true; in handle_http2_static_fs_resource()
497 static int http2_dynamic_response(struct http_client_ctx *client, struct http2_frame *frame, in http2_dynamic_response() argument
505 if (client->current_stream->headers_sent && (rsp->header_count > 0 || rsp->status != 0)) { in http2_dynamic_response()
510 if (!client->current_stream->headers_sent) { in http2_dynamic_response()
529 client->current_stream->end_stream_sent = true; in http2_dynamic_response()
532 ret = send_headers_frame(client, rsp->status, frame->stream_identifier, in http2_dynamic_response()
539 client->current_stream->headers_sent = true; in http2_dynamic_response()
546 client->current_stream->end_stream_sent = true; in http2_dynamic_response()
549 ret = send_data_frame(client, rsp->body, rsp->body_len, frame->stream_identifier, in http2_dynamic_response()
560 struct http_client_ctx *client) in dynamic_get_del_req_v2() argument
564 struct http2_frame *frame = &client->current_frame; in dynamic_get_del_req_v2()
569 if (client->current_stream == NULL) { in dynamic_get_del_req_v2()
574 ptr = &client->url_buffer[dynamic_detail->common.path_len]; in dynamic_get_del_req_v2()
580 populate_request_ctx(&request_ctx, ptr, len, &client->header_capture_ctx); in dynamic_get_del_req_v2()
582 ret = dynamic_detail->cb(client, status, &request_ctx, &response_ctx, in dynamic_get_del_req_v2()
588 ret = http2_dynamic_response(client, frame, &response_ctx, status, dynamic_detail); in dynamic_get_del_req_v2()
597 if (!client->current_stream->end_stream_sent) { in dynamic_get_del_req_v2()
598 client->current_stream->end_stream_sent = true; in dynamic_get_del_req_v2()
599 ret = send_data_frame(client, NULL, 0, frame->stream_identifier, in dynamic_get_del_req_v2()
612 struct http_client_ctx *client, bool headers_only) in dynamic_post_put_req_v2() argument
615 char *ptr = client->cursor; in dynamic_post_put_req_v2()
618 struct http2_frame *frame = &client->current_frame; in dynamic_post_put_req_v2()
622 headers_only ? &client->header_capture_ctx : NULL; in dynamic_post_put_req_v2()
628 if (client->current_stream == NULL) { in dynamic_post_put_req_v2()
635 data_len = MIN(frame->length, client->data_len); in dynamic_post_put_req_v2()
637 client->cursor += data_len; in dynamic_post_put_req_v2()
638 client->data_len -= data_len; in dynamic_post_put_req_v2()
651 ret = dynamic_detail->cb(client, status, &request_ctx, &response_ctx, in dynamic_post_put_req_v2()
661 ret = http2_dynamic_response(client, frame, &response_ctx, status, dynamic_detail); in dynamic_post_put_req_v2()
672 ret = dynamic_detail->cb(client, status, &request_ctx, &response_ctx, in dynamic_post_put_req_v2()
678 ret = http2_dynamic_response(client, frame, &response_ctx, status, dynamic_detail); in dynamic_post_put_req_v2()
685 if (frame->length == 0 && !client->current_stream->end_stream_sent && in dynamic_post_put_req_v2()
687 if (client->current_stream->headers_sent) { in dynamic_post_put_req_v2()
688 ret = send_data_frame(client, NULL, 0, frame->stream_identifier, in dynamic_post_put_req_v2()
693 ret = http2_dynamic_response(client, frame, &response_ctx, in dynamic_post_put_req_v2()
701 client->current_stream->end_stream_sent = true; in dynamic_post_put_req_v2()
710 struct http2_frame *frame, struct http_client_ctx *client) in handle_http2_dynamic_resource() argument
721 if (!(BIT(client->method) & user_method)) { in handle_http2_dynamic_resource()
725 if (dynamic_detail->holder != NULL && dynamic_detail->holder != client) { in handle_http2_dynamic_resource()
726 ret = send_http2_409(client, frame); in handle_http2_dynamic_resource()
731 return enter_http_done_state(client); in handle_http2_dynamic_resource()
734 dynamic_detail->holder = client; in handle_http2_dynamic_resource()
736 switch (client->method) { in handle_http2_dynamic_resource()
739 if (user_method & BIT(client->method)) { in handle_http2_dynamic_resource()
740 return dynamic_get_del_req_v2(dynamic_detail, client); in handle_http2_dynamic_resource()
751 if (user_method & BIT(client->method)) { in handle_http2_dynamic_resource()
752 client->current_stream->current_detail = in handle_http2_dynamic_resource()
760 ret = dynamic_post_put_req_v2(dynamic_detail, client, true); in handle_http2_dynamic_resource()
773 http_method_str(client->method), in handle_http2_dynamic_resource()
774 client->method); in handle_http2_dynamic_resource()
782 int enter_http2_request(struct http_client_ctx *client) in enter_http2_request() argument
786 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in enter_http2_request()
787 client->data_len -= sizeof(HTTP2_PREFACE) - 1; in enter_http2_request()
788 client->cursor += sizeof(HTTP2_PREFACE) - 1; in enter_http2_request()
793 if (!client->preface_sent) { in enter_http2_request()
794 ret = send_settings_frame(client, false); in enter_http2_request()
799 client->preface_sent = true; in enter_http2_request()
805 static int enter_http_frame_settings_state(struct http_client_ctx *client) in enter_http_frame_settings_state() argument
807 client->server_state = HTTP_SERVER_FRAME_SETTINGS_STATE; in enter_http_frame_settings_state()
812 static int enter_http_frame_data_state(struct http_client_ctx *client) in enter_http_frame_data_state() argument
814 struct http2_frame *frame = &client->current_frame; in enter_http_frame_data_state()
822 stream = find_http_stream_context(client, frame->stream_identifier); in enter_http_frame_data_state()
837 client->window_size -= frame->length; in enter_http_frame_data_state()
838 client->server_state = HTTP_SERVER_FRAME_DATA_STATE; in enter_http_frame_data_state()
839 client->current_stream = stream; in enter_http_frame_data_state()
844 static int enter_http_frame_headers_state(struct http_client_ctx *client) in enter_http_frame_headers_state() argument
846 struct http2_frame *frame = &client->current_frame; in enter_http_frame_headers_state()
849 stream = find_http_stream_context(client, frame->stream_identifier); in enter_http_frame_headers_state()
853 stream = allocate_http_stream_context(client, frame->stream_identifier); in enter_http_frame_headers_state()
861 client->current_stream = stream; in enter_http_frame_headers_state()
864 client->expect_continuation = true; in enter_http_frame_headers_state()
866 client->expect_continuation = false; in enter_http_frame_headers_state()
871 client->header_capture_ctx.count = 0; in enter_http_frame_headers_state()
872 client->header_capture_ctx.cursor = 0; in enter_http_frame_headers_state()
873 client->header_capture_ctx.status = HTTP_HEADER_STATUS_OK; in enter_http_frame_headers_state()
874 client->header_capture_ctx.current_stream = stream; in enter_http_frame_headers_state()
877 client->server_state = HTTP_SERVER_FRAME_HEADERS_STATE; in enter_http_frame_headers_state()
882 static int enter_http_frame_continuation_state(struct http_client_ctx *client) in enter_http_frame_continuation_state() argument
884 struct http2_frame *frame = &client->current_frame; in enter_http_frame_continuation_state()
887 client->expect_continuation = true; in enter_http_frame_continuation_state()
889 client->expect_continuation = false; in enter_http_frame_continuation_state()
892 client->server_state = HTTP_SERVER_FRAME_CONTINUATION_STATE; in enter_http_frame_continuation_state()
897 static int enter_http_frame_window_update_state(struct http_client_ctx *client) in enter_http_frame_window_update_state() argument
899 client->server_state = HTTP_SERVER_FRAME_WINDOW_UPDATE_STATE; in enter_http_frame_window_update_state()
904 static int enter_http_frame_priority_state(struct http_client_ctx *client) in enter_http_frame_priority_state() argument
906 client->server_state = HTTP_SERVER_FRAME_PRIORITY_STATE; in enter_http_frame_priority_state()
911 static int enter_http_frame_rst_stream_state(struct http_client_ctx *client) in enter_http_frame_rst_stream_state() argument
913 client->server_state = HTTP_SERVER_FRAME_RST_STREAM_STATE; in enter_http_frame_rst_stream_state()
918 static int enter_http_frame_goaway_state(struct http_client_ctx *client) in enter_http_frame_goaway_state() argument
920 client->server_state = HTTP_SERVER_FRAME_GOAWAY_STATE; in enter_http_frame_goaway_state()
925 int handle_http_frame_header(struct http_client_ctx *client) in handle_http_frame_header() argument
931 ret = parse_http_frame_header(client, client->cursor, client->data_len); in handle_http_frame_header()
936 client->cursor += HTTP2_FRAME_HEADER_SIZE; in handle_http_frame_header()
937 client->data_len -= HTTP2_FRAME_HEADER_SIZE; in handle_http_frame_header()
939 print_http_frames(client); in handle_http_frame_header()
941 if (client->expect_continuation && in handle_http_frame_header()
942 client->current_frame.type != HTTP2_CONTINUATION_FRAME) { in handle_http_frame_header()
947 client->current_stream = NULL; in handle_http_frame_header()
949 switch (client->current_frame.type) { in handle_http_frame_header()
951 return enter_http_frame_data_state(client); in handle_http_frame_header()
953 return enter_http_frame_headers_state(client); in handle_http_frame_header()
955 return enter_http_frame_continuation_state(client); in handle_http_frame_header()
957 return enter_http_frame_settings_state(client); in handle_http_frame_header()
959 return enter_http_frame_window_update_state(client); in handle_http_frame_header()
961 return enter_http_frame_rst_stream_state(client); in handle_http_frame_header()
963 return enter_http_frame_goaway_state(client); in handle_http_frame_header()
965 return enter_http_frame_priority_state(client); in handle_http_frame_header()
967 return enter_http_done_state(client); in handle_http_frame_header()
976 int handle_http1_to_http2_upgrade(struct http_client_ctx *client) in handle_http1_to_http2_upgrade() argument
983 struct http2_frame *frame = &client->current_frame; in handle_http1_to_http2_upgrade()
995 frame->length = client->http1_frag_data_len; in handle_http1_to_http2_upgrade()
996 if (client->parser_state == HTTP1_MESSAGE_COMPLETE_STATE) { in handle_http1_to_http2_upgrade()
1003 stream = find_http_stream_context(client, frame->stream_identifier); in handle_http1_to_http2_upgrade()
1005 stream = allocate_http_stream_context(client, frame->stream_identifier); in handle_http1_to_http2_upgrade()
1012 client->current_stream = stream; in handle_http1_to_http2_upgrade()
1014 if (!client->preface_sent) { in handle_http1_to_http2_upgrade()
1015 ret = http_server_sendall(client, switching_protocols, in handle_http1_to_http2_upgrade()
1024 ret = send_settings_frame(client, false); in handle_http1_to_http2_upgrade()
1029 client->preface_sent = true; in handle_http1_to_http2_upgrade()
1032 detail = get_resource_detail(client->url_buffer, &path_len, false); in handle_http1_to_http2_upgrade()
1039 frame, client); in handle_http1_to_http2_upgrade()
1045 (struct http_resource_detail_static_fs *)detail, frame, client); in handle_http1_to_http2_upgrade()
1052 frame, client); in handle_http1_to_http2_upgrade()
1057 if (client->method == HTTP_POST || in handle_http1_to_http2_upgrade()
1058 client->method == HTTP_PUT || in handle_http1_to_http2_upgrade()
1059 client->method == HTTP_PATCH) { in handle_http1_to_http2_upgrade()
1061 (struct http_resource_detail_dynamic *)detail, client, in handle_http1_to_http2_upgrade()
1070 ret = send_http2_404(client, frame); in handle_http1_to_http2_upgrade()
1079 if (client->parser_state == HTTP1_MESSAGE_COMPLETE_STATE) { in handle_http1_to_http2_upgrade()
1080 release_http_stream_context(client, frame->stream_identifier); in handle_http1_to_http2_upgrade()
1081 client->current_detail = NULL; in handle_http1_to_http2_upgrade()
1082 client->server_state = HTTP_SERVER_PREFACE_STATE; in handle_http1_to_http2_upgrade()
1083 client->cursor += client->data_len; in handle_http1_to_http2_upgrade()
1084 client->data_len = 0; in handle_http1_to_http2_upgrade()
1093 static int parse_http_frame_padded_field(struct http_client_ctx *client) in parse_http_frame_padded_field() argument
1095 struct http2_frame *frame = &client->current_frame; in parse_http_frame_padded_field()
1097 if (client->data_len == 0) { in parse_http_frame_padded_field()
1101 frame->padding_len = *client->cursor; in parse_http_frame_padded_field()
1102 client->cursor++; in parse_http_frame_padded_field()
1103 client->data_len--; in parse_http_frame_padded_field()
1124 static int parse_http_frame_priority_field(struct http_client_ctx *client) in parse_http_frame_priority_field() argument
1126 struct http2_frame *frame = &client->current_frame; in parse_http_frame_priority_field()
1128 if (client->data_len < HTTP2_HEADERS_FRAME_PRIORITY_LEN) { in parse_http_frame_priority_field()
1135 client->cursor += HTTP2_HEADERS_FRAME_PRIORITY_LEN; in parse_http_frame_priority_field()
1136 client->data_len -= HTTP2_HEADERS_FRAME_PRIORITY_LEN; in parse_http_frame_priority_field()
1147 int handle_http_frame_data(struct http_client_ctx *client) in handle_http_frame_data() argument
1149 struct http2_frame *frame = &client->current_frame; in handle_http_frame_data()
1154 if (client->current_stream->current_detail == NULL) { in handle_http_frame_data()
1157 (void)send_http2_404(client, frame); in handle_http_frame_data()
1162 ret = parse_http_frame_padded_field(client); in handle_http_frame_data()
1169 (struct http_resource_detail_dynamic *)client->current_stream->current_detail, in handle_http_frame_data()
1170 client, false); in handle_http_frame_data()
1172 ret = send_http2_404(client, frame); in handle_http_frame_data()
1181 find_http_stream_context(client, frame->stream_identifier); in handle_http_frame_data()
1189 ret = send_window_update_frame(client, stream); in handle_http_frame_data()
1194 ret = send_window_update_frame(client, NULL); in handle_http_frame_data()
1200 client->current_stream->current_detail = NULL; in handle_http_frame_data()
1201 release_http_stream_context(client, frame->stream_identifier); in handle_http_frame_data()
1206 client->server_state = HTTP_SERVER_FRAME_PADDING_STATE; in handle_http_frame_data()
1208 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in handle_http_frame_data()
1262 static int process_header(struct http_client_ctx *client, in process_header() argument
1266 check_user_request_headers_http2(&client->header_capture_ctx, header); in process_header()
1281 client->method = supported_methods[i]; in process_header()
1290 if (header->value_len > sizeof(client->url_buffer) - 1) { in process_header()
1295 memcpy(client->url_buffer, header->value, header->value_len); in process_header()
1296 client->url_buffer[header->value_len] = '\0'; in process_header()
1299 if (header->value_len > sizeof(client->content_type) - 1) { in process_header()
1304 memcpy(client->content_type, header->value, header->value_len); in process_header()
1305 client->content_type[header->value_len] = '\0'; in process_header()
1320 client->content_len = (size_t)len; in process_header()
1330 static int handle_incomplete_http_header(struct http_client_ctx *client) in handle_incomplete_http_header() argument
1332 struct http2_frame *frame = &client->current_frame; in handle_incomplete_http_header()
1336 if (client->data_len < frame->length) { in handle_incomplete_http_header()
1341 if (!client->expect_continuation) { in handle_incomplete_http_header()
1358 extra_len = client->data_len - frame->length; in handle_incomplete_http_header()
1359 ret = parse_http_frame_header(client, client->cursor + prev_frame_len, in handle_incomplete_http_header()
1371 print_http_frames(client); in handle_incomplete_http_header()
1376 client->data_len -= HTTP2_FRAME_HEADER_SIZE; in handle_incomplete_http_header()
1378 memmove(client->cursor + prev_frame_len, in handle_incomplete_http_header()
1379 client->cursor + prev_frame_len + HTTP2_FRAME_HEADER_SIZE, in handle_incomplete_http_header()
1382 return enter_http_frame_continuation_state(client); in handle_incomplete_http_header()
1385 static int handle_http_frame_headers_end_stream(struct http_client_ctx *client) in handle_http_frame_headers_end_stream() argument
1387 struct http2_frame *frame = &client->current_frame; in handle_http_frame_headers_end_stream()
1392 if (client->current_stream == NULL) { in handle_http_frame_headers_end_stream()
1396 if (client->current_stream->current_detail == NULL) { in handle_http_frame_headers_end_stream()
1400 if (client->current_stream->current_detail->type == HTTP_RESOURCE_TYPE_DYNAMIC) { in handle_http_frame_headers_end_stream()
1403 client->current_stream->current_detail; in handle_http_frame_headers_end_stream()
1408 ret = dynamic_detail->cb(client, HTTP_SERVER_DATA_FINAL, &request_ctx, in handle_http_frame_headers_end_stream()
1418 ret = http2_dynamic_response(client, frame, &response_ctx, HTTP_SERVER_DATA_FINAL, in handle_http_frame_headers_end_stream()
1427 if (!client->current_stream->headers_sent) { in handle_http_frame_headers_end_stream()
1428 ret = send_headers_frame(client, HTTP_200_OK, frame->stream_identifier, in handle_http_frame_headers_end_stream()
1429 client->current_stream->current_detail, in handle_http_frame_headers_end_stream()
1435 } else if (!client->current_stream->end_stream_sent) { in handle_http_frame_headers_end_stream()
1436 ret = send_data_frame(client, NULL, 0, frame->stream_identifier, in handle_http_frame_headers_end_stream()
1443 client->current_stream->current_detail = NULL; in handle_http_frame_headers_end_stream()
1446 release_http_stream_context(client, frame->stream_identifier); in handle_http_frame_headers_end_stream()
1451 int handle_http_frame_headers(struct http_client_ctx *client) in handle_http_frame_headers() argument
1453 struct http2_frame *frame = &client->current_frame; in handle_http_frame_headers()
1460 ret = parse_http_frame_padded_field(client); in handle_http_frame_headers()
1467 ret = parse_http_frame_priority_field(client); in handle_http_frame_headers()
1474 struct http_hpack_header_buf *header = &client->header_field; in handle_http_frame_headers()
1475 size_t datalen = MIN(client->data_len, frame->length); in handle_http_frame_headers()
1477 ret = http_hpack_decode_header(client->cursor, datalen, header); in handle_http_frame_headers()
1480 ret = handle_incomplete_http_header(client); in handle_http_frame_headers()
1494 client->cursor += ret; in handle_http_frame_headers()
1495 client->data_len -= ret; in handle_http_frame_headers()
1500 ret = process_header(client, header); in handle_http_frame_headers()
1506 if (client->expect_continuation) { in handle_http_frame_headers()
1508 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in handle_http_frame_headers()
1512 detail = get_resource_detail(client->url_buffer, &path_len, false); in handle_http_frame_headers()
1519 frame, client); in handle_http_frame_headers()
1525 (struct http_resource_detail_static_fs *)detail, frame, client); in handle_http_frame_headers()
1532 frame, client); in handle_http_frame_headers()
1539 ret = send_http2_404(client, frame); in handle_http_frame_headers()
1546 ret = handle_http_frame_headers_end_stream(client); in handle_http_frame_headers()
1553 client->server_state = HTTP_SERVER_FRAME_PADDING_STATE; in handle_http_frame_headers()
1555 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in handle_http_frame_headers()
1561 int handle_http_frame_priority(struct http_client_ctx *client) in handle_http_frame_priority() argument
1563 struct http2_frame *frame = &client->current_frame; in handle_http_frame_priority()
1571 if (client->data_len < frame->length) { in handle_http_frame_priority()
1578 client->data_len -= HTTP2_PRIORITY_FRAME_LEN; in handle_http_frame_priority()
1579 client->cursor += HTTP2_PRIORITY_FRAME_LEN; in handle_http_frame_priority()
1581 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in handle_http_frame_priority()
1586 int handle_http_frame_rst_stream(struct http_client_ctx *client) in handle_http_frame_rst_stream() argument
1588 struct http2_frame *frame = &client->current_frame; in handle_http_frame_rst_stream()
1598 if (client->data_len < frame->length) { in handle_http_frame_rst_stream()
1606 stream_ctx = find_http_stream_context(client, frame->stream_identifier); in handle_http_frame_rst_stream()
1611 error_code = sys_get_be32(client->cursor); in handle_http_frame_rst_stream()
1616 release_http_stream_context(client, stream_ctx->stream_id); in handle_http_frame_rst_stream()
1618 client->data_len -= HTTP2_RST_STREAM_FRAME_LEN; in handle_http_frame_rst_stream()
1619 client->cursor += HTTP2_RST_STREAM_FRAME_LEN; in handle_http_frame_rst_stream()
1621 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in handle_http_frame_rst_stream()
1626 int handle_http_frame_settings(struct http_client_ctx *client) in handle_http_frame_settings() argument
1628 struct http2_frame *frame = &client->current_frame; in handle_http_frame_settings()
1633 if (client->data_len < frame->length) { in handle_http_frame_settings()
1637 bytes_consumed = client->current_frame.length; in handle_http_frame_settings()
1638 client->data_len -= bytes_consumed; in handle_http_frame_settings()
1639 client->cursor += bytes_consumed; in handle_http_frame_settings()
1644 ret = send_settings_frame(client, true); in handle_http_frame_settings()
1651 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in handle_http_frame_settings()
1656 int handle_http_frame_goaway(struct http_client_ctx *client) in handle_http_frame_goaway() argument
1658 struct http2_frame *frame = &client->current_frame; in handle_http_frame_goaway()
1663 if (client->data_len < frame->length) { in handle_http_frame_goaway()
1667 bytes_consumed = client->current_frame.length; in handle_http_frame_goaway()
1668 client->data_len -= bytes_consumed; in handle_http_frame_goaway()
1669 client->cursor += bytes_consumed; in handle_http_frame_goaway()
1671 enter_http_done_state(client); in handle_http_frame_goaway()
1676 int handle_http_frame_window_update(struct http_client_ctx *client) in handle_http_frame_window_update() argument
1678 struct http2_frame *frame = &client->current_frame; in handle_http_frame_window_update()
1685 if (client->data_len < frame->length) { in handle_http_frame_window_update()
1689 bytes_consumed = client->current_frame.length; in handle_http_frame_window_update()
1690 client->data_len -= bytes_consumed; in handle_http_frame_window_update()
1691 client->cursor += bytes_consumed; in handle_http_frame_window_update()
1693 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in handle_http_frame_window_update()
1698 int handle_http_frame_continuation(struct http_client_ctx *client) in handle_http_frame_continuation() argument
1701 client->server_state = HTTP_SERVER_FRAME_HEADERS_STATE; in handle_http_frame_continuation()
1706 int handle_http_frame_padding(struct http_client_ctx *client) in handle_http_frame_padding() argument
1708 struct http2_frame *frame = &client->current_frame; in handle_http_frame_padding()
1711 if (client->data_len == 0) { in handle_http_frame_padding()
1715 bytes_consumed = MIN(client->data_len, frame->padding_len); in handle_http_frame_padding()
1716 client->data_len -= bytes_consumed; in handle_http_frame_padding()
1717 client->cursor += bytes_consumed; in handle_http_frame_padding()
1721 client->server_state = HTTP_SERVER_FRAME_HEADER_STATE; in handle_http_frame_padding()
1755 int parse_http_frame_header(struct http_client_ctx *client, const uint8_t *buffer, in parse_http_frame_header() argument
1758 struct http2_frame *frame = &client->current_frame; in parse_http_frame_header()