comparison src/http/v3/ngx_http_v3_parse.c @ 8015:0596fe1aee16 quic

HTTP/3: server pushes. New directives are added: - http3_max_concurrent_pushes - http3_push - http3_push_preload
author Roman Arutyunyan <arut@nginx.com>
date Thu, 23 Jul 2020 13:41:24 +0300
parents 65c1fc5fae15
children d70a38acaea0
comparison
equal deleted inserted replaced
8014:c5324bb3a704 8015:0596fe1aee16
931 enum { 931 enum {
932 sw_start = 0, 932 sw_start = 0,
933 sw_first_type, 933 sw_first_type,
934 sw_type, 934 sw_type,
935 sw_length, 935 sw_length,
936 sw_cancel_push,
936 sw_settings, 937 sw_settings,
937 sw_max_push_id, 938 sw_max_push_id,
938 sw_skip 939 sw_skip
939 }; 940 };
940 941
986 break; 987 break;
987 } 988 }
988 989
989 switch (st->type) { 990 switch (st->type) {
990 991
992 case NGX_HTTP_V3_FRAME_CANCEL_PUSH:
993 st->state = sw_cancel_push;
994 break;
995
991 case NGX_HTTP_V3_FRAME_SETTINGS: 996 case NGX_HTTP_V3_FRAME_SETTINGS:
992 st->state = sw_settings; 997 st->state = sw_settings;
993 break; 998 break;
994 999
995 case NGX_HTTP_V3_FRAME_MAX_PUSH_ID: 1000 case NGX_HTTP_V3_FRAME_MAX_PUSH_ID:
1002 st->state = sw_skip; 1007 st->state = sw_skip;
1003 } 1008 }
1004 1009
1005 break; 1010 break;
1006 1011
1012 case sw_cancel_push:
1013
1014 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch);
1015
1016 if (--st->length == 0 && rc == NGX_AGAIN) {
1017 return NGX_HTTP_V3_ERR_FRAME_ERROR;
1018 }
1019
1020 if (rc != NGX_DONE) {
1021 return rc;
1022 }
1023
1024 rc = ngx_http_v3_cancel_push(c, st->vlint.value);
1025 if (rc != NGX_OK) {
1026 return rc;
1027 }
1028
1029 st->state = sw_type;
1030 break;
1031
1007 case sw_settings: 1032 case sw_settings:
1008 1033
1009 rc = ngx_http_v3_parse_settings(c, &st->settings, ch); 1034 rc = ngx_http_v3_parse_settings(c, &st->settings, ch);
1010 1035
1011 if (--st->length == 0 && rc == NGX_AGAIN) { 1036 if (--st->length == 0 && rc == NGX_AGAIN) {
1023 break; 1048 break;
1024 1049
1025 case sw_max_push_id: 1050 case sw_max_push_id:
1026 1051
1027 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch); 1052 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, ch);
1028 if (rc != NGX_DONE) { 1053
1029 return rc; 1054 if (--st->length == 0 && rc == NGX_AGAIN) {
1030 } 1055 return NGX_HTTP_V3_ERR_FRAME_ERROR;
1031 1056 }
1032 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 1057
1033 "http3 parse MAX_PUSH_ID:%uL", st->vlint.value); 1058 if (rc != NGX_DONE) {
1059 return rc;
1060 }
1061
1062 rc = ngx_http_v3_set_max_push_id(c, st->vlint.value);
1063 if (rc != NGX_OK) {
1064 return rc;
1065 }
1034 1066
1035 st->state = sw_type; 1067 st->state = sw_type;
1036 break; 1068 break;
1037 1069
1038 case sw_skip: 1070 case sw_skip: