The http2.Transport was able to send bogus header keys & values.
This changes rejects them earlier, before they hit the wire.
In the process, mirror the lexical rules from the http package to x/net.
Maintaining two copies has gotten increasingly annoying.
Updates golang/go#14048
Change-Id: I20abcdeea92e7dc8706a1bbd60688ee8843a2b12
Reviewed-on: https://go-review.googlesource.com/23229
Reviewed-by: Andrew Gerrand <adg@golang.org>
This change introduces a package that provides the basic manipulation of
routing facilities on BSD variants.
Unlike the existing APIs in syscall package of standard library, the
package tries to provide operating system and its architecture agnostic
APIs. At present, the package supports any version of Darwin, any
version of DragonFly BSD, FreeBSD 7 through 11, NetBSD 6 and above, and
OpenBSD 5.6 and above.
Updates golang/go#14724.
Change-Id: Id964ea22dec491ddac3776e3a8c8c10f140f96ac
Reviewed-on: https://go-review.googlesource.com/22446
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change fixes a few bugs in the HPACK decoder:
* Excess trailing padding is treated as an error per the HPACK Spec
section 5.2
* Non EOS prefix padding is treated as an error
* Max length is now enforced for all decoded symbols
The idea here is to keep track of the decoded symbol length, rather
than the number of unconsumed bits in cur. To this end, nbits has
been renamed cbits (cur bits), and sbits (sym bits) has been
introduced. The main problem with using nbits is that it can easily
be zero, such as when decoding {0xff, 0xff}. Using a clear moniker
makes it easier to see why checking cbits > 0 at the end of the
function is incorrect.
Fixesgolang/go#15614
Change-Id: I1ae868caa9c207fcf9c9dec7f10ee9f400211f99
Reviewed-on: https://go-review.googlesource.com/23067
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Go 1.7 introduces Request.Context and Response.Uncompressed. Use them
both in the http2 Transport when building for Go 1.7.
Tests are in the main repo.
Updates golang/go#15366
Updates golang/go#15134
Change-Id: I4b78a2710b6cf30c769c7f85cea15ecde653a317
Reviewed-on: https://go-review.googlesource.com/23002
Reviewed-by: Andrew Gerrand <adg@golang.org>
Abbreviating "if and only if" to "iff" is against Go style in public
documentation; use expanded form.
Change-Id: I23afdca1b773ef9572794555dfb768c9ded90ab7
Reviewed-on: https://go-review.googlesource.com/22545
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This was always a no-op in 1.4 and earlier. This change directly
inlines the 1.5 version.
Change-Id: I6dcf69497d876d7dde729c1801cef5382b97fa07
Reviewed-on: https://go-review.googlesource.com/22388
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The Go 1.4 (and earlier) support for request cancellation is racy and
complicates the implementation of ctxhttp. This change simply inlines
the existing 1.5+ cancellation logic directly, and removes support for
older versions.
Change-Id: I7df9f0648dd0e571366374d079e2976050464ca3
Reviewed-on: https://go-review.googlesource.com/22302
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
In particular, the Property and DeadPropsHolder types need to refer to
the standard xml package, not the internal fork, to be usable by other
packages.
Inside the package, the XML marshaling and unmarshaling is still done by
the etc/internal/xml package, and will remain that way until
https://github.com/golang/go/issues/13400 is resolved.
Fixesgolang/go#15128.
Change-Id: Ie7e7927d8b30d97d10b1a4a654d774fdf3e7a1e3
Reviewed-on: https://go-review.googlesource.com/21635
Reviewed-by: Andrew Gerrand <adg@golang.org>
There is no semantic change to this commit. A follow-up commit will
change this package's behavior, but this preparatory commit will make
the follow-up's diff smaller, and less noisy.
Change-Id: I12e356fc1f29d3c4a7c3374aab4a1b1eefe01144
Reviewed-on: https://go-review.googlesource.com/21631
Reviewed-by: Andrew Gerrand <adg@golang.org>
During the Go 1.5 development cycle, this package used to require the
standard library's encoding/xml package from Go 1.5 or later, but
https://go-review.googlesource.com/#/c/12772/ (which was submitted in
July 2015) made an internal fork of encoding/xml, as some
namespace related changes introduced in the Go 1.5 cycle were rolled
back in response to https://github.com/golang/go/issues/11841
Thus, this "go1.4" runtime check is no longer necessary. In the long
term, this package should use the standard library's version, and the
internal fork deleted, once https://github.com/golang/go/issues/13400 is
resolved. We could re-introduce a similar check at that time, although
it could be done at compile time (via a "go1.7" build tag) instead of at
runtime.
Change-Id: I18258443aa3d9b519e23106aedb189f25c35495d
Reviewed-on: https://go-review.googlesource.com/21634
Reviewed-by: Andrew Gerrand <adg@golang.org>
The instruction itself doesn't care what the bits it's twiddling represents,
even though the it was introduced to more efficiently manipulate IPv4 packets.
Change-Id: Ie65a6df4041ad2090060636ccf7128680fcf75b7
Reviewed-on: https://go-review.googlesource.com/21244
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Backtick is my screen metakey, so this got lost in a copy/paste
at the backtick symbol.
Change-Id: Ia3e7bf5d2819ea83ff6cc86cc3b6210e3f279eb0
Reviewed-on: https://go-review.googlesource.com/21193
Reviewed-by: David Symonds <dsymonds@golang.org>
Git rev e7da8eda (CL 20542) introduced an optimization to reuse the
64k request body buffers across multiple requests. But ServeHTTP
handlers could retain them too long and cause races.
Temporarily revert the main part of that CL until a proper fix is in.
Updates golang/go#14960
Updates grpc/grpc-go#604
Change-Id: I28450e797a1d3122868214700b6ef345a0a1a47c
Reviewed-on: https://go-review.googlesource.com/21160
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The Google GFE replies to HEAD requests with the END_STREAM bit in an
empty DATA frame, not in the response HEADERS. The Go Transport code
mistook this to mean the Content-Length was real.
Worked around in:
645322e7db
Reported internally in b/27820181.
Change-Id: Id31a047e2277d7d90560fca264919e239ec76d74
Reviewed-on: https://go-review.googlesource.com/21061
Reviewed-by: Dave Day <djd@golang.org>
Moves test cases into the test where they're used, to remove
distractions when profiling unrelated tests.
Also this is my style preference, to remove globals and reduce the
scope of variables.
Change-Id: Ie9cd41b16aad9acf5e210f1fb6f19a7fce52180d
Reviewed-on: https://go-review.googlesource.com/20996
Reviewed-by: Andrew Gerrand <adg@golang.org>
cancelCtx has an embedded sync.Mutex. This change causes an extra
allocation when creating a new timerCtx via WithDeadline, but that seems
minor when compared with better locking discipline. If it turns out to
be a problem, the whole cancelCtx struct can be flattened into timerCtx.
Addresses part of golang/go#14839.
Change-Id: Ie86ed1b63592b521aefde747d5fafcd49ac18178
Reviewed-on: https://go-review.googlesource.com/20840
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>