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
e803c6b6
Commit
e803c6b6
authored
Mar 11, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace NGHTTP2_FRAME_HEAD_LENGTH with NGHTTP2_FRAME_HDLEN
parent
358b4386
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
35 deletions
+34
-35
lib/nghttp2_frame.c
lib/nghttp2_frame.c
+10
-10
lib/nghttp2_frame.h
lib/nghttp2_frame.h
+0
-1
lib/nghttp2_session.c
lib/nghttp2_session.c
+5
-5
tests/failmalloc_test.c
tests/failmalloc_test.c
+3
-3
tests/nghttp2_frame_test.c
tests/nghttp2_frame_test.c
+1
-1
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+13
-13
tests/nghttp2_test_helper.c
tests/nghttp2_test_helper.c
+2
-2
No files found.
lib/nghttp2_frame.c
View file @
e803c6b6
...
@@ -262,7 +262,7 @@ ssize_t nghttp2_frame_pack_headers(nghttp2_buf *buf,
...
@@ -262,7 +262,7 @@ ssize_t nghttp2_frame_pack_headers(nghttp2_buf *buf,
/* Don't use buf->last, since it already points to the end of the
/* Don't use buf->last, since it already points to the end of the
frame */
frame */
memset
(
buf
->
pos
,
0
,
NGHTTP2_FRAME_H
EAD_LENGTH
);
memset
(
buf
->
pos
,
0
,
NGHTTP2_FRAME_H
DLEN
);
/* pack ctrl header after length is determined */
/* pack ctrl header after length is determined */
if
(
NGHTTP2_MAX_FRAME_LENGTH
<
frame
->
hd
.
length
)
{
if
(
NGHTTP2_MAX_FRAME_LENGTH
<
frame
->
hd
.
length
)
{
...
@@ -301,7 +301,7 @@ int nghttp2_frame_unpack_headers_payload(nghttp2_headers *frame,
...
@@ -301,7 +301,7 @@ int nghttp2_frame_unpack_headers_payload(nghttp2_headers *frame,
ssize_t
nghttp2_frame_pack_priority
(
nghttp2_buf
*
buf
,
ssize_t
nghttp2_frame_pack_priority
(
nghttp2_buf
*
buf
,
nghttp2_priority
*
frame
)
nghttp2_priority
*
frame
)
{
{
ssize_t
framelen
=
NGHTTP2_FRAME_H
EAD_LENGTH
+
4
;
ssize_t
framelen
=
NGHTTP2_FRAME_H
DLEN
+
4
;
int
rv
;
int
rv
;
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
...
@@ -332,7 +332,7 @@ void nghttp2_frame_unpack_priority_payload(nghttp2_priority *frame,
...
@@ -332,7 +332,7 @@ void nghttp2_frame_unpack_priority_payload(nghttp2_priority *frame,
ssize_t
nghttp2_frame_pack_rst_stream
(
nghttp2_buf
*
buf
,
ssize_t
nghttp2_frame_pack_rst_stream
(
nghttp2_buf
*
buf
,
nghttp2_rst_stream
*
frame
)
nghttp2_rst_stream
*
frame
)
{
{
ssize_t
framelen
=
NGHTTP2_FRAME_H
EAD_LENGTH
+
4
;
ssize_t
framelen
=
NGHTTP2_FRAME_H
DLEN
+
4
;
int
rv
;
int
rv
;
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
...
@@ -363,7 +363,7 @@ void nghttp2_frame_unpack_rst_stream_payload(nghttp2_rst_stream *frame,
...
@@ -363,7 +363,7 @@ void nghttp2_frame_unpack_rst_stream_payload(nghttp2_rst_stream *frame,
ssize_t
nghttp2_frame_pack_settings
(
nghttp2_buf
*
buf
,
ssize_t
nghttp2_frame_pack_settings
(
nghttp2_buf
*
buf
,
nghttp2_settings
*
frame
)
nghttp2_settings
*
frame
)
{
{
ssize_t
framelen
=
NGHTTP2_FRAME_H
EAD_LENGTH
+
frame
->
hd
.
length
;
ssize_t
framelen
=
NGHTTP2_FRAME_H
DLEN
+
frame
->
hd
.
length
;
int
rv
;
int
rv
;
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
...
@@ -471,7 +471,7 @@ ssize_t nghttp2_frame_pack_push_promise(nghttp2_buf *buf,
...
@@ -471,7 +471,7 @@ ssize_t nghttp2_frame_pack_push_promise(nghttp2_buf *buf,
/* Don't use buf->last, since it already points to the end of the
/* Don't use buf->last, since it already points to the end of the
frame */
frame */
memset
(
buf
->
pos
,
0
,
NGHTTP2_FRAME_H
EAD_LENGTH
);
memset
(
buf
->
pos
,
0
,
NGHTTP2_FRAME_H
DLEN
);
/* pack ctrl header after length is determined */
/* pack ctrl header after length is determined */
if
(
NGHTTP2_MAX_FRAME_LENGTH
<
frame
->
hd
.
length
)
{
if
(
NGHTTP2_MAX_FRAME_LENGTH
<
frame
->
hd
.
length
)
{
...
@@ -505,7 +505,7 @@ int nghttp2_frame_unpack_push_promise_payload(nghttp2_push_promise *frame,
...
@@ -505,7 +505,7 @@ int nghttp2_frame_unpack_push_promise_payload(nghttp2_push_promise *frame,
ssize_t
nghttp2_frame_pack_ping
(
nghttp2_buf
*
buf
,
nghttp2_ping
*
frame
)
ssize_t
nghttp2_frame_pack_ping
(
nghttp2_buf
*
buf
,
nghttp2_ping
*
frame
)
{
{
ssize_t
framelen
=
NGHTTP2_FRAME_H
EAD_LENGTH
+
8
;
ssize_t
framelen
=
NGHTTP2_FRAME_H
DLEN
+
8
;
int
rv
;
int
rv
;
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
...
@@ -535,7 +535,7 @@ void nghttp2_frame_unpack_ping_payload(nghttp2_ping *frame,
...
@@ -535,7 +535,7 @@ void nghttp2_frame_unpack_ping_payload(nghttp2_ping *frame,
ssize_t
nghttp2_frame_pack_goaway
(
nghttp2_buf
*
buf
,
nghttp2_goaway
*
frame
)
ssize_t
nghttp2_frame_pack_goaway
(
nghttp2_buf
*
buf
,
nghttp2_goaway
*
frame
)
{
{
ssize_t
framelen
=
NGHTTP2_FRAME_H
EAD_LENGTH
+
frame
->
hd
.
length
;
ssize_t
framelen
=
NGHTTP2_FRAME_H
DLEN
+
frame
->
hd
.
length
;
int
rv
;
int
rv
;
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
...
@@ -576,7 +576,7 @@ void nghttp2_frame_unpack_goaway_payload(nghttp2_goaway *frame,
...
@@ -576,7 +576,7 @@ void nghttp2_frame_unpack_goaway_payload(nghttp2_goaway *frame,
ssize_t
nghttp2_frame_pack_window_update
(
nghttp2_buf
*
buf
,
ssize_t
nghttp2_frame_pack_window_update
(
nghttp2_buf
*
buf
,
nghttp2_window_update
*
frame
)
nghttp2_window_update
*
frame
)
{
{
ssize_t
framelen
=
NGHTTP2_FRAME_H
EAD_LENGTH
+
4
;
ssize_t
framelen
=
NGHTTP2_FRAME_H
DLEN
+
4
;
int
rv
;
int
rv
;
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
assert
(
nghttp2_buf_len
(
buf
)
==
0
);
...
@@ -752,7 +752,7 @@ void nghttp2_frame_set_pad(nghttp2_buf *buf, uint8_t *flags_ptr, size_t padlen)
...
@@ -752,7 +752,7 @@ void nghttp2_frame_set_pad(nghttp2_buf *buf, uint8_t *flags_ptr, size_t padlen)
/* Consume previous 2 bytes, shifting 2 bytes to the left */
/* Consume previous 2 bytes, shifting 2 bytes to the left */
nghttp2_buf_shift_left
(
buf
,
2
);
nghttp2_buf_shift_left
(
buf
,
2
);
p
=
buf
->
pos
+
NGHTTP2_FRAME_H
EAD_LENGTH
;
p
=
buf
->
pos
+
NGHTTP2_FRAME_H
DLEN
;
*
p
++
=
trail_padlen
>>
8
;
*
p
++
=
trail_padlen
>>
8
;
*
p
=
trail_padlen
&
0xff
;
*
p
=
trail_padlen
&
0xff
;
...
@@ -765,6 +765,6 @@ void nghttp2_frame_set_pad(nghttp2_buf *buf, uint8_t *flags_ptr, size_t padlen)
...
@@ -765,6 +765,6 @@ void nghttp2_frame_set_pad(nghttp2_buf *buf, uint8_t *flags_ptr, size_t padlen)
trail_padlen
=
padlen
-
1
;
trail_padlen
=
padlen
-
1
;
*
flags_ptr
|=
NGHTTP2_FLAG_PAD_LOW
;
*
flags_ptr
|=
NGHTTP2_FLAG_PAD_LOW
;
*
(
buf
->
pos
+
NGHTTP2_FRAME_H
EAD_LENGTH
)
=
trail_padlen
;
*
(
buf
->
pos
+
NGHTTP2_FRAME_H
DLEN
)
=
trail_padlen
;
}
}
}
}
lib/nghttp2_frame.h
View file @
e803c6b6
...
@@ -51,7 +51,6 @@
...
@@ -51,7 +51,6 @@
/* The number of bytes of frame header. */
/* The number of bytes of frame header. */
#define NGHTTP2_FRAME_HDLEN 8
#define NGHTTP2_FRAME_HDLEN 8
#define NGHTTP2_FRAME_HEAD_LENGTH NGHTTP2_FRAME_HDLEN
/* The number of bytes for each SETTINGS entry */
/* The number of bytes for each SETTINGS entry */
#define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 5
#define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 5
...
...
lib/nghttp2_session.c
View file @
e803c6b6
...
@@ -185,7 +185,7 @@ static void nghttp2_inbound_frame_reset(nghttp2_session *session)
...
@@ -185,7 +185,7 @@ static void nghttp2_inbound_frame_reset(nghttp2_session *session)
}
}
memset
(
&
iframe
->
frame
,
0
,
sizeof
(
nghttp2_frame
));
memset
(
&
iframe
->
frame
,
0
,
sizeof
(
nghttp2_frame
));
iframe
->
state
=
NGHTTP2_IB_READ_HEAD
;
iframe
->
state
=
NGHTTP2_IB_READ_HEAD
;
iframe
->
left
=
NGHTTP2_FRAME_H
EAD_LENGTH
;
iframe
->
left
=
NGHTTP2_FRAME_H
DLEN
;
iframe
->
niv
=
0
;
iframe
->
niv
=
0
;
iframe
->
payloadleft
=
0
;
iframe
->
payloadleft
=
0
;
iframe
->
padlen
=
0
;
iframe
->
padlen
=
0
;
...
@@ -1614,7 +1614,7 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
...
@@ -1614,7 +1614,7 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
cont_hd
.
flags
=
NGHTTP2_FLAG_NONE
;
cont_hd
.
flags
=
NGHTTP2_FLAG_NONE
;
/* Reuse previous buffers for frame header */
/* Reuse previous buffers for frame header */
framebuf
->
pos
-=
NGHTTP2_FRAME_H
EAD_LENGTH
;
framebuf
->
pos
-=
NGHTTP2_FRAME_H
DLEN
;
if
(
cont_hd
.
length
+
framebuf
->
mark
==
framebuf
->
last
)
{
if
(
cont_hd
.
length
+
framebuf
->
mark
==
framebuf
->
last
)
{
size_t
padlen
;
size_t
padlen
;
...
@@ -1973,7 +1973,7 @@ ssize_t nghttp2_session_mem_send(nghttp2_session *session,
...
@@ -1973,7 +1973,7 @@ ssize_t nghttp2_session_mem_send(nghttp2_session *session,
NGHTTP2_MAX_FRAME_LENGTH */
NGHTTP2_MAX_FRAME_LENGTH */
frame
=
nghttp2_outbound_item_get_ctrl_frame
(
item
);
frame
=
nghttp2_outbound_item_get_ctrl_frame
(
item
);
framebuf
->
mark
=
framebuf
->
pos
+
NGHTTP2_FRAME_H
EAD_LENGTH
+
framebuf
->
mark
=
framebuf
->
pos
+
NGHTTP2_FRAME_H
DLEN
+
nghttp2_get_uint16
(
framebuf
->
pos
);
nghttp2_get_uint16
(
framebuf
->
pos
);
rv
=
session_call_before_frame_send
(
session
,
frame
);
rv
=
session_call_before_frame_send
(
session
,
frame
);
...
@@ -4072,7 +4072,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -4072,7 +4072,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
iframe
->
frame
.
hd
.
flags
&=
iframe
->
frame
.
hd
.
flags
&=
~
(
NGHTTP2_FLAG_PAD_HIGH
|
NGHTTP2_FLAG_PAD_LOW
);
~
(
NGHTTP2_FLAG_PAD_HIGH
|
NGHTTP2_FLAG_PAD_LOW
);
if
((
iframe
->
frame
.
hd
.
flags
&
NGHTTP2_FLAG_END_HEADERS
)
==
0
)
{
if
((
iframe
->
frame
.
hd
.
flags
&
NGHTTP2_FLAG_END_HEADERS
)
==
0
)
{
inbound_frame_reset_left
(
iframe
,
NGHTTP2_FRAME_H
EAD_LENGTH
);
inbound_frame_reset_left
(
iframe
,
NGHTTP2_FRAME_H
DLEN
);
iframe
->
padlen
=
0
;
iframe
->
padlen
=
0
;
if
(
iframe
->
state
==
NGHTTP2_IB_READ_HEADER_BLOCK
)
{
if
(
iframe
->
state
==
NGHTTP2_IB_READ_HEADER_BLOCK
)
{
iframe
->
state
=
NGHTTP2_IB_EXPECT_CONTINUATION
;
iframe
->
state
=
NGHTTP2_IB_EXPECT_CONTINUATION
;
...
@@ -4654,7 +4654,7 @@ ssize_t nghttp2_session_pack_data(nghttp2_session *session,
...
@@ -4654,7 +4654,7 @@ ssize_t nghttp2_session_pack_data(nghttp2_session *session,
the correct flags */
the correct flags */
frame
->
hd
.
flags
|=
flags
;
frame
->
hd
.
flags
|=
flags
;
memset
(
buf
->
pos
,
0
,
NGHTTP2_FRAME_H
EAD_LENGTH
);
memset
(
buf
->
pos
,
0
,
NGHTTP2_FRAME_H
DLEN
);
hd
=
frame
->
hd
;
hd
=
frame
->
hd
;
hd
.
flags
=
flags
;
hd
.
flags
=
flags
;
...
...
tests/failmalloc_test.c
View file @
e803c6b6
...
@@ -436,9 +436,9 @@ static void run_nghttp2_frame_pack_settings(void)
...
@@ -436,9 +436,9 @@ static void run_nghttp2_frame_pack_settings(void)
goto
fail
;
goto
fail
;
}
}
rv
=
nghttp2_frame_unpack_settings
(
&
oframe
.
settings
,
rv
=
nghttp2_frame_unpack_settings
(
&
oframe
.
settings
,
&
buf
[
0
],
NGHTTP2_FRAME_H
EAD_LENGTH
,
&
buf
[
0
],
NGHTTP2_FRAME_H
DLEN
,
&
buf
[
NGHTTP2_FRAME_H
EAD_LENGTH
],
&
buf
[
NGHTTP2_FRAME_H
DLEN
],
framelen
-
NGHTTP2_FRAME_H
EAD_LENGTH
);
framelen
-
NGHTTP2_FRAME_H
DLEN
);
if
(
rv
!=
0
)
{
if
(
rv
!=
0
)
{
goto
fail
;
goto
fail
;
}
}
...
...
tests/nghttp2_frame_test.c
View file @
e803c6b6
...
@@ -257,7 +257,7 @@ void test_nghttp2_frame_pack_settings()
...
@@ -257,7 +257,7 @@ void test_nghttp2_frame_pack_settings()
nghttp2_frame_iv_copy
(
iv
,
3
),
3
);
nghttp2_frame_iv_copy
(
iv
,
3
),
3
);
framelen
=
nghttp2_frame_pack_settings
(
&
buf
,
&
frame
);
framelen
=
nghttp2_frame_pack_settings
(
&
buf
,
&
frame
);
CU_ASSERT
(
NGHTTP2_FRAME_H
EAD_LENGTH
+
CU_ASSERT
(
NGHTTP2_FRAME_H
DLEN
+
3
*
NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH
==
framelen
);
3
*
NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH
==
framelen
);
CU_ASSERT
(
framelen
==
nghttp2_buf_len
(
&
buf
));
CU_ASSERT
(
framelen
==
nghttp2_buf_len
(
&
buf
));
...
...
tests/nghttp2_session_test.c
View file @
e803c6b6
...
@@ -734,7 +734,7 @@ void test_nghttp2_session_recv_continuation(void)
...
@@ -734,7 +734,7 @@ void test_nghttp2_session_recv_continuation(void)
cont_hd
.
stream_id
=
1
;
cont_hd
.
stream_id
=
1
;
nghttp2_frame_pack_frame_hd
(
data
+
datalen
,
&
cont_hd
);
nghttp2_frame_pack_frame_hd
(
data
+
datalen
,
&
cont_hd
);
datalen
+=
NGHTTP2_FRAME_H
EAD_LENGTH
;
datalen
+=
NGHTTP2_FRAME_H
DLEN
;
memcpy
(
data
+
datalen
,
buf
.
pos
,
cont_hd
.
length
);
memcpy
(
data
+
datalen
,
buf
.
pos
,
cont_hd
.
length
);
datalen
+=
cont_hd
.
length
;
datalen
+=
cont_hd
.
length
;
...
@@ -918,7 +918,7 @@ void test_nghttp2_session_continue(void)
...
@@ -918,7 +918,7 @@ void test_nghttp2_session_continue(void)
recv_frame
=
user_data
.
frame
;
recv_frame
=
user_data
.
frame
;
CU_ASSERT
(
NGHTTP2_HEADERS
==
recv_frame
->
hd
.
type
);
CU_ASSERT
(
NGHTTP2_HEADERS
==
recv_frame
->
hd
.
type
);
CU_ASSERT
(
framelen1
-
NGHTTP2_FRAME_H
EAD_LENGTH
==
recv_frame
->
hd
.
length
);
CU_ASSERT
(
framelen1
-
NGHTTP2_FRAME_H
DLEN
==
recv_frame
->
hd
.
length
);
CU_ASSERT
(
1
==
user_data
.
begin_headers_cb_called
);
CU_ASSERT
(
1
==
user_data
.
begin_headers_cb_called
);
CU_ASSERT
(
1
==
user_data
.
header_cb_called
);
CU_ASSERT
(
1
==
user_data
.
header_cb_called
);
...
@@ -950,7 +950,7 @@ void test_nghttp2_session_continue(void)
...
@@ -950,7 +950,7 @@ void test_nghttp2_session_continue(void)
recv_frame
=
user_data
.
frame
;
recv_frame
=
user_data
.
frame
;
CU_ASSERT
(
NGHTTP2_HEADERS
==
recv_frame
->
hd
.
type
);
CU_ASSERT
(
NGHTTP2_HEADERS
==
recv_frame
->
hd
.
type
);
CU_ASSERT
(
framelen2
-
NGHTTP2_FRAME_H
EAD_LENGTH
==
recv_frame
->
hd
.
length
);
CU_ASSERT
(
framelen2
-
NGHTTP2_FRAME_H
DLEN
==
recv_frame
->
hd
.
length
);
CU_ASSERT
(
1
==
user_data
.
begin_headers_cb_called
);
CU_ASSERT
(
1
==
user_data
.
begin_headers_cb_called
);
CU_ASSERT
(
1
==
user_data
.
header_cb_called
);
CU_ASSERT
(
1
==
user_data
.
header_cb_called
);
...
@@ -1002,7 +1002,7 @@ void test_nghttp2_session_continue(void)
...
@@ -1002,7 +1002,7 @@ void test_nghttp2_session_continue(void)
rv
=
nghttp2_session_mem_recv
(
session
,
rv
=
nghttp2_session_mem_recv
(
session
,
databuf
.
pos
,
nghttp2_buf_len
(
&
databuf
));
databuf
.
pos
,
nghttp2_buf_len
(
&
databuf
));
CU_ASSERT
(
16
+
NGHTTP2_FRAME_H
EAD_LENGTH
==
rv
);
CU_ASSERT
(
16
+
NGHTTP2_FRAME_H
DLEN
==
rv
);
CU_ASSERT
(
0
==
user_data
.
frame_recv_cb_called
);
CU_ASSERT
(
0
==
user_data
.
frame_recv_cb_called
);
/* Next nghttp2_session_mem_recv invokes on_frame_recv_callback and
/* Next nghttp2_session_mem_recv invokes on_frame_recv_callback and
...
@@ -1011,7 +1011,7 @@ void test_nghttp2_session_continue(void)
...
@@ -1011,7 +1011,7 @@ void test_nghttp2_session_continue(void)
user_data
.
frame_recv_cb_called
=
0
;
user_data
.
frame_recv_cb_called
=
0
;
rv
=
nghttp2_session_mem_recv
(
session
,
rv
=
nghttp2_session_mem_recv
(
session
,
databuf
.
pos
,
nghttp2_buf_len
(
&
databuf
));
databuf
.
pos
,
nghttp2_buf_len
(
&
databuf
));
CU_ASSERT
(
16
+
NGHTTP2_FRAME_H
EAD_LENGTH
==
rv
);
CU_ASSERT
(
16
+
NGHTTP2_FRAME_H
DLEN
==
rv
);
CU_ASSERT
(
1
==
user_data
.
frame_recv_cb_called
);
CU_ASSERT
(
1
==
user_data
.
frame_recv_cb_called
);
/* And finally call on_frame_recv_callback with 0 size input */
/* And finally call on_frame_recv_callback with 0 size input */
...
@@ -3638,10 +3638,10 @@ void test_nghttp2_session_flow_control_data_recv(void)
...
@@ -3638,10 +3638,10 @@ void test_nghttp2_session_flow_control_data_recv(void)
hd
.
flags
=
NGHTTP2_FLAG_END_STREAM
;
hd
.
flags
=
NGHTTP2_FLAG_END_STREAM
;
hd
.
stream_id
=
1
;
hd
.
stream_id
=
1
;
nghttp2_frame_pack_frame_hd
(
data
,
&
hd
);
nghttp2_frame_pack_frame_hd
(
data
,
&
hd
);
CU_ASSERT
(
NGHTTP2_MAX_FRAME_LENGTH
+
NGHTTP2_FRAME_H
EAD_LENGTH
==
CU_ASSERT
(
NGHTTP2_MAX_FRAME_LENGTH
+
NGHTTP2_FRAME_H
DLEN
==
nghttp2_session_mem_recv
(
session
,
data
,
nghttp2_session_mem_recv
(
session
,
data
,
NGHTTP2_MAX_FRAME_LENGTH
+
NGHTTP2_MAX_FRAME_LENGTH
+
NGHTTP2_FRAME_H
EAD_LENGTH
));
NGHTTP2_FRAME_H
DLEN
));
item
=
nghttp2_session_get_next_ob_item
(
session
);
item
=
nghttp2_session_get_next_ob_item
(
session
);
/* Since this is the last frame, stream-level WINDOW_UPDATE is not
/* Since this is the last frame, stream-level WINDOW_UPDATE is not
...
@@ -3658,10 +3658,10 @@ void test_nghttp2_session_flow_control_data_recv(void)
...
@@ -3658,10 +3658,10 @@ void test_nghttp2_session_flow_control_data_recv(void)
RST_STREAM is issued by the remote, but the local side keeps
RST_STREAM is issued by the remote, but the local side keeps
sending DATA frames. Without calculating connection-level window,
sending DATA frames. Without calculating connection-level window,
the subsequent flow control gets confused. */
the subsequent flow control gets confused. */
CU_ASSERT
(
NGHTTP2_MAX_FRAME_LENGTH
+
NGHTTP2_FRAME_H
EAD_LENGTH
==
CU_ASSERT
(
NGHTTP2_MAX_FRAME_LENGTH
+
NGHTTP2_FRAME_H
DLEN
==
nghttp2_session_mem_recv
(
session
,
data
,
nghttp2_session_mem_recv
(
session
,
data
,
NGHTTP2_MAX_FRAME_LENGTH
+
NGHTTP2_MAX_FRAME_LENGTH
+
NGHTTP2_FRAME_H
EAD_LENGTH
));
NGHTTP2_FRAME_H
DLEN
));
item
=
nghttp2_session_get_next_ob_item
(
session
);
item
=
nghttp2_session_get_next_ob_item
(
session
);
CU_ASSERT
(
NGHTTP2_WINDOW_UPDATE
==
OB_CTRL_TYPE
(
item
));
CU_ASSERT
(
NGHTTP2_WINDOW_UPDATE
==
OB_CTRL_TYPE
(
item
));
...
@@ -3699,12 +3699,12 @@ void test_nghttp2_session_flow_control_data_with_padding_recv(void)
...
@@ -3699,12 +3699,12 @@ void test_nghttp2_session_flow_control_data_with_padding_recv(void)
hd
.
stream_id
=
1
;
hd
.
stream_id
=
1
;
nghttp2_frame_pack_frame_hd
(
data
,
&
hd
);
nghttp2_frame_pack_frame_hd
(
data
,
&
hd
);
/* Add 2 byte padding (PAD_LOW itself is padding) */
/* Add 2 byte padding (PAD_LOW itself is padding) */
data
[
NGHTTP2_FRAME_H
EAD_LENGTH
]
=
1
;
data
[
NGHTTP2_FRAME_H
DLEN
]
=
1
;
data
[
NGHTTP2_FRAME_H
EAD_LENGTH
+
1
]
=
1
;
data
[
NGHTTP2_FRAME_H
DLEN
+
1
]
=
1
;
CU_ASSERT
((
ssize_t
)(
NGHTTP2_FRAME_H
EAD_LENGTH
+
hd
.
length
)
==
CU_ASSERT
((
ssize_t
)(
NGHTTP2_FRAME_H
DLEN
+
hd
.
length
)
==
nghttp2_session_mem_recv
(
session
,
data
,
nghttp2_session_mem_recv
(
session
,
data
,
NGHTTP2_FRAME_H
EAD_LENGTH
+
hd
.
length
));
NGHTTP2_FRAME_H
DLEN
+
hd
.
length
));
CU_ASSERT
((
int32_t
)
hd
.
length
==
session
->
recv_window_size
);
CU_ASSERT
((
int32_t
)
hd
.
length
==
session
->
recv_window_size
);
CU_ASSERT
((
int32_t
)
hd
.
length
==
stream
->
recv_window_size
);
CU_ASSERT
((
int32_t
)
hd
.
length
==
stream
->
recv_window_size
);
...
...
tests/nghttp2_test_helper.c
View file @
e803c6b6
...
@@ -36,8 +36,8 @@ int unpack_framebuf(nghttp2_frame *frame, nghttp2_buf *buf)
...
@@ -36,8 +36,8 @@ int unpack_framebuf(nghttp2_frame *frame, nghttp2_buf *buf)
int
unpack_frame
(
nghttp2_frame
*
frame
,
const
uint8_t
*
in
,
size_t
len
)
int
unpack_frame
(
nghttp2_frame
*
frame
,
const
uint8_t
*
in
,
size_t
len
)
{
{
ssize_t
rv
=
0
;
ssize_t
rv
=
0
;
const
uint8_t
*
payload
=
in
+
NGHTTP2_FRAME_H
EAD_LENGTH
;
const
uint8_t
*
payload
=
in
+
NGHTTP2_FRAME_H
DLEN
;
size_t
payloadlen
=
len
-
NGHTTP2_FRAME_H
EAD_LENGTH
;
size_t
payloadlen
=
len
-
NGHTTP2_FRAME_H
DLEN
;
size_t
payloadoff
;
size_t
payloadoff
;
nghttp2_frame_unpack_frame_hd
(
&
frame
->
hd
,
in
);
nghttp2_frame_unpack_frame_hd
(
&
frame
->
hd
,
in
);
...
...
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