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
eb2856f3
Commit
eb2856f3
authored
Feb 11, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add inbound_frame_reset_left() not to forget to reset iframe->buflen
parent
9865b469
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
18 deletions
+24
-18
lib/nghttp2_session.c
lib/nghttp2_session.c
+24
-18
No files found.
lib/nghttp2_session.c
View file @
eb2856f3
...
@@ -3340,6 +3340,17 @@ static size_t inbound_frame_payload_readlen(nghttp2_inbound_frame *iframe,
...
@@ -3340,6 +3340,17 @@ static size_t inbound_frame_payload_readlen(nghttp2_inbound_frame *iframe,
return
nghttp2_min
((
size_t
)(
last
-
in
),
iframe
->
payloadleft
);
return
nghttp2_min
((
size_t
)(
last
-
in
),
iframe
->
payloadleft
);
}
}
/*
* Resets iframe->left to |left| and iframe->buflen to 0 for the next
* short buffering.
*/
static
void
inbound_frame_reset_left
(
nghttp2_inbound_frame
*
iframe
,
size_t
left
)
{
iframe
->
left
=
left
;
iframe
->
buflen
=
0
;
}
static
size_t
inbound_frame_buf_read
(
nghttp2_inbound_frame
*
iframe
,
static
size_t
inbound_frame_buf_read
(
nghttp2_inbound_frame
*
iframe
,
const
uint8_t
*
in
,
const
uint8_t
*
last
)
const
uint8_t
*
in
,
const
uint8_t
*
last
)
{
{
...
@@ -3395,13 +3406,11 @@ static int inbound_frame_handle_pad(nghttp2_inbound_frame *iframe,
...
@@ -3395,13 +3406,11 @@ static int inbound_frame_handle_pad(nghttp2_inbound_frame *iframe,
if
((
hd
->
flags
&
NGHTTP2_FLAG_PAD_LOW
)
==
0
)
{
if
((
hd
->
flags
&
NGHTTP2_FLAG_PAD_LOW
)
==
0
)
{
return
-
1
;
return
-
1
;
}
}
iframe
->
left
=
2
;
inbound_frame_reset_left
(
iframe
,
2
);
iframe
->
buflen
=
0
;
return
1
;
return
1
;
}
}
if
(
hd
->
flags
&
NGHTTP2_FLAG_PAD_LOW
)
{
if
(
hd
->
flags
&
NGHTTP2_FLAG_PAD_LOW
)
{
iframe
->
left
=
1
;
inbound_frame_reset_left
(
iframe
,
1
);
iframe
->
buflen
=
0
;
return
1
;
return
1
;
}
}
DEBUGF
(
fprintf
(
stderr
,
"no padding
\n
"
));
DEBUGF
(
fprintf
(
stderr
,
"no padding
\n
"
));
...
@@ -3478,7 +3487,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3478,7 +3487,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
nghttp2_frame_unpack_frame_hd
(
&
iframe
->
frame
.
hd
,
iframe
->
buf
);
nghttp2_frame_unpack_frame_hd
(
&
iframe
->
frame
.
hd
,
iframe
->
buf
);
iframe
->
payloadleft
=
iframe
->
frame
.
hd
.
length
;
iframe
->
payloadleft
=
iframe
->
frame
.
hd
.
length
;
iframe
->
buflen
=
0
;
switch
(
iframe
->
frame
.
hd
.
type
)
{
switch
(
iframe
->
frame
.
hd
.
type
)
{
case
NGHTTP2_DATA
:
{
case
NGHTTP2_DATA
:
{
...
@@ -3537,7 +3545,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3537,7 +3545,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
break
;
break
;
}
}
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
i
frame
->
left
=
4
;
i
nbound_frame_reset_left
(
iframe
,
4
)
;
break
;
break
;
}
}
rv
=
session_process_headers_frame
(
session
);
rv
=
session_process_headers_frame
(
session
);
...
@@ -3560,7 +3568,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3560,7 +3568,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
break
;
break
;
}
}
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
i
frame
->
left
=
4
;
i
nbound_frame_reset_left
(
iframe
,
4
)
;
break
;
break
;
case
NGHTTP2_SETTINGS
:
case
NGHTTP2_SETTINGS
:
DEBUGF
(
fprintf
(
stderr
,
"SETTINGS
\n
"
));
DEBUGF
(
fprintf
(
stderr
,
"SETTINGS
\n
"
));
...
@@ -3573,11 +3581,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3573,11 +3581,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
}
}
iframe
->
state
=
NGHTTP2_IB_READ_SETTINGS
;
iframe
->
state
=
NGHTTP2_IB_READ_SETTINGS
;
if
(
iframe
->
payloadleft
)
{
if
(
iframe
->
payloadleft
)
{
iframe
->
left
=
NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH
;
inbound_frame_reset_left
(
iframe
,
NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH
);
break
;
break
;
}
}
busy
=
1
;
busy
=
1
;
i
frame
->
left
=
0
;
i
nbound_frame_reset_left
(
iframe
,
0
)
;
break
;
break
;
case
NGHTTP2_PUSH_PROMISE
:
case
NGHTTP2_PUSH_PROMISE
:
if
(
iframe
->
payloadleft
<
4
)
{
if
(
iframe
->
payloadleft
<
4
)
{
...
@@ -3586,7 +3595,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3586,7 +3595,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
break
;
break
;
}
}
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
i
frame
->
left
=
4
;
i
nbound_frame_reset_left
(
iframe
,
4
)
;
break
;
break
;
case
NGHTTP2_PING
:
case
NGHTTP2_PING
:
if
(
iframe
->
payloadleft
!=
8
)
{
if
(
iframe
->
payloadleft
!=
8
)
{
...
@@ -3595,7 +3604,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3595,7 +3604,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
break
;
break
;
}
}
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
i
frame
->
left
=
8
;
i
nbound_frame_reset_left
(
iframe
,
8
)
;
break
;
break
;
case
NGHTTP2_GOAWAY
:
case
NGHTTP2_GOAWAY
:
if
(
iframe
->
payloadleft
<
8
)
{
if
(
iframe
->
payloadleft
<
8
)
{
...
@@ -3604,7 +3613,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3604,7 +3613,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
break
;
break
;
}
}
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
i
frame
->
left
=
8
;
i
nbound_frame_reset_left
(
iframe
,
8
)
;
break
;
break
;
default:
default:
/* Receiving unknown frame type and CONTINUATION in this state
/* Receiving unknown frame type and CONTINUATION in this state
...
@@ -3667,8 +3676,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3667,8 +3676,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
break
;
break
;
}
}
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
iframe
->
state
=
NGHTTP2_IB_READ_NBYTE
;
iframe
->
left
=
4
;
inbound_frame_reset_left
(
iframe
,
4
);
iframe
->
buflen
=
0
;
break
;
break
;
}
}
}
}
...
@@ -3814,9 +3822,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3814,9 +3822,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
break
;
break
;
}
}
if
((
iframe
->
frame
.
hd
.
flags
&
NGHTTP2_FLAG_END_HEADERS
)
==
0
)
{
if
((
iframe
->
frame
.
hd
.
flags
&
NGHTTP2_FLAG_END_HEADERS
)
==
0
)
{
i
frame
->
left
=
NGHTTP2_FRAME_HEAD_LENGTH
;
i
nbound_frame_reset_left
(
iframe
,
NGHTTP2_FRAME_HEAD_LENGTH
)
;
iframe
->
error_code
=
0
;
iframe
->
error_code
=
0
;
iframe
->
buflen
=
0
;
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
;
...
@@ -3883,8 +3890,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
...
@@ -3883,8 +3890,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
}
}
}
}
if
(
iframe
->
payloadleft
)
{
if
(
iframe
->
payloadleft
)
{
iframe
->
left
=
NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH
;
inbound_frame_reset_left
(
iframe
,
NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH
);
iframe
->
buflen
=
0
;
break
;
break
;
}
}
rv
=
session_process_settings_frame
(
session
);
rv
=
session_process_settings_frame
(
session
);
...
...
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