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
01586f47
Commit
01586f47
authored
Mar 22, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap small inbound buffer by nghttp_buf
parent
3c631b56
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
274 additions
and
74 deletions
+274
-74
lib/nghttp2_buf.h
lib/nghttp2_buf.h
+1
-0
lib/nghttp2_session.c
lib/nghttp2_session.c
+260
-55
lib/nghttp2_session.h
lib/nghttp2_session.h
+7
-5
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+6
-14
No files found.
lib/nghttp2_buf.h
View file @
01586f47
...
...
@@ -52,6 +52,7 @@ typedef struct {
#define nghttp2_buf_len(BUF) ((BUF)->last - (BUF)->pos)
#define nghttp2_buf_avail(BUF) ((BUF)->end - (BUF)->last)
#define nghttp2_buf_mark_avail(BUF) ((BUF)->mark - (BUF)->last)
#define nghttp2_buf_cap(BUF) ((BUF)->end - (BUF)->begin)
#define nghttp2_buf_pos_offset(BUF) ((BUF)->pos - (BUF)->begin)
...
...
lib/nghttp2_session.c
View file @
01586f47
This diff is collapsed.
Click to expand it.
lib/nghttp2_session.h
View file @
01586f47
...
...
@@ -88,18 +88,20 @@ typedef struct {
about the defined settings ID. If unknown ID is received, it is
subject to connection error */
nghttp2_settings_entry
iv
[
5
];
/* buffer pointers to small buffer, raw_sbuf */
nghttp2_buf
sbuf
;
/* buffer pointers to large buffer, raw_lbuf */
nghttp2_buf
lbuf
;
/* Large buffer, malloced on demand */
uint8_t
*
raw_lbuf
;
/* The number of entry filled in |iv| */
size_t
niv
;
/* How many bytes we still need to receive in the |buf| */
size_t
left
;
/* How many bytes we still need to receive for current frame */
size_t
payloadleft
;
/* padding length for the current frame */
size_t
padlen
;
nghttp2_inbound_state
state
;
uint8_t
buf
[
8
];
/* How many bytes have been written to |buf| */
uint8_t
buflen
;
uint8_t
raw_sbuf
[
8
];
}
nghttp2_inbound_frame
;
typedef
enum
{
...
...
tests/nghttp2_session_test.c
View file @
01586f47
...
...
@@ -1141,8 +1141,7 @@ void test_nghttp2_session_on_request_headers_received(void)
callbacks
.
on_invalid_frame_recv_callback
=
on_invalid_frame_recv_callback
;
nghttp2_session_server_new
(
&
session
,
&
callbacks
,
&
user_data
);
memset
(
session
->
iframe
.
buf
,
0
,
4
);
session
->
iframe
.
buflen
=
4
;
nghttp2_frame_headers_init
(
&
frame
.
headers
,
NGHTTP2_FLAG_END_HEADERS
|
NGHTTP2_FLAG_PRIORITY
,
stream_id
,
1
<<
20
,
NULL
,
0
);
...
...
@@ -1190,8 +1189,7 @@ void test_nghttp2_session_on_request_headers_received(void)
/* Check malformed headers. The library accept it. */
nghttp2_session_server_new
(
&
session
,
&
callbacks
,
&
user_data
);
memset
(
session
->
iframe
.
buf
,
0
,
4
);
session
->
iframe
.
buflen
=
4
;
nvlen
=
nghttp2_nv_array_copy
(
&
nva
,
malformed_nva
,
ARRLEN
(
malformed_nva
));
nghttp2_frame_headers_init
(
&
frame
.
headers
,
NGHTTP2_FLAG_END_HEADERS
|
NGHTTP2_FLAG_PRIORITY
,
...
...
@@ -1584,8 +1582,7 @@ void test_nghttp2_session_on_push_promise_received(void)
callbacks
.
on_invalid_frame_recv_callback
=
on_invalid_frame_recv_callback
;
nghttp2_session_client_new
(
&
session
,
&
callbacks
,
&
user_data
);
memset
(
session
->
iframe
.
buf
,
0
,
4
);
session
->
iframe
.
buflen
=
4
;
stream
=
nghttp2_session_open_stream
(
session
,
1
,
NGHTTP2_STREAM_FLAG_NONE
,
NGHTTP2_PRI_DEFAULT
,
NGHTTP2_STREAM_OPENING
,
NULL
);
...
...
@@ -1660,8 +1657,6 @@ void test_nghttp2_session_on_push_promise_received(void)
nghttp2_session_del
(
session
);
nghttp2_session_client_new
(
&
session
,
&
callbacks
,
&
user_data
);
memset
(
session
->
iframe
.
buf
,
0
,
4
);
session
->
iframe
.
buflen
=
4
;
stream
=
nghttp2_session_open_stream
(
session
,
1
,
NGHTTP2_STREAM_FLAG_NONE
,
NGHTTP2_PRI_DEFAULT
,
...
...
@@ -1698,8 +1693,7 @@ void test_nghttp2_session_on_push_promise_received(void)
nghttp2_session_del
(
session
);
nghttp2_session_client_new
(
&
session
,
&
callbacks
,
&
user_data
);
memset
(
session
->
iframe
.
buf
,
0
,
4
);
session
->
iframe
.
buflen
=
4
;
stream
=
nghttp2_session_open_stream
(
session
,
2
,
NGHTTP2_STREAM_FLAG_NONE
,
NGHTTP2_PRI_DEFAULT
,
NGHTTP2_STREAM_RESERVED
,
NULL
);
...
...
@@ -1721,8 +1715,7 @@ void test_nghttp2_session_on_push_promise_received(void)
/* Disable PUSH */
nghttp2_session_client_new
(
&
session
,
&
callbacks
,
&
user_data
);
memset
(
session
->
iframe
.
buf
,
0
,
4
);
session
->
iframe
.
buflen
=
4
;
stream
=
nghttp2_session_open_stream
(
session
,
1
,
NGHTTP2_STREAM_FLAG_NONE
,
NGHTTP2_PRI_DEFAULT
,
NGHTTP2_STREAM_OPENING
,
NULL
);
...
...
@@ -1746,8 +1739,7 @@ void test_nghttp2_session_on_push_promise_received(void)
/* Check malformed headers. We accept malformed headers */
nghttp2_session_client_new
(
&
session
,
&
callbacks
,
&
user_data
);
memset
(
session
->
iframe
.
buf
,
0
,
4
);
session
->
iframe
.
buflen
=
4
;
stream
=
nghttp2_session_open_stream
(
session
,
1
,
NGHTTP2_STREAM_FLAG_NONE
,
NGHTTP2_PRI_DEFAULT
,
NGHTTP2_STREAM_OPENING
,
NULL
);
...
...
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