Skip to content

Commit

Permalink
httplog is not a CloseNotifier
Browse files Browse the repository at this point in the history
We wrap TimeoutHandler with RecoverPanics, but httplog does not
implement http.CloseNotifier, which causes a naive watch from curl
against the insecure port to fail.

For now, implement CloseNotifier (but we should consider removing
httplog now that we have other tools in the stack to manage it).
smarterclayton committed Dec 21, 2015
1 parent 7a8b9e6 commit 0702164
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/httplog/log.go
Original file line number Diff line number Diff line change
@@ -200,6 +200,11 @@ func (rl *respLogger) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return rl.w.(http.Hijacker).Hijack()
}

// CloseNotify implements http.CloseNotifier
func (rl *respLogger) CloseNotify() <-chan bool {
return rl.w.(http.CloseNotifier).CloseNotify()
}

func (rl *respLogger) recordStatus(status int) {
rl.status = status
rl.statusRecorded = true
14 changes: 14 additions & 0 deletions test/integration/master_test.go
Original file line number Diff line number Diff line change
@@ -37,3 +37,17 @@ func TestExperimentalPrefix(t *testing.T) {
t.Fatalf("got status %v instead of 200 OK", resp.StatusCode)
}
}

func TestWatchSucceedsWithoutArgs(t *testing.T) {
_, s := framework.RunAMaster(t)
defer s.Close()

resp, err := http.Get(s.URL + "/api/v1/namespaces?watch=1")
if err != nil {
t.Fatalf("unexpected error getting experimental prefix: %v", err)
}
if resp.StatusCode != http.StatusOK {
t.Fatalf("got status %v instead of 200 OK", resp.StatusCode)
}
resp.Body.Close()
}

0 comments on commit 0702164

Please sign in to comment.