From 5a0a231c029de1b1c5137f8c1db62696950524e4 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Tue, 8 May 2018 14:00:31 +0900 Subject: [PATCH] use H2 helper functions from httpguts repository httplex was merged into httpguts: https://github.com/golang/net/commit/cbb82b59bc5199680c5bf34109e12097095dca9b --- h2quic/request_writer.go | 8 ++++---- h2quic/roundtrip.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/h2quic/request_writer.go b/h2quic/request_writer.go index ddaaa741d..b5ee97513 100644 --- a/h2quic/request_writer.go +++ b/h2quic/request_writer.go @@ -8,9 +8,9 @@ import ( "strings" "sync" + "golang.org/x/net/http/httpguts" "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" - "golang.org/x/net/lex/httplex" quic "github.com/lucas-clemente/quic-go" "github.com/lucas-clemente/quic-go/internal/protocol" @@ -65,7 +65,7 @@ func (w *requestWriter) encodeHeaders(req *http.Request, addGzipHeader bool, tra if host == "" { host = req.URL.Host } - host, err := httplex.PunycodeHostPort(host) + host, err := httpguts.PunycodeHostPort(host) if err != nil { return nil, err } @@ -89,11 +89,11 @@ func (w *requestWriter) encodeHeaders(req *http.Request, addGzipHeader bool, tra // potentially pollute our hpack state. (We want to be able to // continue to reuse the hpack encoder for future requests) for k, vv := range req.Header { - if !httplex.ValidHeaderFieldName(k) { + if !httpguts.ValidHeaderFieldName(k) { return nil, fmt.Errorf("invalid HTTP header name %q", k) } for _, v := range vv { - if !httplex.ValidHeaderFieldValue(v) { + if !httpguts.ValidHeaderFieldValue(v) { return nil, fmt.Errorf("invalid HTTP header value %q for header %q", v, k) } } diff --git a/h2quic/roundtrip.go b/h2quic/roundtrip.go index f6c170b0a..27732b5e4 100644 --- a/h2quic/roundtrip.go +++ b/h2quic/roundtrip.go @@ -11,7 +11,7 @@ import ( quic "github.com/lucas-clemente/quic-go" - "golang.org/x/net/lex/httplex" + "golang.org/x/net/http/httpguts" ) type roundTripCloser interface { @@ -80,11 +80,11 @@ func (r *RoundTripper) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http. if req.URL.Scheme == "https" { for k, vv := range req.Header { - if !httplex.ValidHeaderFieldName(k) { + if !httpguts.ValidHeaderFieldName(k) { return nil, fmt.Errorf("quic: invalid http header field name %q", k) } for _, v := range vv { - if !httplex.ValidHeaderFieldValue(v) { + if !httpguts.ValidHeaderFieldValue(v) { return nil, fmt.Errorf("quic: invalid http header field value %q for key %v", v, k) } } @@ -175,5 +175,5 @@ func validMethod(method string) bool { // copied from net/http/http.go func isNotToken(r rune) bool { - return !httplex.IsTokenRune(r) + return !httpguts.IsTokenRune(r) }