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
6638ca93
Commit
6638ca93
authored
Apr 09, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
altsvc: Reduce bitfield size
parent
b924ef5f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
22 deletions
+37
-22
lib/nghttp2_option.c
lib/nghttp2_option.c
+8
-4
lib/nghttp2_option.h
lib/nghttp2_option.h
+4
-4
lib/nghttp2_session.c
lib/nghttp2_session.c
+13
-13
lib/nghttp2_session.h
lib/nghttp2_session.h
+12
-1
No files found.
lib/nghttp2_option.c
View file @
6638ca93
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
*/
*/
#include "nghttp2_option.h"
#include "nghttp2_option.h"
#include "nghttp2_session.h"
int
nghttp2_option_new
(
nghttp2_option
**
option_ptr
)
{
int
nghttp2_option_new
(
nghttp2_option
**
option_ptr
)
{
*
option_ptr
=
calloc
(
1
,
sizeof
(
nghttp2_option
));
*
option_ptr
=
calloc
(
1
,
sizeof
(
nghttp2_option
));
...
@@ -79,12 +81,14 @@ void nghttp2_option_set_user_recv_extension_type(nghttp2_option *option,
...
@@ -79,12 +81,14 @@ void nghttp2_option_set_user_recv_extension_type(nghttp2_option *option,
void
nghttp2_option_set_builtin_recv_extension_type
(
nghttp2_option
*
option
,
void
nghttp2_option_set_builtin_recv_extension_type
(
nghttp2_option
*
option
,
uint8_t
type
)
{
uint8_t
type
)
{
if
(
type
<
10
)
{
switch
(
type
)
{
case
NGHTTP2_ALTSVC
:
option
->
opt_set_mask
|=
NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES
;
option
->
builtin_recv_ext_types
|=
NGHTTP2_TYPEMASK_ALTSVC
;
return
;
default:
return
;
return
;
}
}
option
->
opt_set_mask
|=
NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES
;
set_ext_type
(
option
->
builtin_recv_ext_types
,
type
);
}
}
void
nghttp2_option_set_no_auto_ping_ack
(
nghttp2_option
*
option
,
int
val
)
{
void
nghttp2_option_set_no_auto_ping_ack
(
nghttp2_option
*
option
,
int
val
)
{
...
...
lib/nghttp2_option.h
View file @
6638ca93
...
@@ -82,6 +82,10 @@ struct nghttp2_option {
...
@@ -82,6 +82,10 @@ struct nghttp2_option {
* NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS
* NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS
*/
*/
uint32_t
max_reserved_remote_streams
;
uint32_t
max_reserved_remote_streams
;
/**
* NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES
*/
uint32_t
builtin_recv_ext_types
;
/**
/**
* NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE
* NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE
*/
*/
...
@@ -102,10 +106,6 @@ struct nghttp2_option {
...
@@ -102,10 +106,6 @@ struct nghttp2_option {
* NGHTTP2_OPT_USER_RECV_EXT_TYPES
* NGHTTP2_OPT_USER_RECV_EXT_TYPES
*/
*/
uint8_t
user_recv_ext_types
[
32
];
uint8_t
user_recv_ext_types
[
32
];
/**
* NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES
*/
uint8_t
builtin_recv_ext_types
[
32
];
};
};
#endif
/* NGHTTP2_OPTION_H */
#endif
/* NGHTTP2_OPTION_H */
lib/nghttp2_session.c
View file @
6638ca93
...
@@ -323,10 +323,12 @@ static void session_inbound_frame_reset(nghttp2_session *session) {
...
@@ -323,10 +323,12 @@ static void session_inbound_frame_reset(nghttp2_session *session) {
if
(
check_ext_type_set
(
session
->
user_recv_ext_types
,
if
(
check_ext_type_set
(
session
->
user_recv_ext_types
,
iframe
->
frame
.
hd
.
type
))
{
iframe
->
frame
.
hd
.
type
))
{
nghttp2_frame_extension_free
(
&
iframe
->
frame
.
ext
);
nghttp2_frame_extension_free
(
&
iframe
->
frame
.
ext
);
}
else
if
(
check_ext_type_set
(
session
->
builtin_recv_ext_types
,
}
else
{
iframe
->
frame
.
hd
.
type
))
{
switch
(
iframe
->
frame
.
hd
.
type
)
{
switch
(
iframe
->
frame
.
hd
.
type
)
{
case
NGHTTP2_ALTSVC
:
case
NGHTTP2_ALTSVC
:
if
((
session
->
builtin_recv_ext_types
&
NGHTTP2_TYPEMASK_ALTSVC
)
==
0
)
{
break
;
}
nghttp2_frame_altsvc_free
(
&
iframe
->
frame
.
ext
,
mem
);
nghttp2_frame_altsvc_free
(
&
iframe
->
frame
.
ext
,
mem
);
break
;
break
;
}
}
...
@@ -492,9 +494,7 @@ static int session_new(nghttp2_session **session_ptr,
...
@@ -492,9 +494,7 @@ static int session_new(nghttp2_session **session_ptr,
}
}
if
(
option
->
opt_set_mask
&
NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES
)
{
if
(
option
->
opt_set_mask
&
NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES
)
{
memcpy
((
*
session_ptr
)
->
builtin_recv_ext_types
,
(
*
session_ptr
)
->
builtin_recv_ext_types
=
option
->
builtin_recv_ext_types
;
option
->
builtin_recv_ext_types
,
sizeof
((
*
session_ptr
)
->
builtin_recv_ext_types
));
}
}
if
((
option
->
opt_set_mask
&
NGHTTP2_OPT_NO_AUTO_PING_ACK
)
&&
if
((
option
->
opt_set_mask
&
NGHTTP2_OPT_NO_AUTO_PING_ACK
)
&&
...
@@ -5556,10 +5556,16 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
...
@@ -5556,10 +5556,16 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe
->
state
=
NGHTTP2_IB_READ_EXTENSION_PAYLOAD
;
iframe
->
state
=
NGHTTP2_IB_READ_EXTENSION_PAYLOAD
;
break
;
break
;
}
else
if
(
check_ext_type_set
(
session
->
builtin_recv_ext_types
,
}
else
{
iframe
->
frame
.
hd
.
type
))
{
switch
(
iframe
->
frame
.
hd
.
type
)
{
switch
(
iframe
->
frame
.
hd
.
type
)
{
case
NGHTTP2_ALTSVC
:
case
NGHTTP2_ALTSVC
:
if
((
session
->
builtin_recv_ext_types
&
NGHTTP2_TYPEMASK_ALTSVC
)
==
0
)
{
busy
=
1
;
iframe
->
state
=
NGHTTP2_IB_IGN_PAYLOAD
;
break
;
}
DEBUGF
(
fprintf
(
stderr
,
"recv: ALTSVC
\n
"
));
DEBUGF
(
fprintf
(
stderr
,
"recv: ALTSVC
\n
"
));
iframe
->
frame
.
hd
.
flags
=
NGHTTP2_FLAG_NONE
;
iframe
->
frame
.
hd
.
flags
=
NGHTTP2_FLAG_NONE
;
...
@@ -5590,12 +5596,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
...
@@ -5590,12 +5596,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
break
;
break
;
}
}
}
else
{
busy
=
1
;
iframe
->
state
=
NGHTTP2_IB_IGN_PAYLOAD
;
break
;
}
}
}
}
...
...
lib/nghttp2_session.h
View file @
6638ca93
...
@@ -54,6 +54,15 @@ typedef enum {
...
@@ -54,6 +54,15 @@ typedef enum {
NGHTTP2_OPTMASK_NO_AUTO_PING_ACK
=
1
<<
3
NGHTTP2_OPTMASK_NO_AUTO_PING_ACK
=
1
<<
3
}
nghttp2_optmask
;
}
nghttp2_optmask
;
/*
* bitmask for built-in type to enable the default handling for that
* type of the frame.
*/
typedef
enum
{
NGHTTP2_TYPEMASK_NONE
=
0
,
NGHTTP2_TYPEMASK_ALTSVC
=
1
<<
0
}
nghttp2_typemask
;
typedef
enum
{
typedef
enum
{
NGHTTP2_OB_POP_ITEM
,
NGHTTP2_OB_POP_ITEM
,
NGHTTP2_OB_SEND_DATA
,
NGHTTP2_OB_SEND_DATA
,
...
@@ -295,6 +304,9 @@ struct nghttp2_session {
...
@@ -295,6 +304,9 @@ struct nghttp2_session {
/* Unacked local SETTINGS_MAX_CONCURRENT_STREAMS value. We use this
/* Unacked local SETTINGS_MAX_CONCURRENT_STREAMS value. We use this
to refuse the incoming stream if it exceeds this value. */
to refuse the incoming stream if it exceeds this value. */
uint32_t
pending_local_max_concurrent_stream
;
uint32_t
pending_local_max_concurrent_stream
;
/* The bitwose OR of zero or more of nghttp2_typemask to indicate
that the default handling of extension frame is enabled. */
uint32_t
builtin_recv_ext_types
;
/* Unacked local ENABLE_PUSH value. We use this to refuse
/* Unacked local ENABLE_PUSH value. We use this to refuse
PUSH_PROMISE before SETTINGS ACK is received. */
PUSH_PROMISE before SETTINGS ACK is received. */
uint8_t
pending_enable_push
;
uint8_t
pending_enable_push
;
...
@@ -314,7 +326,6 @@ struct nghttp2_session {
...
@@ -314,7 +326,6 @@ struct nghttp2_session {
bit is set, it indicates that incoming frame with that type is
bit is set, it indicates that incoming frame with that type is
passed to user defined callbacks, otherwise they are ignored. */
passed to user defined callbacks, otherwise they are ignored. */
uint8_t
user_recv_ext_types
[
32
];
uint8_t
user_recv_ext_types
[
32
];
uint8_t
builtin_recv_ext_types
[
32
];
};
};
/* Struct used when updating initial window size of each active
/* Struct used when updating initial window size of each active
...
...
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