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
74f899fc
Commit
74f899fc
authored
Mar 11, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace NGHTTP2_MAX_FRAME_LENGTH with NGHTTP2_MAX_PAYLOADLEN
parent
e803c6b6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
33 deletions
+33
-33
lib/nghttp2_frame.c
lib/nghttp2_frame.c
+6
-6
lib/nghttp2_frame.h
lib/nghttp2_frame.h
+7
-7
lib/nghttp2_session.c
lib/nghttp2_session.c
+6
-6
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+14
-14
No files found.
lib/nghttp2_frame.c
View file @
74f899fc
...
...
@@ -264,13 +264,13 @@ ssize_t nghttp2_frame_pack_headers(nghttp2_buf *buf,
frame */
memset
(
buf
->
pos
,
0
,
NGHTTP2_FRAME_HDLEN
);
/* pack
ctrl
header after length is determined */
if
(
NGHTTP2_MAX_
FRAME_LENGTH
<
frame
->
hd
.
length
)
{
/* pack
frame
header after length is determined */
if
(
NGHTTP2_MAX_
PAYLOADLEN
<
frame
->
hd
.
length
)
{
/* Needs CONTINUATION */
nghttp2_frame_hd
hd
=
frame
->
hd
;
hd
.
flags
&=
~
NGHTTP2_FLAG_END_HEADERS
;
hd
.
length
=
NGHTTP2_MAX_
FRAME_LENGTH
;
hd
.
length
=
NGHTTP2_MAX_
PAYLOADLEN
;
nghttp2_frame_pack_frame_hd
(
buf
->
pos
,
&
hd
);
}
else
{
...
...
@@ -473,13 +473,13 @@ ssize_t nghttp2_frame_pack_push_promise(nghttp2_buf *buf,
frame */
memset
(
buf
->
pos
,
0
,
NGHTTP2_FRAME_HDLEN
);
/* pack
ctrl
header after length is determined */
if
(
NGHTTP2_MAX_
FRAME_LENGTH
<
frame
->
hd
.
length
)
{
/* pack
frame
header after length is determined */
if
(
NGHTTP2_MAX_
PAYLOADLEN
<
frame
->
hd
.
length
)
{
/* Needs CONTINUATION */
nghttp2_frame_hd
hd
=
frame
->
hd
;
hd
.
flags
&=
~
NGHTTP2_FLAG_END_HEADERS
;
hd
.
length
=
NGHTTP2_MAX_
FRAME_LENGTH
;
hd
.
length
=
NGHTTP2_MAX_
PAYLOADLEN
;
nghttp2_frame_pack_frame_hd
(
buf
->
pos
,
&
hd
);
}
else
{
...
...
lib/nghttp2_frame.h
View file @
74f899fc
...
...
@@ -42,7 +42,7 @@
/* The maximum payload length of a frame TODO: Must be renamed as
NGHTTP2_MAX_PAYLOAD_LENGTH */
#define NGHTTP2_MAX_
FRAME_LENGTH
((1 << 14) - 1)
#define NGHTTP2_MAX_
PAYLOADLEN
((1 << 14) - 1)
/* The maximum length of DATA frame payload. To fit entire DATA frame
into 4096K buffer, we use subtract header size (8 bytes) + 2 bytes
...
...
@@ -111,9 +111,9 @@ size_t nghttp2_frame_headers_payload_nv_offset(nghttp2_headers *frame);
*
* frame->hd.length is assigned after length is determined during
* packing process. If payload length is strictly larger than
* NGHTTP2_MAX_
FRAME_LENGTH, payload data is still serialized as is,
*
but frame->hd.length is set to NGHTTP2_MAX_FRAME_LENGTH and
*
NGHTTP2_FLAG_END_HEADERS flag is cleared from frame->hd.flags
.
* NGHTTP2_MAX_
PAYLOADLEN, payload data is still serialized as is, but
*
serialized header's payload length is set to NGHTTP2_MAX_PAYLOADLEN
*
and NGHTTP2_FLAG_END_HEADERS flag is cleared
.
*
* This function returns the size of packed frame (which equals to
* nghttp2_buf_len(buf)) if it succeeds, or returns one of the
...
...
@@ -254,9 +254,9 @@ int nghttp2_frame_unpack_settings_payload2(nghttp2_settings_entry **iv_ptr,
*
* frame->hd.length is assigned after length is determined during
* packing process. If payload length is strictly larger than
* NGHTTP2_MAX_
FRAME_LENGTH, payload data is still serialized as is,
*
but frame->hd.length is set to NGHTTP2_MAX_FRAME_LENGTH and
*
NGHTTP2_FLAG_END_HEADERS flag is cleared from frame->hd.flags
.
* NGHTTP2_MAX_
PAYLOADLEN, payload data is still serialized as is, but
*
serialized header's payload length is set to NGHTTP2_MAX_PAYLOADLEN
*
and NGHTTP2_FLAG_END_HEADERS flag is cleared
.
*
* This function returns the size of packed frame (which equals to
* nghttp2_buf_len(buf)) if it succeeds, or returns one of the
...
...
lib/nghttp2_session.c
View file @
74f899fc
...
...
@@ -1178,15 +1178,15 @@ static ssize_t session_headers_add_pad(nghttp2_session *session,
DEBUGF
(
fprintf
(
stderr
,
"padding selected: payloadlen=%zu, padlen=%zu
\n
"
,
frame
->
hd
.
length
,
frame
->
headers
.
padlen
));
if
(
frame
->
hd
.
length
>
NGHTTP2_MAX_
FRAME_LENGTH
)
{
if
(
frame
->
hd
.
length
>
NGHTTP2_MAX_
PAYLOADLEN
)
{
nghttp2_frame_hd
hd
=
frame
->
hd
;
hd
.
flags
&=
~
NGHTTP2_FLAG_END_HEADERS
;
hd
.
length
=
NGHTTP2_MAX_
FRAME_LENGTH
;
hd
.
length
=
NGHTTP2_MAX_
PAYLOADLEN
;
if
(
NGHTTP2_MAX_
FRAME_LENGTH
>
frame
->
hd
.
length
-
frame
->
headers
.
padlen
)
{
if
(
NGHTTP2_MAX_
PAYLOADLEN
>
frame
->
hd
.
length
-
frame
->
headers
.
padlen
)
{
size_t
padlen
;
padlen
=
NGHTTP2_MAX_
FRAME_LENGTH
-
padlen
=
NGHTTP2_MAX_
PAYLOADLEN
-
(
frame
->
hd
.
length
-
frame
->
headers
.
padlen
);
DEBUGF
(
fprintf
(
stderr
,
"padding across 2 frames
\n
"
));
...
...
@@ -1608,7 +1608,7 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
nghttp2_frame_hd
cont_hd
;
cont_hd
.
length
=
nghttp2_min
(
framebuf
->
last
-
framebuf
->
mark
,
NGHTTP2_MAX_
FRAME_LENGTH
);
NGHTTP2_MAX_
PAYLOADLEN
);
cont_hd
.
type
=
NGHTTP2_CONTINUATION
;
cont_hd
.
stream_id
=
frame
->
hd
.
stream_id
;
cont_hd
.
flags
=
NGHTTP2_FLAG_NONE
;
...
...
@@ -1970,7 +1970,7 @@ ssize_t nghttp2_session_mem_send(nghttp2_session *session,
/* We have to get frame size from headers, because
frame->hd.length does not always shows the actual frame
size, especially for HEADERS size >
NGHTTP2_MAX_
FRAME_LENGTH
*/
NGHTTP2_MAX_
PAYLOADLEN
*/
frame
=
nghttp2_outbound_item_get_ctrl_frame
(
item
);
framebuf
->
mark
=
framebuf
->
pos
+
NGHTTP2_FRAME_HDLEN
+
...
...
tests/nghttp2_session_test.c
View file @
74f899fc
...
...
@@ -3628,19 +3628,19 @@ void test_nghttp2_session_flow_control_data_recv(void)
NGHTTP2_PRI_DEFAULT
,
NGHTTP2_STREAM_OPENED
,
NULL
);
session
->
local_window_size
=
NGHTTP2_MAX_
FRAME_LENGTH
;
stream
->
local_window_size
=
NGHTTP2_MAX_
FRAME_LENGTH
;
session
->
local_window_size
=
NGHTTP2_MAX_
PAYLOADLEN
;
stream
->
local_window_size
=
NGHTTP2_MAX_
PAYLOADLEN
;
/* Create DATA frame */
memset
(
data
,
0
,
sizeof
(
data
));
hd
.
length
=
NGHTTP2_MAX_
FRAME_LENGTH
;
hd
.
length
=
NGHTTP2_MAX_
PAYLOADLEN
;
hd
.
type
=
NGHTTP2_DATA
;
hd
.
flags
=
NGHTTP2_FLAG_END_STREAM
;
hd
.
stream_id
=
1
;
nghttp2_frame_pack_frame_hd
(
data
,
&
hd
);
CU_ASSERT
(
NGHTTP2_MAX_
FRAME_LENGTH
+
NGHTTP2_FRAME_HDLEN
==
CU_ASSERT
(
NGHTTP2_MAX_
PAYLOADLEN
+
NGHTTP2_FRAME_HDLEN
==
nghttp2_session_mem_recv
(
session
,
data
,
NGHTTP2_MAX_
FRAME_LENGTH
+
NGHTTP2_MAX_
PAYLOADLEN
+
NGHTTP2_FRAME_HDLEN
));
item
=
nghttp2_session_get_next_ob_item
(
session
);
...
...
@@ -3648,7 +3648,7 @@ void test_nghttp2_session_flow_control_data_recv(void)
issued, but connection-level does. */
CU_ASSERT
(
NGHTTP2_WINDOW_UPDATE
==
OB_CTRL_TYPE
(
item
));
CU_ASSERT
(
0
==
OB_CTRL
(
item
)
->
hd
.
stream_id
);
CU_ASSERT
(
NGHTTP2_MAX_
FRAME_LENGTH
==
CU_ASSERT
(
NGHTTP2_MAX_
PAYLOADLEN
==
OB_CTRL
(
item
)
->
window_update
.
window_size_increment
);
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
...
...
@@ -3658,15 +3658,15 @@ void test_nghttp2_session_flow_control_data_recv(void)
RST_STREAM is issued by the remote, but the local side keeps
sending DATA frames. Without calculating connection-level window,
the subsequent flow control gets confused. */
CU_ASSERT
(
NGHTTP2_MAX_
FRAME_LENGTH
+
NGHTTP2_FRAME_HDLEN
==
CU_ASSERT
(
NGHTTP2_MAX_
PAYLOADLEN
+
NGHTTP2_FRAME_HDLEN
==
nghttp2_session_mem_recv
(
session
,
data
,
NGHTTP2_MAX_
FRAME_LENGTH
+
NGHTTP2_MAX_
PAYLOADLEN
+
NGHTTP2_FRAME_HDLEN
));
item
=
nghttp2_session_get_next_ob_item
(
session
);
CU_ASSERT
(
NGHTTP2_WINDOW_UPDATE
==
OB_CTRL_TYPE
(
item
));
CU_ASSERT
(
0
==
OB_CTRL
(
item
)
->
hd
.
stream_id
);
CU_ASSERT
(
NGHTTP2_MAX_
FRAME_LENGTH
==
CU_ASSERT
(
NGHTTP2_MAX_
PAYLOADLEN
==
OB_CTRL
(
item
)
->
window_update
.
window_size_increment
);
nghttp2_session_del
(
session
);
...
...
@@ -4199,7 +4199,7 @@ void test_nghttp2_session_pack_headers_with_padding(void)
nva
,
ARRLEN
(
nva
),
NULL
,
NULL
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
acc
.
length
>
NGHTTP2_MAX_
FRAME_LENGTH
);
CU_ASSERT
(
acc
.
length
>
NGHTTP2_MAX_
PAYLOADLEN
);
ud
.
frame_recv_cb_called
=
0
;
CU_ASSERT
((
ssize_t
)
acc
.
length
==
nghttp2_session_mem_recv
(
sv_session
,
acc
.
buf
,
acc
.
length
));
...
...
@@ -4213,7 +4213,7 @@ void test_nghttp2_session_pack_headers_with_padding(void)
acc
.
length
=
0
;
CU_ASSERT
(
0
==
nghttp2_session_send
(
sv_session
));
CU_ASSERT
(
acc
.
length
>
NGHTTP2_MAX_
FRAME_LENGTH
);
CU_ASSERT
(
acc
.
length
>
NGHTTP2_MAX_
PAYLOADLEN
);
ud
.
frame_recv_cb_called
=
0
;
CU_ASSERT
((
ssize_t
)
acc
.
length
==
nghttp2_session_mem_recv
(
session
,
acc
.
buf
,
acc
.
length
));
...
...
@@ -4261,7 +4261,7 @@ void test_nghttp2_session_pack_headers_with_padding2(void)
nva
,
ARRLEN
(
nva
),
NULL
,
NULL
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
acc
.
length
>
NGHTTP2_MAX_
FRAME_LENGTH
);
CU_ASSERT
(
acc
.
length
>
NGHTTP2_MAX_
PAYLOADLEN
);
ud
.
frame_recv_cb_called
=
0
;
CU_ASSERT
((
ssize_t
)
acc
.
length
==
...
...
@@ -4310,7 +4310,7 @@ void test_nghttp2_session_pack_headers_with_padding3(void)
nva
,
ARRLEN
(
nva
),
NULL
,
NULL
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
acc
.
length
>
NGHTTP2_MAX_
FRAME_LENGTH
);
CU_ASSERT
(
acc
.
length
>
NGHTTP2_MAX_
PAYLOADLEN
);
ud
.
frame_recv_cb_called
=
0
;
CU_ASSERT
((
ssize_t
)
acc
.
length
==
nghttp2_session_mem_recv
(
sv_session
,
acc
.
buf
,
acc
.
length
));
...
...
@@ -4354,7 +4354,7 @@ void test_nghttp2_session_pack_headers_with_padding4(void)
nva
,
ARRLEN
(
nva
),
NULL
,
NULL
));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
acc
.
length
<
NGHTTP2_MAX_
FRAME_LENGTH
);
CU_ASSERT
(
acc
.
length
<
NGHTTP2_MAX_
PAYLOADLEN
);
ud
.
frame_recv_cb_called
=
0
;
CU_ASSERT
((
ssize_t
)
acc
.
length
==
nghttp2_session_mem_recv
(
sv_session
,
acc
.
buf
,
acc
.
length
));
...
...
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