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
b0b792e7
Commit
b0b792e7
authored
Jun 16, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integration: Add tests for x-forwarded-proto header field
parent
8aab74ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
integration-tests/nghttpx_http2_test.go
integration-tests/nghttpx_http2_test.go
+44
-0
No files found.
integration-tests/nghttpx_http2_test.go
View file @
b0b792e7
...
...
@@ -510,6 +510,28 @@ func TestH2H1SNI(t *testing.T) {
}
}
// TestH2H1TLSXfp tests nghttpx sends x-forwarded-proto header field
// with http value since :scheme is http, even if the frontend
// connection is encrypted.
func
TestH2H1TLSXfp
(
t
*
testing
.
T
)
{
st
:=
newServerTesterTLS
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
got
,
want
:=
r
.
Header
.
Get
(
"x-forwarded-proto"
),
"http"
;
got
!=
want
{
t
.
Errorf
(
"x-forwarded-proto: want %v; got %v"
,
want
,
got
)
}
})
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH2H1TLSXfp"
,
})
if
err
!=
nil
{
t
.
Fatalf
(
"Error st.http2() = %v"
,
err
)
}
if
got
,
want
:=
res
.
status
,
200
;
got
!=
want
{
t
.
Errorf
(
"res.status: %v; want %v"
,
got
,
want
)
}
}
// TestH2H1ServerPush tests server push using Link header field from
// backend server.
func
TestH2H1ServerPush
(
t
*
testing
.
T
)
{
...
...
@@ -831,3 +853,25 @@ func TestH2H2NoHostRewrite(t *testing.T) {
t
.
Errorf
(
"request-host: %v; want %v"
,
got
,
want
)
}
}
// TestH2H2TLSXfp tests nghttpx sends x-forwarded-proto header field
// with http value since :scheme is http, even if the frontend
// connection is encrypted.
func
TestH2H2TLSXfp
(
t
*
testing
.
T
)
{
st
:=
newServerTesterTLS
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
got
,
want
:=
r
.
Header
.
Get
(
"x-forwarded-proto"
),
"http"
;
got
!=
want
{
t
.
Errorf
(
"x-forwarded-proto: want %v; got %v"
,
want
,
got
)
}
})
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH2H2TLSXfp"
,
})
if
err
!=
nil
{
t
.
Fatalf
(
"Error st.http2() = %v"
,
err
)
}
if
got
,
want
:=
res
.
status
,
200
;
got
!=
want
{
t
.
Errorf
(
"res.status: %v; want %v"
,
got
,
want
)
}
}
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