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
547d6d1f
Commit
547d6d1f
authored
Mar 05, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use 4086 as max DATA payload size to make DATA frame fit into 4K buffer
parent
382024a1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
16 deletions
+17
-16
lib/nghttp2_frame.h
lib/nghttp2_frame.h
+4
-2
lib/nghttp2_session.h
lib/nghttp2_session.h
+2
-3
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+11
-11
No files found.
lib/nghttp2_frame.h
View file @
547d6d1f
...
...
@@ -42,8 +42,10 @@
/* The maximum payload length of a frame */
#define NGHTTP2_MAX_FRAME_LENGTH ((1 << 14) - 1)
/* The maximum length of DATA frame payload. */
#define NGHTTP2_DATA_PAYLOAD_LENGTH 4096
/* The maximum length of DATA frame payload. To fit entire DATA frame
into 4096K buffer, we use subtract header size (8 bytes) + 2 bytes
padding. See nghttp2_session_pack_data(). */
#define NGHTTP2_DATA_PAYLOAD_LENGTH 4086
/* The number of bytes of frame header. */
#define NGHTTP2_FRAME_HEAD_LENGTH 8
...
...
lib/nghttp2_session.h
View file @
547d6d1f
...
...
@@ -74,9 +74,8 @@ typedef struct {
/* Buffer length for inbound raw byte stream. */
#define NGHTTP2_INBOUND_BUFFER_LENGTH 16384
#define NGHTTP2_INITIAL_OUTBOUND_FRAMEBUF_LENGTH (NGHTTP2_DATA_PAYLOAD_LENGTH+8)
#define NGHTTP2_INITIAL_INBOUND_FRAMEBUF_LENGTH \
NGHTTP2_INITIAL_OUTBOUND_FRAMEBUF_LENGTH
#define NGHTTP2_INITIAL_OUTBOUND_FRAMEBUF_LENGTH 4096
#define NGHTTP2_INITIAL_NV_BUFFER_LENGTH 4096
/* Internal state when receiving incoming frame */
...
...
tests/nghttp2_session_test.c
View file @
547d6d1f
...
...
@@ -3317,7 +3317,7 @@ void test_nghttp2_session_stop_data_with_rst_stream(void)
data_prd
.
read_callback
=
fixed_length_data_source_read_callback
;
ud
.
frame_send_cb_called
=
0
;
ud
.
data_source_length
=
16
*
102
4
;
ud
.
data_source_length
=
NGHTTP2_DATA_PAYLOAD_LENGTH
*
4
;
nghttp2_session_server_new
(
&
session
,
&
callbacks
,
&
ud
);
nghttp2_session_open_stream
(
session
,
1
,
NGHTTP2_STREAM_FLAG_NONE
,
...
...
@@ -3330,7 +3330,7 @@ void test_nghttp2_session_stop_data_with_rst_stream(void)
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
NGHTTP2_DATA
==
ud
.
sent_frame_type
);
/* data for DATA[1] is read from data_prd but it is not sent */
CU_ASSERT
(
ud
.
data_source_length
==
8
*
1024
);
CU_ASSERT
(
ud
.
data_source_length
==
NGHTTP2_DATA_PAYLOAD_LENGTH
*
2
);
nghttp2_frame_rst_stream_init
(
&
frame
.
rst_stream
,
1
,
NGHTTP2_CANCEL
);
CU_ASSERT
(
0
==
nghttp2_session_on_rst_stream_received
(
session
,
&
frame
));
...
...
@@ -3342,7 +3342,7 @@ void test_nghttp2_session_stop_data_with_rst_stream(void)
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
/* With RST_STREAM, stream is canceled and further DATA on that
stream are not sent. */
CU_ASSERT
(
ud
.
data_source_length
==
8
*
1024
);
CU_ASSERT
(
ud
.
data_source_length
==
NGHTTP2_DATA_PAYLOAD_LENGTH
*
2
);
CU_ASSERT
(
NULL
==
nghttp2_session_get_stream
(
session
,
1
));
...
...
@@ -3363,7 +3363,7 @@ void test_nghttp2_session_defer_data(void)
data_prd
.
read_callback
=
defer_data_source_read_callback
;
ud
.
frame_send_cb_called
=
0
;
ud
.
data_source_length
=
16
*
102
4
;
ud
.
data_source_length
=
NGHTTP2_DATA_PAYLOAD_LENGTH
*
4
;
nghttp2_session_server_new
(
&
session
,
&
callbacks
,
&
ud
);
nghttp2_session_open_stream
(
session
,
1
,
NGHTTP2_STREAM_FLAG_NONE
,
...
...
@@ -3376,7 +3376,7 @@ void test_nghttp2_session_defer_data(void)
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
NGHTTP2_HEADERS
==
ud
.
sent_frame_type
);
/* No data is read */
CU_ASSERT
(
ud
.
data_source_length
==
16
*
102
4
);
CU_ASSERT
(
ud
.
data_source_length
==
NGHTTP2_DATA_PAYLOAD_LENGTH
*
4
);
ud
.
block_count
=
1
;
nghttp2_submit_ping
(
session
,
NGHTTP2_FLAG_NONE
,
NULL
);
...
...
@@ -3390,9 +3390,9 @@ void test_nghttp2_session_defer_data(void)
OB_DATA
(
item
)
->
data_prd
.
read_callback
=
fixed_length_data_source_read_callback
;
ud
.
block_count
=
1
;
/* Reads 2
4KiB bloc
ks */
/* Reads 2
DATA chun
ks */
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
ud
.
data_source_length
==
8
*
1024
);
CU_ASSERT
(
ud
.
data_source_length
==
NGHTTP2_DATA_PAYLOAD_LENGTH
*
2
);
/* Deferred again */
OB_DATA
(
item
)
->
data_prd
.
read_callback
=
defer_data_source_read_callback
;
...
...
@@ -3400,7 +3400,7 @@ void test_nghttp2_session_defer_data(void)
sent. No read_callback invocation. */
ud
.
block_count
=
1
;
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
ud
.
data_source_length
==
8
*
1024
);
CU_ASSERT
(
ud
.
data_source_length
==
NGHTTP2_DATA_PAYLOAD_LENGTH
*
2
);
/* Resume deferred DATA */
...
...
@@ -3958,7 +3958,7 @@ void test_nghttp2_session_data_backoff_by_high_pri_frame(void)
data_prd
.
read_callback
=
fixed_length_data_source_read_callback
;
ud
.
frame_send_cb_called
=
0
;
ud
.
data_source_length
=
16
*
102
4
;
ud
.
data_source_length
=
NGHTTP2_DATA_PAYLOAD_LENGTH
*
4
;
nghttp2_session_client_new
(
&
session
,
&
callbacks
,
&
ud
);
nghttp2_submit_request
(
session
,
NGHTTP2_PRI_DEFAULT
,
NULL
,
0
,
...
...
@@ -3969,7 +3969,7 @@ void test_nghttp2_session_data_backoff_by_high_pri_frame(void)
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
NGHTTP2_DATA
==
ud
.
sent_frame_type
);
/* data for DATA[1] is read from data_prd but it is not sent */
CU_ASSERT
(
ud
.
data_source_length
==
8
*
1024
);
CU_ASSERT
(
ud
.
data_source_length
==
NGHTTP2_DATA_PAYLOAD_LENGTH
*
2
);
nghttp2_submit_ping
(
session
,
NGHTTP2_FLAG_NONE
,
NULL
);
ud
.
block_count
=
2
;
...
...
@@ -3977,7 +3977,7 @@ void test_nghttp2_session_data_backoff_by_high_pri_frame(void)
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
NGHTTP2_PING
==
ud
.
sent_frame_type
);
/* data for DATA[2] is read from data_prd but it is not sent */
CU_ASSERT
(
ud
.
data_source_length
==
4
*
1024
);
CU_ASSERT
(
ud
.
data_source_length
==
NGHTTP2_DATA_PAYLOAD_LENGTH
);
ud
.
block_count
=
2
;
/* Sends DATA[2..3] */
...
...
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