Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e8bd081e
Commit
e8bd081e
authored
Apr 19, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24292 from errm/fix-http-get-host-header
Automatic merge from submit-queue Allow setting the Host header in a httpGet probe
parents
265c7df3
55b1ae85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
http.go
pkg/probe/http/http.go
+3
-0
http_test.go
pkg/probe/http/http_test.go
+14
-0
No files found.
pkg/probe/http/http.go
View file @
e8bd081e
...
@@ -64,6 +64,9 @@ func DoHTTPProbe(url *url.URL, headers http.Header, client HTTPGetInterface) (pr
...
@@ -64,6 +64,9 @@ func DoHTTPProbe(url *url.URL, headers http.Header, client HTTPGetInterface) (pr
return
probe
.
Failure
,
err
.
Error
(),
nil
return
probe
.
Failure
,
err
.
Error
(),
nil
}
}
req
.
Header
=
headers
req
.
Header
=
headers
if
headers
.
Get
(
"Host"
)
!=
""
{
req
.
Host
=
headers
.
Get
(
"Host"
)
}
res
,
err
:=
client
.
Do
(
req
)
res
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
// Convert errors into failures to catch timeouts.
// Convert errors into failures to catch timeouts.
...
...
pkg/probe/http/http_test.go
View file @
e8bd081e
...
@@ -86,6 +86,20 @@ func TestHTTPProbeChecker(t *testing.T) {
...
@@ -86,6 +86,20 @@ func TestHTTPProbeChecker(t *testing.T) {
},
},
},
},
{
{
// Echo handler that returns the contents of Host in the body
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
WriteHeader
(
200
)
w
.
Write
([]
byte
(
r
.
Host
))
},
http
.
Header
{
"Host"
:
{
"muffins.cupcakes.org"
},
},
probe
.
Success
,
[]
string
{
"muffins.cupcakes.org"
,
},
},
{
handleReq
(
FailureCode
,
"fail body"
),
handleReq
(
FailureCode
,
"fail body"
),
nil
,
nil
,
probe
.
Failure
,
probe
.
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