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
cb73ba94
Commit
cb73ba94
authored
Dec 20, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify HEADERS handling; handle push response in one function
parent
e9571472
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
+13
-19
lib/nghttp2_session.c
lib/nghttp2_session.c
+13
-19
No files found.
lib/nghttp2_session.c
View file @
cb73ba94
...
@@ -3534,6 +3534,12 @@ int nghttp2_session_on_push_response_headers_received(nghttp2_session *session,
...
@@ -3534,6 +3534,12 @@ int nghttp2_session_on_push_response_headers_received(nghttp2_session *session,
"push response HEADERS: stream_id == 0"
);
"push response HEADERS: stream_id == 0"
);
}
}
if
(
session
->
server
)
{
return
session_inflate_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"HEADERS: no HEADERS allowed from client in reserved state"
);
}
if
(
session_is_incoming_concurrent_streams_max
(
session
))
{
if
(
session_is_incoming_concurrent_streams_max
(
session
))
{
return
session_inflate_handle_invalid_connection
(
return
session_inflate_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
session
,
frame
,
NGHTTP2_ERR_PROTO
,
...
@@ -3570,14 +3576,6 @@ int nghttp2_session_on_headers_received(nghttp2_session *session,
...
@@ -3570,14 +3576,6 @@ int nghttp2_session_on_headers_received(nghttp2_session *session,
return
session_inflate_handle_invalid_connection
(
return
session_inflate_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"HEADERS: stream_id == 0"
);
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"HEADERS: stream_id == 0"
);
}
}
if
(
stream
->
state
==
NGHTTP2_STREAM_RESERVED
)
{
/* reserved. The valid push response HEADERS is processed by
nghttp2_session_on_push_response_headers_received(). This
generic HEADERS is called invalid cases for HEADERS against
reserved state. */
return
session_inflate_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"HEADERS: stream in reserved"
);
}
if
((
stream
->
shut_flags
&
NGHTTP2_SHUT_RD
))
{
if
((
stream
->
shut_flags
&
NGHTTP2_SHUT_RD
))
{
/* half closed (remote): from the spec:
/* half closed (remote): from the spec:
...
@@ -3634,22 +3632,18 @@ static int session_process_headers_frame(nghttp2_session *session) {
...
@@ -3634,22 +3632,18 @@ static int session_process_headers_frame(nghttp2_session *session) {
return
nghttp2_session_on_request_headers_received
(
session
,
frame
);
return
nghttp2_session_on_request_headers_received
(
session
,
frame
);
}
}
if
(
nghttp2_session_is_my_stream_id
(
session
,
frame
->
hd
.
stream_id
))
{
if
(
stream
->
state
==
NGHTTP2_STREAM_OPENING
)
{
frame
->
headers
.
cat
=
NGHTTP2_HCAT_RESPONSE
;
return
nghttp2_session_on_response_headers_received
(
session
,
frame
,
stream
);
}
/* This handles the case when server received HEADERS for stream
in reserved stream from client. That is protocol error. */
frame
->
headers
.
cat
=
NGHTTP2_HCAT_HEADERS
;
return
nghttp2_session_on_headers_received
(
session
,
frame
,
stream
);
}
if
(
stream
->
state
==
NGHTTP2_STREAM_RESERVED
)
{
if
(
stream
->
state
==
NGHTTP2_STREAM_RESERVED
)
{
frame
->
headers
.
cat
=
NGHTTP2_HCAT_PUSH_RESPONSE
;
frame
->
headers
.
cat
=
NGHTTP2_HCAT_PUSH_RESPONSE
;
return
nghttp2_session_on_push_response_headers_received
(
session
,
frame
,
return
nghttp2_session_on_push_response_headers_received
(
session
,
frame
,
stream
);
stream
);
}
}
if
(
stream
->
state
==
NGHTTP2_STREAM_OPENING
&&
nghttp2_session_is_my_stream_id
(
session
,
frame
->
hd
.
stream_id
))
{
frame
->
headers
.
cat
=
NGHTTP2_HCAT_RESPONSE
;
return
nghttp2_session_on_response_headers_received
(
session
,
frame
,
stream
);
}
frame
->
headers
.
cat
=
NGHTTP2_HCAT_HEADERS
;
frame
->
headers
.
cat
=
NGHTTP2_HCAT_HEADERS
;
return
nghttp2_session_on_headers_received
(
session
,
frame
,
stream
);
return
nghttp2_session_on_headers_received
(
session
,
frame
,
stream
);
}
}
...
...
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