Skip to content

Commit

Permalink
vendor, net/http: update x/net for httplex to httpguts merge
Browse files Browse the repository at this point in the history
Updates x/net to git rev cbb82b59bc for:

    lex/httplex, http/httpguts: merge the httplex package into httpguts
    https://golang.org/cl/111875

    http2: set nextStreamID to 3 when AllowHTTP is set
    https://golang.org/cl/111835

    http2: terminate await request cancel goroutine on conn close
    https://golang.org/cl/108415

Fixes #24776 (CL 111655 didn't actually include it)

Change-Id: I0a21e169ebba2ec35219f347f1e31cd4c67bebdf
Reviewed-on: https://go-review.googlesource.com/111876
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Kunpei Sakai <namusyaka@gmail.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
  • Loading branch information
bradfitz committed May 7, 2018
1 parent 9b16b9c commit 8e9386d
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/go/build/deps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ var pkgDeps = map[string][]string{
"golang_org/x/net/http/httpguts",
"golang_org/x/net/http2/hpack",
"golang_org/x/net/idna",
"golang_org/x/net/lex/httplex",
"golang_org/x/text/unicode/norm",
"golang_org/x/text/width",
"internal/nettrace",
Expand Down
30 changes: 19 additions & 11 deletions src/net/http/h2_bundle.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/net/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"time"
"unicode/utf8"

"golang_org/x/net/lex/httplex"
"golang_org/x/net/http/httpguts"
)

// maxInt64 is the effective "infinite" value for the Server and
Expand Down Expand Up @@ -47,7 +47,7 @@ func removeEmptyPort(host string) string {
}

func isNotToken(r rune) bool {
return !httplex.IsTokenRune(r)
return !httpguts.IsTokenRune(r)
}

func isASCII(s string) bool {
Expand Down
7 changes: 3 additions & 4 deletions src/net/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"time"

"golang_org/x/net/http/httpguts"
"golang_org/x/net/lex/httplex"
)

// Errors used by the HTTP server.
Expand Down Expand Up @@ -964,15 +963,15 @@ func (c *conn) readRequest(ctx context.Context) (w *response, err error) {
if len(hosts) > 1 {
return nil, badRequestError("too many Host headers")
}
if len(hosts) == 1 && !httplex.ValidHostHeader(hosts[0]) {
if len(hosts) == 1 && !httpguts.ValidHostHeader(hosts[0]) {
return nil, badRequestError("malformed Host header")
}
for k, vv := range req.Header {
if !httplex.ValidHeaderFieldName(k) {
if !httpguts.ValidHeaderFieldName(k) {
return nil, badRequestError("invalid header name")
}
for _, v := range vv {
if !httplex.ValidHeaderFieldValue(v) {
if !httpguts.ValidHeaderFieldValue(v) {
return nil, badRequestError("invalid header value")
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/net/http/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"sync"
"time"

"golang_org/x/net/lex/httplex"
"golang_org/x/net/http/httpguts"
)

// ErrLineTooLong is returned when reading request or response bodies
Expand Down Expand Up @@ -690,9 +690,9 @@ func shouldClose(major, minor int, header Header, removeCloseHeader bool) bool {
}

conv := header["Connection"]
hasClose := httplex.HeaderValuesContainsToken(conv, "close")
hasClose := httpguts.HeaderValuesContainsToken(conv, "close")
if major == 1 && minor == 0 {
return hasClose || !httplex.HeaderValuesContainsToken(conv, "keep-alive")
return hasClose || !httpguts.HeaderValuesContainsToken(conv, "keep-alive")
}

if hasClose && removeCloseHeader {
Expand Down
6 changes: 3 additions & 3 deletions src/net/http/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"sync/atomic"
"time"

"golang_org/x/net/lex/httplex"
"golang_org/x/net/http/httpguts"
)

// DefaultTransport is the default implementation of Transport and is
Expand Down Expand Up @@ -363,11 +363,11 @@ func (t *Transport) RoundTrip(req *Request) (*Response, error) {
isHTTP := scheme == "http" || scheme == "https"
if isHTTP {
for k, vv := range req.Header {
if !httplex.ValidHeaderFieldName(k) {
if !httpguts.ValidHeaderFieldName(k) {
return nil, fmt.Errorf("net/http: invalid header field name %q", k)
}
for _, v := range vv {
if !httplex.ValidHeaderFieldValue(v) {
if !httpguts.ValidHeaderFieldValue(v) {
return nil, fmt.Errorf("net/http: invalid header field value %q for key %v", v, k)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package httplex contains rules around lexical matters of various
// HTTP-related specifications.
//
// This package is shared by the standard library (which vendors it)
// and x/net/http2. It comes with no API stability promise.
package httplex
package httpguts

import (
"net"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package httplex
package httpguts

import (
"testing"
Expand Down

0 comments on commit 8e9386d

Please sign in to comment.