Skip to content

Commit

Permalink
Merge pull request kubernetes#24522 from errm/automated-cherry-pick-o…
Browse files Browse the repository at this point in the history
…f-#24292-upstream-release-1.2

Automated cherry pick of kubernetes#24292
  • Loading branch information
zmerlynn committed Apr 20, 2016
2 parents 403d74e + d151af1 commit 7edb618
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/probe/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func DoHTTPProbe(url *url.URL, headers http.Header, client HTTPGetInterface) (pr
return probe.Failure, err.Error(), nil
}
req.Header = headers
if headers.Get("Host") != "" {
req.Host = headers.Get("Host")
}
res, err := client.Do(req)
if err != nil {
// Convert errors into failures to catch timeouts.
Expand Down
14 changes: 14 additions & 0 deletions pkg/probe/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ func TestHTTPProbeChecker(t *testing.T) {
"X-Muffins-Or-Cupcakes: muffins",
},
},
{
// 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"),
nil,
Expand Down

0 comments on commit 7edb618

Please sign in to comment.