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
9a89db57
Commit
9a89db57
authored
Jan 24, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Reject multiple Content-Length even if their values are identical
parent
0fcfe16d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
9 deletions
+7
-9
integration-tests/nghttpx_http1_test.go
integration-tests/nghttpx_http1_test.go
+1
-1
integration-tests/nghttpx_http2_test.go
integration-tests/nghttpx_http2_test.go
+2
-2
integration-tests/nghttpx_spdy_test.go
integration-tests/nghttpx_spdy_test.go
+1
-1
src/shrpx_downstream.cc
src/shrpx_downstream.cc
+1
-1
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+1
-2
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+1
-2
No files found.
integration-tests/nghttpx_http1_test.go
View file @
9a89db57
...
...
@@ -62,7 +62,7 @@ func TestH1H1MultipleRequestCL(t *testing.T) {
Host: %v
Test-Case: TestH1H1MultipleRequestCL
Content-Length: 0
Content-Length:
1
Content-Length:
0
`
,
st
.
authority
));
err
!=
nil
{
t
.
Fatalf
(
"Error io.WriteString() = %v"
,
err
)
...
...
integration-tests/nghttpx_http2_test.go
View file @
9a89db57
...
...
@@ -234,7 +234,7 @@ func TestH2H1MultipleRequestCL(t *testing.T) {
name
:
"TestH2H1MultipleRequestCL"
,
header
:
[]
hpack
.
HeaderField
{
pair
(
"content-length"
,
"1"
),
pair
(
"content-length"
,
"
2
"
),
pair
(
"content-length"
,
"
1
"
),
},
})
if
err
!=
nil
{
...
...
@@ -372,7 +372,7 @@ func TestH2H1GracefulShutdown(t *testing.T) {
func
TestH2H2MultipleResponseCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Header
()
.
Add
(
"content-length"
,
"1"
)
w
.
Header
()
.
Add
(
"content-length"
,
"
2
"
)
w
.
Header
()
.
Add
(
"content-length"
,
"
1
"
)
})
defer
st
.
Close
()
...
...
integration-tests/nghttpx_spdy_test.go
View file @
9a89db57
...
...
@@ -64,7 +64,7 @@ func TestS3H1MultipleRequestCL(t *testing.T) {
name
:
"TestS3H1MultipleRequestCL"
,
header
:
[]
hpack
.
HeaderField
{
pair
(
"content-length"
,
"1"
),
pair
(
"content-length"
,
"
2
"
),
pair
(
"content-length"
,
"
1
"
),
},
})
if
err
!=
nil
{
...
...
src/shrpx_downstream.cc
View file @
9a89db57
...
...
@@ -306,7 +306,7 @@ int index_headers(int *hdidx, Headers &headers, int64_t &content_length) {
if
(
len
==
-
1
)
{
return
-
1
;
}
if
(
content_length
!=
-
1
&&
content_length
!=
len
)
{
if
(
content_length
!=
-
1
)
{
return
-
1
;
}
content_length
=
len
;
...
...
src/shrpx_http2_session.cc
View file @
9a89db57
...
...
@@ -742,8 +742,7 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
downstream
->
set_response_state
(
Downstream
::
MSG_BAD_HEADER
);
return
NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
;
}
auto
cl
=
downstream
->
get_response_content_length
();
if
(
cl
!=
-
1
&&
cl
!=
len
)
{
if
(
downstream
->
get_response_content_length
()
!=
-
1
)
{
http2session
->
submit_rst_stream
(
frame
->
hd
.
stream_id
,
NGHTTP2_PROTOCOL_ERROR
);
downstream
->
set_response_state
(
Downstream
::
MSG_BAD_HEADER
);
...
...
src/shrpx_http2_upstream.cc
View file @
9a89db57
...
...
@@ -206,8 +206,7 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
}
return
0
;
}
auto
cl
=
downstream
->
get_request_content_length
();
if
(
cl
!=
-
1
&&
cl
!=
len
)
{
if
(
downstream
->
get_request_content_length
()
!=
-
1
)
{
if
(
upstream
->
error_reply
(
downstream
,
400
)
!=
0
)
{
return
NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
;
}
...
...
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