Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
51e4ca9f
Commit
51e4ca9f
authored
Mar 10, 2018
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add SETTINGS_ENABLE_CONNECT_PROTOCOL
parent
e5b3f9ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
1 deletion
+63
-1
lib/includes/nghttp2/nghttp2.h
lib/includes/nghttp2/nghttp2.h
+6
-1
lib/nghttp2_frame.c
lib/nghttp2_frame.c
+5
-0
lib/nghttp2_session.c
lib/nghttp2_session.c
+28
-0
lib/nghttp2_session.h
lib/nghttp2_session.h
+1
-0
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+23
-0
No files found.
lib/includes/nghttp2/nghttp2.h
View file @
51e4ca9f
...
...
@@ -680,7 +680,12 @@ typedef enum {
/**
* SETTINGS_MAX_HEADER_LIST_SIZE
*/
NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
=
0x06
NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
=
0x06
,
/**
* SETTINGS_ENABLE_CONNECT_PROTOCOL
* (https://tools.ietf.org/html/draft-ietf-httpbis-h2-websockets-00)
*/
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL
=
0x08
}
nghttp2_settings_id
;
/* Note: If we add SETTINGS, update the capacity of
NGHTTP2_INBOUND_NUM_IV as well */
...
...
lib/nghttp2_frame.c
View file @
51e4ca9f
...
...
@@ -1050,6 +1050,11 @@ int nghttp2_iv_check(const nghttp2_settings_entry *iv, size_t niv) {
break
;
case
NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
:
break
;
case
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL
:
if
(
iv
[
i
].
value
!=
0
&&
iv
[
i
].
value
!=
1
)
{
return
0
;
}
break
;
}
}
return
1
;
...
...
lib/nghttp2_session.c
View file @
51e4ca9f
...
...
@@ -4361,6 +4361,9 @@ int nghttp2_session_update_local_settings(nghttp2_session *session,
case
NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
:
session
->
local_settings
.
max_header_list_size
=
iv
[
i
].
value
;
break
;
case
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL
:
session
->
local_settings
.
enable_connect_protocol
=
iv
[
i
].
value
;
break
;
}
}
...
...
@@ -4499,6 +4502,26 @@ int nghttp2_session_on_settings_received(nghttp2_session *session,
session
->
remote_settings
.
max_header_list_size
=
entry
->
value
;
break
;
case
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL
:
if
(
entry
->
value
!=
0
&&
entry
->
value
!=
1
)
{
return
session_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"SETTINGS: invalid SETTINGS_ENABLE_CONNECT_PROTOCOL"
);
}
if
(
!
session
->
server
&&
session
->
remote_settings
.
enable_connect_protocol
&&
entry
->
value
==
0
)
{
return
session_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"SETTINGS: server attempted to disable "
"SETTINGS_ENABLE_CONNECT_PROTOCOL"
);
}
session
->
remote_settings
.
enable_connect_protocol
=
entry
->
value
;
break
;
}
}
...
...
@@ -5250,6 +5273,7 @@ static void inbound_frame_set_settings_entry(nghttp2_inbound_frame *iframe) {
case
NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
:
case
NGHTTP2_SETTINGS_MAX_FRAME_SIZE
:
case
NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
:
case
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL
:
break
;
default:
DEBUGF
(
"recv: unknown settings id=0x%02x
\n
"
,
iv
.
settings_id
);
...
...
@@ -7330,6 +7354,8 @@ uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session,
return
session
->
remote_settings
.
max_frame_size
;
case
NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
:
return
session
->
remote_settings
.
max_header_list_size
;
case
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL
:
return
session
->
remote_settings
.
enable_connect_protocol
;
}
assert
(
0
);
...
...
@@ -7351,6 +7377,8 @@ uint32_t nghttp2_session_get_local_settings(nghttp2_session *session,
return
session
->
local_settings
.
max_frame_size
;
case
NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
:
return
session
->
local_settings
.
max_header_list_size
;
case
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL
:
return
session
->
local_settings
.
enable_connect_protocol
;
}
assert
(
0
);
...
...
lib/nghttp2_session.h
View file @
51e4ca9f
...
...
@@ -164,6 +164,7 @@ typedef struct {
uint32_t
initial_window_size
;
uint32_t
max_frame_size
;
uint32_t
max_header_list_size
;
uint32_t
enable_connect_protocol
;
}
nghttp2_settings_storage
;
typedef
enum
{
...
...
tests/nghttp2_session_test.c
View file @
51e4ca9f
...
...
@@ -3480,6 +3480,29 @@ void test_nghttp2_session_on_settings_received(void) {
CU_ASSERT
(
NGHTTP2_STREAM_CLOSING
==
stream1
->
state
);
nghttp2_session_del
(
session
);
/* It is invalid that peer disables ENABLE_CONNECT_PROTOCOL once it
has been enabled. */
nghttp2_session_client_new
(
&
session
,
&
callbacks
,
NULL
);
session
->
remote_settings
.
enable_connect_protocol
=
1
;
iv
[
0
].
settings_id
=
NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL
;
iv
[
0
].
value
=
0
;
nghttp2_frame_settings_init
(
&
frame
.
settings
,
NGHTTP2_FLAG_NONE
,
dup_iv
(
iv
,
1
),
1
);
CU_ASSERT
(
0
==
nghttp2_session_on_settings_received
(
session
,
&
frame
,
0
));
nghttp2_frame_settings_free
(
&
frame
.
settings
,
mem
);
item
=
nghttp2_session_get_next_ob_item
(
session
);
CU_ASSERT
(
NULL
!=
item
);
CU_ASSERT
(
NGHTTP2_GOAWAY
==
item
->
frame
.
hd
.
type
);
nghttp2_session_del
(
session
);
}
void
test_nghttp2_session_on_push_promise_received
(
void
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment