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
b8a01f52
Commit
b8a01f52
authored
Aug 21, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Require content-length in HTTP2 upstream if END_STREAM flag is not set
parent
823bb6c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+13
-2
No files found.
src/shrpx_http2_upstream.cc
View file @
b8a01f52
...
@@ -208,7 +208,8 @@ void on_frame_recv_callback
...
@@ -208,7 +208,8 @@ void on_frame_recv_callback
}
}
// Assuming that nva is sorted by name.
// Assuming that nva is sorted by name.
const
char
*
req_headers
[]
=
{
":host"
,
":method"
,
":path"
,
":scheme"
};
const
char
*
req_headers
[]
=
{
":host"
,
":method"
,
":path"
,
":scheme"
,
"content-length"
};
const
size_t
req_hdlen
=
sizeof
(
req_headers
)
/
sizeof
(
req_headers
[
0
]);
const
size_t
req_hdlen
=
sizeof
(
req_headers
)
/
sizeof
(
req_headers
[
0
]);
int
req_hdidx
[
req_hdlen
];
int
req_hdidx
[
req_hdlen
];
memset
(
req_hdidx
,
-
1
,
sizeof
(
req_hdidx
));
memset
(
req_hdidx
,
-
1
,
sizeof
(
req_hdidx
));
...
@@ -243,13 +244,23 @@ void on_frame_recv_callback
...
@@ -243,13 +244,23 @@ void on_frame_recv_callback
}
}
if
(
!
bad_req
)
{
if
(
!
bad_req
)
{
// Here :scheme is optional, because with CONNECT method, it
// Here :scheme is optional, because with CONNECT method, it
// is omitted.
// is omitted. content-length is mandatory if END_STREAM is
// not set.
for
(
j
=
0
;
j
<
3
;
++
j
)
{
for
(
j
=
0
;
j
<
3
;
++
j
)
{
if
(
req_hdidx
[
j
]
==
-
1
)
{
if
(
req_hdidx
[
j
]
==
-
1
)
{
bad_req
=
true
;
bad_req
=
true
;
break
;
break
;
}
}
}
}
if
((
frame
->
hd
.
flags
&
NGHTTP2_FLAG_END_STREAM
)
==
0
&&
req_hdidx
[
4
]
==
-
1
)
{
// If content-length is missing,
// Downstream::push_upload_data_chunk will fail and
// RST_STREAM will be sent. Therefore, error reply in
// HEADERS may not be sent. So just issue RST_STREAM here.
upstream
->
rst_stream
(
downstream
,
NGHTTP2_PROTOCOL_ERROR
);
return
;
}
}
}
if
(
!
bad_req
)
{
if
(
!
bad_req
)
{
for
(;
i
<
frame
->
headers
.
nvlen
;
++
i
)
{
for
(;
i
<
frame
->
headers
.
nvlen
;
++
i
)
{
...
...
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