Skip to content

Commit

Permalink
net/http: remove unused method needsSniff
Browse files Browse the repository at this point in the history
Change-Id: Ia8c67d148fc7e71cac8954ccce6fffb8a6f423df
GitHub-Last-Rev: 9441b8f
GitHub-Pull-Request: golang#54036
Reviewed-on: https://go-review.googlesource.com/c/go/+/419322
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Javad Rajabzadeh <ja7ad@live.com>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
  • Loading branch information
Abirdcfly authored and jproberts committed Aug 10, 2022
1 parent 14bc690 commit dbe7192
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
13 changes: 0 additions & 13 deletions src/net/http/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,19 +972,6 @@ func matchErr(err error, wantErr any) error {
return fmt.Errorf("%v; want %v", err, wantErr)
}

func TestNeedsSniff(t *testing.T) {
// needsSniff returns true with an empty response.
r := &response{}
if got, want := r.needsSniff(), true; got != want {
t.Errorf("needsSniff = %t; want %t", got, want)
}
// needsSniff returns false when Content-Type = nil.
r.handlerHeader = Header{"Content-Type": nil}
if got, want := r.needsSniff(), false; got != want {
t.Errorf("needsSniff empty Content-Type = %t; want %t", got, want)
}
}

// A response should only write out single Connection: close header. Tests #19499.
func TestResponseWritesOnlySingleConnectionClose(t *testing.T) {
const connectionCloseHeader = "Connection: close"
Expand Down
6 changes: 0 additions & 6 deletions src/net/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,6 @@ func (w *response) requestTooLarge() {
}
}

// needsSniff reports whether a Content-Type still needs to be sniffed.
func (w *response) needsSniff() bool {
_, haveType := w.handlerHeader["Content-Type"]
return !w.cw.wroteHeader && !haveType && w.written < sniffLen
}

// writerOnly hides an io.Writer value's optional ReadFrom method
// from io.Copy.
type writerOnly struct {
Expand Down

0 comments on commit dbe7192

Please sign in to comment.