Shouldn't require space in HTTP host header (#6743)

Fixes #6741
master
kannappanr 6 years ago committed by GitHub
parent 89b14639a9
commit d9cfa5fcd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      cmd/http/listener.go

@ -141,8 +141,8 @@ func getMethodResourceHost(bufConn *BufConn, maxHeaderBytes int) (method string,
// HTTP headers are case insensitive, so we should simply convert // HTTP headers are case insensitive, so we should simply convert
// each tokens to their lower case form to match 'host' header. // each tokens to their lower case form to match 'host' header.
token = strings.ToLower(token) token = strings.ToLower(token)
if strings.HasPrefix(token, "host: ") { if strings.HasPrefix(token, "host:") {
host = strings.TrimPrefix(strings.TrimSuffix(token, "\r"), "host: ") host = strings.TrimPrefix(strings.TrimSuffix(token, "\r"), "host:")
return method, resource, host, nil return method, resource, host, nil
} }
} }

Loading…
Cancel
Save