Skip to content

Commit

Permalink
Remove duplicate check
Browse files Browse the repository at this point in the history
We already compare headers case insensitive so we don't need to compare
two different cases.
  • Loading branch information
erikdubbelboer committed Feb 9, 2019
1 parent fa7a110 commit 6647cb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions header.go
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ func (h *ResponseHeader) parseHeaders(buf []byte) (int, error) {
if h.noHTTP11 && !h.connectionClose {
// close connection for non-http/1.1 response unless 'Connection: keep-alive' is set.
v := peekArgBytes(h.h, strConnection)
h.connectionClose = !hasHeaderValue(v, strKeepAlive) && !hasHeaderValue(v, strKeepAliveCamelCase)
h.connectionClose = !hasHeaderValue(v, strKeepAlive)
}

return len(buf) - len(s.b), nil
Expand Down Expand Up @@ -1947,7 +1947,7 @@ func (h *RequestHeader) parseHeaders(buf []byte) (int, error) {
if h.noHTTP11 && !h.connectionClose {
// close connection for non-http/1.1 request unless 'Connection: keep-alive' is set.
v := peekArgBytes(h.h, strConnection)
h.connectionClose = !hasHeaderValue(v, strKeepAlive) && !hasHeaderValue(v, strKeepAliveCamelCase)
h.connectionClose = !hasHeaderValue(v, strKeepAlive)
}
return s.hLen, nil
}
Expand Down
3 changes: 1 addition & 2 deletions strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ var (
strCookieSameSite = []byte("SameSite")
strCookieSameSiteLax = []byte("Lax")
strCookieSameSiteStrict = []byte("Strict")

strClose = []byte("close")
strGzip = []byte("gzip")
strDeflate = []byte("deflate")
strKeepAlive = []byte("keep-alive")
strKeepAliveCamelCase = []byte("Keep-Alive")
strUpgrade = []byte("Upgrade")
strChunked = []byte("chunked")
strIdentity = []byte("identity")
Expand Down

0 comments on commit 6647cb2

Please sign in to comment.