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
f9c60d5e
Commit
f9c60d5e
authored
Jun 09, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Return 501 if invalid method is received on h1 frontend
parent
c2ca04c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
integration-tests/nghttpx_http1_test.go
integration-tests/nghttpx_http1_test.go
+21
-0
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+3
-1
No files found.
integration-tests/nghttpx_http1_test.go
View file @
f9c60d5e
...
...
@@ -52,6 +52,27 @@ func TestH1H1PlainGETClose(t *testing.T) {
}
}
// TestH1H1InvalidMethod tests that server rejects invalid method with
// 501 status code
func
TestH1H1InvalidMethod
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
t
.
Errorf
(
"server should not forward this request"
)
})
defer
st
.
Close
()
res
,
err
:=
st
.
http1
(
requestParam
{
name
:
"TestH1H1InvalidMethod"
,
method
:
"get"
,
})
if
err
!=
nil
{
t
.
Fatalf
(
"Error st.http1() = %v"
,
err
)
}
if
got
,
want
:=
res
.
status
,
501
;
got
!=
want
{
t
.
Errorf
(
"status = %v; want %v"
,
got
,
want
)
}
}
// TestH1H1MultipleRequestCL tests that server rejects request which
// contains multiple Content-Length header fields.
func
TestH1H1MultipleRequestCL
(
t
*
testing
.
T
)
{
...
...
src/shrpx_https_upstream.cc
View file @
f9c60d5e
...
...
@@ -460,7 +460,9 @@ int HttpsUpstream::on_read() {
unsigned
int
status_code
;
if
(
downstream
)
{
if
(
htperr
==
HPE_INVALID_METHOD
)
{
status_code
=
501
;
}
else
if
(
downstream
)
{
if
(
downstream
->
get_request_state
()
==
Downstream
::
CONNECT_FAIL
)
{
status_code
=
503
;
}
else
if
(
downstream
->
get_request_state
()
==
...
...
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