2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-11-09 19:21:52 +08:00

Implement the matcher HTTP1 fields

This commit adds the implementation for HTTP 1 header fields.
This commit is contained in:
Soheil Hassas Yeganeh 2015-07-29 14:49:37 -04:00
parent 98f6f6f272
commit cc3a35aef1

View File

@ -121,7 +121,12 @@ func hasHTTP2Preface(r io.Reader) (ok bool) {
} }
func matchHTTP1Field(r io.Reader, name, value string) (matched bool) { func matchHTTP1Field(r io.Reader, name, value string) (matched bool) {
return req, err := http.ReadRequest(bufio.NewReader(r))
if err != nil {
return false
}
return req.Header.Get(name) == value
} }
func matchHTTP2Field(r io.Reader, name, value string) (matched bool) { func matchHTTP2Field(r io.Reader, name, value string) (matched bool) {