Update to go 1.12 version of golang.org/x/net

Change-Id: I3f2fa5d7b6811c9eca58992318d19e44ec9131fd
pull/564/head
Davanum Srinivas 2019-03-12 09:16:45 -04:00
parent eb4865fbe5
commit 2aa1348e6c
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59
62 changed files with 620 additions and 1031 deletions

38
Godeps/Godeps.json generated
View File

@ -3625,67 +3625,67 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/context/ctxhttp",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/html",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/html/atom",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/html/charset",
"Rev": "0ed95abb35c445290478a5348a7b38bb154135fd"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/internal/nettest",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/internal/socks",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/internal/sockstest",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/internal/timeseries",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/proxy",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/trace",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/websocket",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

109
Godeps/LICENSES generated
View File

@ -101156,6 +101156,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================
================================================================================
= vendor/golang.org/x/net/http/httpguts licensed under: =
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
= vendor/golang.org/x/net/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707
================================================================================
================================================================================
= vendor/golang.org/x/net/http2 licensed under: =
@ -101262,7 +101297,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================
= vendor/golang.org/x/net/internal/timeseries licensed under: =
= vendor/golang.org/x/net/internal/nettest licensed under: =
Copyright (c) 2009 The Go Authors. All rights reserved.
@ -101297,7 +101332,77 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================
= vendor/golang.org/x/net/lex/httplex licensed under: =
= vendor/golang.org/x/net/internal/socks licensed under: =
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
= vendor/golang.org/x/net/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707
================================================================================
================================================================================
= vendor/golang.org/x/net/internal/sockstest licensed under: =
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
= vendor/golang.org/x/net/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707
================================================================================
================================================================================
= vendor/golang.org/x/net/internal/timeseries licensed under: =
Copyright (c) 2009 The Go Authors. All rights reserved.

View File

@ -56,19 +56,19 @@
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -688,35 +688,35 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/internal/timeseries",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/trace",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/websocket",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -120,31 +120,31 @@
},
{
"ImportPath": "golang.org/x/net/html",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/html/atom",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/websocket",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -696,35 +696,35 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/internal/timeseries",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/trace",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/websocket",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -168,23 +168,23 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -192,27 +192,27 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/context/ctxhttp",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -84,23 +84,23 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -20,19 +20,19 @@
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -24,19 +24,19 @@
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -84,23 +84,23 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -20,19 +20,19 @@
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -268,43 +268,43 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/html",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/html/atom",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/internal/timeseries",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/trace",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/websocket",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -20,19 +20,19 @@
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -20,19 +20,19 @@
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -20,19 +20,19 @@
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -20,19 +20,19 @@
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",

View File

@ -88,23 +88,23 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -84,23 +84,23 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -248,35 +248,35 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/internal/timeseries",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/trace",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/websocket",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -160,23 +160,23 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -96,23 +96,23 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http/httpguts",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "a4630153038d3cb8c57f83d95200aea356145cf5"
"Rev": "65e2d4e15006aab9813ff8769e768bbf4bb667a0"
},
{
"ImportPath": "golang.org/x/oauth2",

View File

@ -2,14 +2,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"ctxhttp.go",
"ctxhttp_pre17.go",
],
srcs = ["ctxhttp.go"],
importmap = "k8s.io/kubernetes/vendor/golang.org/x/net/context/ctxhttp",
importpath = "golang.org/x/net/context/ctxhttp",
visibility = ["//visibility:public"],
deps = ["//vendor/golang.org/x/net/context:go_default_library"],
)
filegroup(

View File

@ -2,18 +2,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.7
// Package ctxhttp provides helper functions for performing context-aware HTTP requests.
package ctxhttp
import (
"context"
"io"
"net/http"
"net/url"
"strings"
"golang.org/x/net/context"
)
// Do sends an HTTP request with the provided http.Client and returns

View File

@ -1,147 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.7
package ctxhttp
import (
"io"
"net/http"
"net/url"
"strings"
"golang.org/x/net/context"
)
func nop() {}
var (
testHookContextDoneBeforeHeaders = nop
testHookDoReturned = nop
testHookDidBodyClose = nop
)
// Do sends an HTTP request with the provided http.Client and returns an HTTP response.
// If the client is nil, http.DefaultClient is used.
// If the context is canceled or times out, ctx.Err() will be returned.
func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
if client == nil {
client = http.DefaultClient
}
// TODO(djd): Respect any existing value of req.Cancel.
cancel := make(chan struct{})
req.Cancel = cancel
type responseAndError struct {
resp *http.Response
err error
}
result := make(chan responseAndError, 1)
// Make local copies of test hooks closed over by goroutines below.
// Prevents data races in tests.
testHookDoReturned := testHookDoReturned
testHookDidBodyClose := testHookDidBodyClose
go func() {
resp, err := client.Do(req)
testHookDoReturned()
result <- responseAndError{resp, err}
}()
var resp *http.Response
select {
case <-ctx.Done():
testHookContextDoneBeforeHeaders()
close(cancel)
// Clean up after the goroutine calling client.Do:
go func() {
if r := <-result; r.resp != nil {
testHookDidBodyClose()
r.resp.Body.Close()
}
}()
return nil, ctx.Err()
case r := <-result:
var err error
resp, err = r.resp, r.err
if err != nil {
return resp, err
}
}
c := make(chan struct{})
go func() {
select {
case <-ctx.Done():
close(cancel)
case <-c:
// The response's Body is closed.
}
}()
resp.Body = &notifyingReader{resp.Body, c}
return resp, nil
}
// Get issues a GET request via the Do function.
func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}
return Do(ctx, client, req)
}
// Head issues a HEAD request via the Do function.
func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
req, err := http.NewRequest("HEAD", url, nil)
if err != nil {
return nil, err
}
return Do(ctx, client, req)
}
// Post issues a POST request via the Do function.
func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) {
req, err := http.NewRequest("POST", url, body)
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", bodyType)
return Do(ctx, client, req)
}
// PostForm issues a POST request via the Do function.
func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) {
return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
}
// notifyingReader is an io.ReadCloser that closes the notify channel after
// Close is called or a Read fails on the underlying ReadCloser.
type notifyingReader struct {
io.ReadCloser
notify chan<- struct{}
}
func (r *notifyingReader) Read(p []byte) (int, error) {
n, err := r.ReadCloser.Read(p)
if err != nil && r.notify != nil {
close(r.notify)
r.notify = nil
}
return n, err
}
func (r *notifyingReader) Close() error {
err := r.ReadCloser.Close()
if r.notify != nil {
close(r.notify)
r.notify = nil
}
return err
}

View File

@ -97,8 +97,16 @@ func isSpecialElement(element *Node) bool {
switch element.Namespace {
case "", "html":
return isSpecialElementMap[element.Data]
case "math":
switch element.Data {
case "mi", "mo", "mn", "ms", "mtext", "annotation-xml":
return true
}
case "svg":
return element.Data == "foreignObject"
switch element.Data {
case "foreignObject", "desc", "title":
return true
}
}
return false
}

View File

@ -177,7 +177,7 @@ func (s *nodeStack) index(n *Node) int {
// contains returns whether a is within s.
func (s *nodeStack) contains(a atom.Atom) bool {
for _, n := range *s {
if n.DataAtom == a {
if n.DataAtom == a && n.Namespace == "" {
return true
}
}

132
vendor/golang.org/x/net/html/parse.go generated vendored
View File

@ -209,27 +209,6 @@ loop:
p.oe = p.oe[:i+1]
}
// generateAllImpliedEndTags pops nodes off the stack of open elements as long as
// the top node has a tag name of caption, colgroup, dd, div, dt, li, optgroup, option, p, rb,
// rp, rt, rtc, span, tbody, td, tfoot, th, thead or tr.
func (p *parser) generateAllImpliedEndTags() {
var i int
for i = len(p.oe) - 1; i >= 0; i-- {
n := p.oe[i]
if n.Type == ElementNode {
switch n.DataAtom {
// TODO: remove this divergence from the HTML5 spec
case a.Caption, a.Colgroup, a.Dd, a.Div, a.Dt, a.Li, a.Optgroup, a.Option, a.P, a.Rb,
a.Rp, a.Rt, a.Rtc, a.Span, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
continue
}
}
break
}
p.oe = p.oe[:i+1]
}
// addChild adds a child node n to the top element, and pushes n onto the stack
// of open elements if it is an element node.
func (p *parser) addChild(n *Node) {
@ -276,7 +255,7 @@ func (p *parser) fosterParent(n *Node) {
}
}
if template != nil && (table == nil || j < i) {
if template != nil && (table == nil || j > i) {
template.AppendChild(n)
return
}
@ -491,6 +470,10 @@ func (p *parser) resetInsertionMode() {
case a.Table:
p.im = inTableIM
case a.Template:
// TODO: remove this divergence from the HTML5 spec.
if n.Namespace != "" {
continue
}
p.im = p.templateStack.top()
case a.Head:
// TODO: remove this divergence from the HTML5 spec.
@ -679,8 +662,16 @@ func inHeadIM(p *parser) bool {
if !p.oe.contains(a.Template) {
return true
}
p.generateAllImpliedEndTags()
p.popUntil(defaultScope, a.Template)
// TODO: remove this divergence from the HTML5 spec.
//
// See https://bugs.chromium.org/p/chromium/issues/detail?id=829668
p.generateImpliedEndTags()
for i := len(p.oe) - 1; i >= 0; i-- {
if n := p.oe[i]; n.Namespace == "" && n.DataAtom == a.Template {
p.oe = p.oe[:i]
break
}
}
p.clearActiveFormattingElements()
p.templateStack.pop()
p.resetInsertionMode()
@ -997,6 +988,14 @@ func inBodyIM(p *parser) bool {
p.acknowledgeSelfClosingTag()
p.popUntil(buttonScope, a.P)
p.parseImpliedToken(StartTagToken, a.Form, a.Form.String())
if p.form == nil {
// NOTE: The 'isindex' element has been removed,
// and the 'template' element has not been designed to be
// collaborative with the index element.
//
// Ignore the token.
return true
}
if action != "" {
p.form.Attr = []Attribute{{Key: "action", Val: action}}
}
@ -1071,13 +1070,7 @@ func inBodyIM(p *parser) bool {
p.acknowledgeSelfClosingTag()
}
return true
case a.Frame:
// TODO: remove this divergence from the HTML5 spec.
if p.oe.contains(a.Template) {
p.addElement()
return true
}
case a.Caption, a.Col, a.Colgroup, a.Head, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
case a.Caption, a.Col, a.Colgroup, a.Frame, a.Head, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
// Ignore the token.
default:
p.reconstructActiveFormattingElements()
@ -1271,12 +1264,6 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) {
switch commonAncestor.DataAtom {
case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
p.fosterParent(lastNode)
case a.Template:
// TODO: remove namespace checking
if commonAncestor.Namespace == "html" {
commonAncestor = commonAncestor.LastChild
}
fallthrough
default:
commonAncestor.AppendChild(lastNode)
}
@ -1348,9 +1335,6 @@ func textIM(p *parser) bool {
// Section 12.2.6.4.9.
func inTableIM(p *parser) bool {
switch p.tok.Type {
case ErrorToken:
// Stop parsing.
return true
case TextToken:
p.tok.Data = strings.Replace(p.tok.Data, "\x00", "", -1)
switch p.oe.top().DataAtom {
@ -1445,6 +1429,8 @@ func inTableIM(p *parser) bool {
case DoctypeToken:
// Ignore the token.
return true
case ErrorToken:
return inBodyIM(p)
}
p.fosterParenting = true
@ -1547,6 +1533,8 @@ func inColumnGroupIM(p *parser) bool {
case a.Template:
return inHeadIM(p)
}
case ErrorToken:
return inBodyIM(p)
}
if p.oe.top().DataAtom != a.Colgroup {
return true
@ -1711,9 +1699,6 @@ func inCellIM(p *parser) bool {
// Section 12.2.6.4.16.
func inSelectIM(p *parser) bool {
switch p.tok.Type {
case ErrorToken:
// Stop parsing.
return true
case TextToken:
p.addText(strings.Replace(p.tok.Data, "\x00", "", -1))
case StartTagToken:
@ -1734,8 +1719,12 @@ func inSelectIM(p *parser) bool {
}
p.addElement()
case a.Select:
p.tok.Type = EndTagToken
return false
if p.popUntil(selectScope, a.Select) {
p.resetInsertionMode()
} else {
// Ignore the token.
return true
}
case a.Input, a.Keygen, a.Textarea:
if p.elementInScope(selectScope, a.Select) {
p.parseImpliedToken(EndTagToken, a.Select, a.Select.String())
@ -1765,6 +1754,9 @@ func inSelectIM(p *parser) bool {
case a.Select:
if p.popUntil(selectScope, a.Select) {
p.resetInsertionMode()
} else {
// Ignore the token.
return true
}
case a.Template:
return inHeadIM(p)
@ -1777,6 +1769,8 @@ func inSelectIM(p *parser) bool {
case DoctypeToken:
// Ignore the token.
return true
case ErrorToken:
return inBodyIM(p)
}
return true
@ -1788,13 +1782,22 @@ func inSelectInTableIM(p *parser) bool {
case StartTagToken, EndTagToken:
switch p.tok.DataAtom {
case a.Caption, a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr, a.Td, a.Th:
if p.tok.Type == StartTagToken || p.elementInScope(tableScope, p.tok.DataAtom) {
p.parseImpliedToken(EndTagToken, a.Select, a.Select.String())
return false
} else {
if p.tok.Type == EndTagToken && !p.elementInScope(tableScope, p.tok.DataAtom) {
// Ignore the token.
return true
}
// This is like p.popUntil(selectScope, a.Select), but it also
// matches <math select>, not just <select>. Matching the MathML
// tag is arguably incorrect (conceptually), but it mimics what
// Chromium does.
for i := len(p.oe) - 1; i >= 0; i-- {
if n := p.oe[i]; n.DataAtom == a.Select {
p.oe = p.oe[:i]
break
}
}
p.resetInsertionMode()
return false
}
}
return inSelectIM(p)
@ -1843,16 +1846,27 @@ func inTemplateIM(p *parser) bool {
// Ignore the token.
return true
}
}
case ErrorToken:
if !p.oe.contains(a.Template) {
// Ignore the token.
return true
}
p.popUntil(defaultScope, a.Template)
// TODO: remove this divergence from the HTML5 spec.
//
// See https://bugs.chromium.org/p/chromium/issues/detail?id=829668
p.generateImpliedEndTags()
for i := len(p.oe) - 1; i >= 0; i-- {
if n := p.oe[i]; n.Namespace == "" && n.DataAtom == a.Template {
p.oe = p.oe[:i]
break
}
}
p.clearActiveFormattingElements()
p.templateStack.pop()
p.resetInsertionMode()
return false
}
return false
}
// Section 12.2.6.4.19.
@ -1925,11 +1939,6 @@ func inFramesetIM(p *parser) bool {
p.acknowledgeSelfClosingTag()
case a.Noframes:
return inHeadIM(p)
case a.Template:
// TODO: remove this divergence from the HTML5 spec.
//
// See https://bugs.chromium.org/p/chromium/issues/detail?id=829668
return inTemplateIM(p)
}
case EndTagToken:
switch p.tok.DataAtom {
@ -2222,6 +2231,15 @@ func (p *parser) parse() error {
}
// Parse returns the parse tree for the HTML from the given Reader.
//
// It implements the HTML5 parsing algorithm
// (https://html.spec.whatwg.org/multipage/syntax.html#tree-construction),
// which is very complicated. The resultant tree can contain implicitly created
// nodes that have no explicit <tag> listed in r's data, and nodes' parents can
// differ from the nesting implied by a naive processing of start and end
// <tag>s. Conversely, explicit <tag>s in r's data can be silently dropped,
// with no corresponding node in the resulting tree.
//
// The input is assumed to be UTF-8 encoded.
func Parse(r io.Reader) (*Node, error) {
p := &parser{
@ -2243,6 +2261,8 @@ func Parse(r io.Reader) (*Node, error) {
// ParseFragment parses a fragment of HTML and returns the nodes that were
// found. If the fragment is the InnerHTML for an existing element, pass that
// element in context.
//
// It has the same intricacies as Parse.
func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
contextTag := ""
if context != nil {

10
vendor/golang.org/x/net/http2/BUILD generated vendored
View File

@ -5,25 +5,15 @@ go_library(
srcs = [
"ciphers.go",
"client_conn_pool.go",
"configure_transport.go",
"databuffer.go",
"errors.go",
"flow.go",
"frame.go",
"go111.go",
"go16.go",
"go17.go",
"go17_not18.go",
"go18.go",
"go19.go",
"gotrack.go",
"headermap.go",
"http2.go",
"not_go111.go",
"not_go16.go",
"not_go17.go",
"not_go18.go",
"not_go19.go",
"pipe.go",
"server.go",
"transport.go",

View File

@ -1,82 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.6
package http2
import (
"crypto/tls"
"fmt"
"net/http"
)
func configureTransport(t1 *http.Transport) (*Transport, error) {
connPool := new(clientConnPool)
t2 := &Transport{
ConnPool: noDialClientConnPool{connPool},
t1: t1,
}
connPool.t = t2
if err := registerHTTPSProtocol(t1, noDialH2RoundTripper{t2}); err != nil {
return nil, err
}
if t1.TLSClientConfig == nil {
t1.TLSClientConfig = new(tls.Config)
}
if !strSliceContains(t1.TLSClientConfig.NextProtos, "h2") {
t1.TLSClientConfig.NextProtos = append([]string{"h2"}, t1.TLSClientConfig.NextProtos...)
}
if !strSliceContains(t1.TLSClientConfig.NextProtos, "http/1.1") {
t1.TLSClientConfig.NextProtos = append(t1.TLSClientConfig.NextProtos, "http/1.1")
}
upgradeFn := func(authority string, c *tls.Conn) http.RoundTripper {
addr := authorityAddr("https", authority)
if used, err := connPool.addConnIfNeeded(addr, t2, c); err != nil {
go c.Close()
return erringRoundTripper{err}
} else if !used {
// Turns out we don't need this c.
// For example, two goroutines made requests to the same host
// at the same time, both kicking off TCP dials. (since protocol
// was unknown)
go c.Close()
}
return t2
}
if m := t1.TLSNextProto; len(m) == 0 {
t1.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{
"h2": upgradeFn,
}
} else {
m["h2"] = upgradeFn
}
return t2, nil
}
// registerHTTPSProtocol calls Transport.RegisterProtocol but
// converting panics into errors.
func registerHTTPSProtocol(t *http.Transport, rt noDialH2RoundTripper) (err error) {
defer func() {
if e := recover(); e != nil {
err = fmt.Errorf("%v", e)
}
}()
t.RegisterProtocol("https", rt)
return nil
}
// noDialH2RoundTripper is a RoundTripper which only tries to complete the request
// if there's already has a cached connection to the host.
// (The field is exported so it can be accessed via reflect from net/http; tested
// by TestNoDialH2RoundTripperType)
type noDialH2RoundTripper struct{ *Transport }
func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
res, err := rt.Transport.RoundTrip(req)
if isNoCachedConnError(err) {
return nil, http.ErrSkipAltProtocol
}
return res, err
}

View File

@ -1477,7 +1477,7 @@ func (fr *Framer) maxHeaderStringLen() int {
}
// readMetaFrame returns 0 or more CONTINUATION frames from fr and
// merge them into into the provided hf and returns a MetaHeadersFrame
// merge them into the provided hf and returns a MetaHeadersFrame
// with the decoded hpack values.
func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
if fr.AllowIllegalReads {

View File

@ -6,19 +6,22 @@
package http2
import "net/textproto"
import (
"net/http/httptrace"
"net/textproto"
)
func traceHasWroteHeaderField(trace *clientTrace) bool {
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
return trace != nil && trace.WroteHeaderField != nil
}
func traceWroteHeaderField(trace *clientTrace, k, v string) {
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
if trace != nil && trace.WroteHeaderField != nil {
trace.WroteHeaderField(k, []string{v})
}
}
func traceGot1xxResponseFunc(trace *clientTrace) func(int, textproto.MIMEHeader) error {
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
if trace != nil {
return trace.Got1xxResponse
}

View File

@ -1,16 +0,0 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.6
package http2
import (
"net/http"
"time"
)
func transportExpectContinueTimeout(t1 *http.Transport) time.Duration {
return t1.ExpectContinueTimeout
}

121
vendor/golang.org/x/net/http2/go17.go generated vendored
View File

@ -1,121 +0,0 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.7
package http2
import (
"context"
"net"
"net/http"
"net/http/httptrace"
"time"
)
type contextContext interface {
context.Context
}
var errCanceled = context.Canceled
func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx contextContext, cancel func()) {
ctx, cancel = context.WithCancel(context.Background())
ctx = context.WithValue(ctx, http.LocalAddrContextKey, c.LocalAddr())
if hs := opts.baseConfig(); hs != nil {
ctx = context.WithValue(ctx, http.ServerContextKey, hs)
}
return
}
func contextWithCancel(ctx contextContext) (_ contextContext, cancel func()) {
return context.WithCancel(ctx)
}
func requestWithContext(req *http.Request, ctx contextContext) *http.Request {
return req.WithContext(ctx)
}
type clientTrace httptrace.ClientTrace
func reqContext(r *http.Request) context.Context { return r.Context() }
func (t *Transport) idleConnTimeout() time.Duration {
if t.t1 != nil {
return t.t1.IdleConnTimeout
}
return 0
}
func setResponseUncompressed(res *http.Response) { res.Uncompressed = true }
func traceGetConn(req *http.Request, hostPort string) {
trace := httptrace.ContextClientTrace(req.Context())
if trace == nil || trace.GetConn == nil {
return
}
trace.GetConn(hostPort)
}
func traceGotConn(req *http.Request, cc *ClientConn) {
trace := httptrace.ContextClientTrace(req.Context())
if trace == nil || trace.GotConn == nil {
return
}
ci := httptrace.GotConnInfo{Conn: cc.tconn}
cc.mu.Lock()
ci.Reused = cc.nextStreamID > 1
ci.WasIdle = len(cc.streams) == 0 && ci.Reused
if ci.WasIdle && !cc.lastActive.IsZero() {
ci.IdleTime = time.Now().Sub(cc.lastActive)
}
cc.mu.Unlock()
trace.GotConn(ci)
}
func traceWroteHeaders(trace *clientTrace) {
if trace != nil && trace.WroteHeaders != nil {
trace.WroteHeaders()
}
}
func traceGot100Continue(trace *clientTrace) {
if trace != nil && trace.Got100Continue != nil {
trace.Got100Continue()
}
}
func traceWait100Continue(trace *clientTrace) {
if trace != nil && trace.Wait100Continue != nil {
trace.Wait100Continue()
}
}
func traceWroteRequest(trace *clientTrace, err error) {
if trace != nil && trace.WroteRequest != nil {
trace.WroteRequest(httptrace.WroteRequestInfo{Err: err})
}
}
func traceFirstResponseByte(trace *clientTrace) {
if trace != nil && trace.GotFirstResponseByte != nil {
trace.GotFirstResponseByte()
}
}
func requestTrace(req *http.Request) *clientTrace {
trace := httptrace.ContextClientTrace(req.Context())
return (*clientTrace)(trace)
}
// Ping sends a PING frame to the server and waits for the ack.
func (cc *ClientConn) Ping(ctx context.Context) error {
return cc.ping(ctx)
}
// Shutdown gracefully closes the client connection, waiting for running streams to complete.
func (cc *ClientConn) Shutdown(ctx context.Context) error {
return cc.shutdown(ctx)
}

View File

@ -1,36 +0,0 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.7,!go1.8
package http2
import "crypto/tls"
// temporary copy of Go 1.7's private tls.Config.clone:
func cloneTLSConfig(c *tls.Config) *tls.Config {
return &tls.Config{
Rand: c.Rand,
Time: c.Time,
Certificates: c.Certificates,
NameToCertificate: c.NameToCertificate,
GetCertificate: c.GetCertificate,
RootCAs: c.RootCAs,
NextProtos: c.NextProtos,
ServerName: c.ServerName,
ClientAuth: c.ClientAuth,
ClientCAs: c.ClientCAs,
InsecureSkipVerify: c.InsecureSkipVerify,
CipherSuites: c.CipherSuites,
PreferServerCipherSuites: c.PreferServerCipherSuites,
SessionTicketsDisabled: c.SessionTicketsDisabled,
SessionTicketKey: c.SessionTicketKey,
ClientSessionCache: c.ClientSessionCache,
MinVersion: c.MinVersion,
MaxVersion: c.MaxVersion,
CurvePreferences: c.CurvePreferences,
DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled,
Renegotiation: c.Renegotiation,
}
}

View File

@ -1,56 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.8
package http2
import (
"crypto/tls"
"io"
"net/http"
)
func cloneTLSConfig(c *tls.Config) *tls.Config {
c2 := c.Clone()
c2.GetClientCertificate = c.GetClientCertificate // golang.org/issue/19264
return c2
}
var _ http.Pusher = (*responseWriter)(nil)
// Push implements http.Pusher.
func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
internalOpts := pushOptions{}
if opts != nil {
internalOpts.Method = opts.Method
internalOpts.Header = opts.Header
}
return w.push(target, internalOpts)
}
func configureServer18(h1 *http.Server, h2 *Server) error {
if h2.IdleTimeout == 0 {
if h1.IdleTimeout != 0 {
h2.IdleTimeout = h1.IdleTimeout
} else {
h2.IdleTimeout = h1.ReadTimeout
}
}
return nil
}
func shouldLogPanic(panicValue interface{}) bool {
return panicValue != nil && panicValue != http.ErrAbortHandler
}
func reqGetBody(req *http.Request) func() (io.ReadCloser, error) {
return req.GetBody
}
func reqBodyIsNoBody(body io.ReadCloser) bool {
return body == http.NoBody
}
func go18httpNoBody() io.ReadCloser { return http.NoBody } // for tests only

View File

@ -1,16 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.9
package http2
import (
"net/http"
)
func configureServer19(s *http.Server, conf *Server) error {
s.RegisterOnShutdown(conf.state.startGracefulShutdown)
return nil
}

View File

@ -7,15 +7,21 @@ package http2
import (
"net/http"
"strings"
"sync"
)
var (
commonLowerHeader = map[string]string{} // Go-Canonical-Case -> lower-case
commonCanonHeader = map[string]string{} // lower-case -> Go-Canonical-Case
commonBuildOnce sync.Once
commonLowerHeader map[string]string // Go-Canonical-Case -> lower-case
commonCanonHeader map[string]string // lower-case -> Go-Canonical-Case
)
func init() {
for _, v := range []string{
func buildCommonHeaderMapsOnce() {
commonBuildOnce.Do(buildCommonHeaderMaps)
}
func buildCommonHeaderMaps() {
common := []string{
"accept",
"accept-charset",
"accept-encoding",
@ -63,7 +69,10 @@ func init() {
"vary",
"via",
"www-authenticate",
} {
}
commonLowerHeader = make(map[string]string, len(common))
commonCanonHeader = make(map[string]string, len(common))
for _, v := range common {
chk := http.CanonicalHeaderKey(v)
commonLowerHeader[chk] = v
commonCanonHeader[v] = chk
@ -71,6 +80,7 @@ func init() {
}
func lowerHeader(v string) string {
buildCommonHeaderMapsOnce()
if s, ok := commonLowerHeader[v]; ok {
return s
}

View File

@ -92,6 +92,8 @@ type Decoder struct {
// saveBuf is previous data passed to Write which we weren't able
// to fully parse before. Unlike buf, we own this data.
saveBuf bytes.Buffer
firstField bool // processing the first field of the header block
}
// NewDecoder returns a new decoder with the provided maximum dynamic
@ -101,6 +103,7 @@ func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decod
d := &Decoder{
emit: emitFunc,
emitEnabled: true,
firstField: true,
}
d.dynTab.table.init()
d.dynTab.allowedMaxSize = maxDynamicTableSize
@ -226,11 +229,15 @@ func (d *Decoder) DecodeFull(p []byte) ([]HeaderField, error) {
return hf, nil
}
// Close declares that the decoding is complete and resets the Decoder
// to be reused again for a new header block. If there is any remaining
// data in the decoder's buffer, Close returns an error.
func (d *Decoder) Close() error {
if d.saveBuf.Len() > 0 {
d.saveBuf.Reset()
return DecodingError{errors.New("truncated headers")}
}
d.firstField = true
return nil
}
@ -266,6 +273,7 @@ func (d *Decoder) Write(p []byte) (n int, err error) {
d.saveBuf.Write(d.buf)
return len(p), nil
}
d.firstField = false
if err != nil {
break
}
@ -391,7 +399,7 @@ func (d *Decoder) callEmit(hf HeaderField) error {
func (d *Decoder) parseDynamicTableSizeUpdate() error {
// RFC 7541, sec 4.2: This dynamic table size update MUST occur at the
// beginning of the first header block following the change to the dynamic table size.
if d.dynTab.size > 0 {
if !d.firstField && d.dynTab.size > 0 {
return DecodingError{errors.New("dynamic table size update MUST occur at the beginning of a header block")}
}

View File

@ -201,19 +201,12 @@ func validWireHeaderFieldName(v string) bool {
return true
}
var httpCodeStringCommon = map[int]string{} // n -> strconv.Itoa(n)
func init() {
for i := 100; i <= 999; i++ {
if v := http.StatusText(i); v != "" {
httpCodeStringCommon[i] = strconv.Itoa(i)
}
}
}
func httpCodeString(code int) string {
if s, ok := httpCodeStringCommon[code]; ok {
return s
switch code {
case 200:
return "200"
case 404:
return "404"
}
return strconv.Itoa(code)
}

View File

@ -6,12 +6,15 @@
package http2
import "net/textproto"
import (
"net/http/httptrace"
"net/textproto"
)
func traceHasWroteHeaderField(trace *clientTrace) bool { return false }
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { return false }
func traceWroteHeaderField(trace *clientTrace, k, v string) {}
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {}
func traceGot1xxResponseFunc(trace *clientTrace) func(int, textproto.MIMEHeader) error {
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
return nil
}

View File

@ -1,21 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.6
package http2
import (
"net/http"
"time"
)
func configureTransport(t1 *http.Transport) (*Transport, error) {
return nil, errTransportVersion
}
func transportExpectContinueTimeout(t1 *http.Transport) time.Duration {
return 0
}

View File

@ -1,95 +0,0 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.7
package http2
import (
"crypto/tls"
"errors"
"net"
"net/http"
"time"
)
type contextContext interface {
Done() <-chan struct{}
Err() error
}
var errCanceled = errors.New("canceled")
type fakeContext struct{}
func (fakeContext) Done() <-chan struct{} { return nil }
func (fakeContext) Err() error { panic("should not be called") }
func reqContext(r *http.Request) fakeContext {
return fakeContext{}
}
func setResponseUncompressed(res *http.Response) {
// Nothing.
}
type clientTrace struct{}
func requestTrace(*http.Request) *clientTrace { return nil }
func traceGetConn(*http.Request, string) {}
func traceGotConn(*http.Request, *ClientConn) {}
func traceFirstResponseByte(*clientTrace) {}
func traceWroteHeaders(*clientTrace) {}
func traceWroteRequest(*clientTrace, error) {}
func traceGot100Continue(trace *clientTrace) {}
func traceWait100Continue(trace *clientTrace) {}
func nop() {}
func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx contextContext, cancel func()) {
return nil, nop
}
func contextWithCancel(ctx contextContext) (_ contextContext, cancel func()) {
return ctx, nop
}
func requestWithContext(req *http.Request, ctx contextContext) *http.Request {
return req
}
// temporary copy of Go 1.6's private tls.Config.clone:
func cloneTLSConfig(c *tls.Config) *tls.Config {
return &tls.Config{
Rand: c.Rand,
Time: c.Time,
Certificates: c.Certificates,
NameToCertificate: c.NameToCertificate,
GetCertificate: c.GetCertificate,
RootCAs: c.RootCAs,
NextProtos: c.NextProtos,
ServerName: c.ServerName,
ClientAuth: c.ClientAuth,
ClientCAs: c.ClientCAs,
InsecureSkipVerify: c.InsecureSkipVerify,
CipherSuites: c.CipherSuites,
PreferServerCipherSuites: c.PreferServerCipherSuites,
SessionTicketsDisabled: c.SessionTicketsDisabled,
SessionTicketKey: c.SessionTicketKey,
ClientSessionCache: c.ClientSessionCache,
MinVersion: c.MinVersion,
MaxVersion: c.MaxVersion,
CurvePreferences: c.CurvePreferences,
}
}
func (cc *ClientConn) Ping(ctx contextContext) error {
return cc.ping(ctx)
}
func (cc *ClientConn) Shutdown(ctx contextContext) error {
return cc.shutdown(ctx)
}
func (t *Transport) idleConnTimeout() time.Duration { return 0 }

View File

@ -1,29 +0,0 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.8
package http2
import (
"io"
"net/http"
)
func configureServer18(h1 *http.Server, h2 *Server) error {
// No IdleTimeout to sync prior to Go 1.8.
return nil
}
func shouldLogPanic(panicValue interface{}) bool {
return panicValue != nil
}
func reqGetBody(req *http.Request) func() (io.ReadCloser, error) {
return nil
}
func reqBodyIsNoBody(io.ReadCloser) bool { return false }
func go18httpNoBody() io.ReadCloser { return nil } // for tests only

View File

@ -1,16 +0,0 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.9
package http2
import (
"net/http"
)
func configureServer19(s *http.Server, conf *Server) error {
// not supported prior to go1.9
return nil
}

View File

@ -28,6 +28,7 @@ package http2
import (
"bufio"
"bytes"
"context"
"crypto/tls"
"errors"
"fmt"
@ -209,12 +210,14 @@ func ConfigureServer(s *http.Server, conf *Server) error {
conf = new(Server)
}
conf.state = &serverInternalState{activeConns: make(map[*serverConn]struct{})}
if err := configureServer18(s, conf); err != nil {
return err
if h1, h2 := s, conf; h2.IdleTimeout == 0 {
if h1.IdleTimeout != 0 {
h2.IdleTimeout = h1.IdleTimeout
} else {
h2.IdleTimeout = h1.ReadTimeout
}
if err := configureServer19(s, conf); err != nil {
return err
}
s.RegisterOnShutdown(conf.state.startGracefulShutdown)
if s.TLSConfig == nil {
s.TLSConfig = new(tls.Config)
@ -435,6 +438,15 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
sc.serve()
}
func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx context.Context, cancel func()) {
ctx, cancel = context.WithCancel(context.Background())
ctx = context.WithValue(ctx, http.LocalAddrContextKey, c.LocalAddr())
if hs := opts.baseConfig(); hs != nil {
ctx = context.WithValue(ctx, http.ServerContextKey, hs)
}
return
}
func (sc *serverConn) rejectConn(err ErrCode, debug string) {
sc.vlogf("http2: server rejecting conn: %v, %s", err, debug)
// ignoring errors. hanging up anyway.
@ -450,7 +462,7 @@ type serverConn struct {
conn net.Conn
bw *bufferedWriter // writing to conn
handler http.Handler
baseCtx contextContext
baseCtx context.Context
framer *Framer
doneServing chan struct{} // closed when serverConn.serve ends
readFrameCh chan readFrameResult // written by serverConn.readFrames
@ -530,7 +542,7 @@ type stream struct {
id uint32
body *pipe // non-nil if expecting DATA frames
cw closeWaiter // closed wait stream transitions to closed state
ctx contextContext
ctx context.Context
cancelCtx func()
// owned by serverConn's serve loop:
@ -663,6 +675,7 @@ func (sc *serverConn) condlogf(err error, format string, args ...interface{}) {
func (sc *serverConn) canonicalHeader(v string) string {
sc.serveG.check()
buildCommonHeaderMapsOnce()
cv, ok := commonCanonHeader[v]
if ok {
return cv
@ -1109,7 +1122,7 @@ func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) {
// errHandlerPanicked is the error given to any callers blocked in a read from
// Request.Body when the main goroutine panics. Since most handlers read in the
// the main ServeHTTP goroutine, this will show up rarely.
// main ServeHTTP goroutine, this will show up rarely.
var errHandlerPanicked = errors.New("http2: handler panicked")
// wroteFrame is called on the serve goroutine with the result of
@ -1581,12 +1594,6 @@ func (sc *serverConn) processData(f *DataFrame) error {
// type PROTOCOL_ERROR."
return ConnectionError(ErrCodeProtocol)
}
// RFC 7540, sec 6.1: If a DATA frame is received whose stream is not in
// "open" or "half-closed (local)" state, the recipient MUST respond with a
// stream error (Section 5.4.2) of type STREAM_CLOSED.
if state == stateClosed {
return streamError(id, ErrCodeStreamClosed)
}
if st == nil || state != stateOpen || st.gotTrailerHeader || st.resetQueued {
// This includes sending a RST_STREAM if the stream is
// in stateHalfClosedLocal (which currently means that
@ -1881,7 +1888,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
panic("internal error: cannot create stream with id 0")
}
ctx, cancelCtx := contextWithCancel(sc.baseCtx)
ctx, cancelCtx := context.WithCancel(sc.baseCtx)
st := &stream{
sc: sc,
id: id,
@ -2047,7 +2054,7 @@ func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*r
Body: body,
Trailer: trailer,
}
req = requestWithContext(req, st.ctx)
req = req.WithContext(st.ctx)
rws := responseWriterStatePool.Get().(*responseWriterState)
bwSave := rws.bw
@ -2075,7 +2082,7 @@ func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler
stream: rw.rws.stream,
})
// Same as net/http:
if shouldLogPanic(e) {
if e != nil && e != http.ErrAbortHandler {
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
@ -2637,14 +2644,9 @@ var (
ErrPushLimitReached = errors.New("http2: push would exceed peer's SETTINGS_MAX_CONCURRENT_STREAMS")
)
// pushOptions is the internal version of http.PushOptions, which we
// cannot include here because it's only defined in Go 1.8 and later.
type pushOptions struct {
Method string
Header http.Header
}
var _ http.Pusher = (*responseWriter)(nil)
func (w *responseWriter) push(target string, opts pushOptions) error {
func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
st := w.rws.stream
sc := st.sc
sc.serveG.checkNotOn()
@ -2655,6 +2657,10 @@ func (w *responseWriter) push(target string, opts pushOptions) error {
return ErrRecursivePush
}
if opts == nil {
opts = new(http.PushOptions)
}
// Default options.
if opts.Method == "" {
opts.Method = "GET"

View File

@ -10,6 +10,7 @@ import (
"bufio"
"bytes"
"compress/gzip"
"context"
"crypto/rand"
"crypto/tls"
"errors"
@ -21,6 +22,7 @@ import (
mathrand "math/rand"
"net"
"net/http"
"net/http/httptrace"
"net/textproto"
"sort"
"strconv"
@ -95,6 +97,16 @@ type Transport struct {
// to mean no limit.
MaxHeaderListSize uint32
// StrictMaxConcurrentStreams controls whether the server's
// SETTINGS_MAX_CONCURRENT_STREAMS should be respected
// globally. If false, new TCP connections are created to the
// server as needed to keep each under the per-connection
// SETTINGS_MAX_CONCURRENT_STREAMS limit. If true, the
// server's SETTINGS_MAX_CONCURRENT_STREAMS is interpreted as
// a global limit and callers of RoundTrip block when needed,
// waiting for their turn.
StrictMaxConcurrentStreams bool
// t1, if non-nil, is the standard library Transport using
// this transport. Its settings are used (but not its
// RoundTrip method, etc).
@ -118,16 +130,56 @@ func (t *Transport) disableCompression() bool {
return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression)
}
var errTransportVersion = errors.New("http2: ConfigureTransport is only supported starting at Go 1.6")
// ConfigureTransport configures a net/http HTTP/1 Transport to use HTTP/2.
// It requires Go 1.6 or later and returns an error if the net/http package is too old
// or if t1 has already been HTTP/2-enabled.
// It returns an error if t1 has already been HTTP/2-enabled.
func ConfigureTransport(t1 *http.Transport) error {
_, err := configureTransport(t1) // in configure_transport.go (go1.6) or not_go16.go
_, err := configureTransport(t1)
return err
}
func configureTransport(t1 *http.Transport) (*Transport, error) {
connPool := new(clientConnPool)
t2 := &Transport{
ConnPool: noDialClientConnPool{connPool},
t1: t1,
}
connPool.t = t2
if err := registerHTTPSProtocol(t1, noDialH2RoundTripper{t2}); err != nil {
return nil, err
}
if t1.TLSClientConfig == nil {
t1.TLSClientConfig = new(tls.Config)
}
if !strSliceContains(t1.TLSClientConfig.NextProtos, "h2") {
t1.TLSClientConfig.NextProtos = append([]string{"h2"}, t1.TLSClientConfig.NextProtos...)
}
if !strSliceContains(t1.TLSClientConfig.NextProtos, "http/1.1") {
t1.TLSClientConfig.NextProtos = append(t1.TLSClientConfig.NextProtos, "http/1.1")
}
upgradeFn := func(authority string, c *tls.Conn) http.RoundTripper {
addr := authorityAddr("https", authority)
if used, err := connPool.addConnIfNeeded(addr, t2, c); err != nil {
go c.Close()
return erringRoundTripper{err}
} else if !used {
// Turns out we don't need this c.
// For example, two goroutines made requests to the same host
// at the same time, both kicking off TCP dials. (since protocol
// was unknown)
go c.Close()
}
return t2
}
if m := t1.TLSNextProto; len(m) == 0 {
t1.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{
"h2": upgradeFn,
}
} else {
m["h2"] = upgradeFn
}
return t2, nil
}
func (t *Transport) connPool() ClientConnPool {
t.connPoolOnce.Do(t.initConnPool)
return t.connPoolOrDef
@ -192,7 +244,7 @@ type ClientConn struct {
type clientStream struct {
cc *ClientConn
req *http.Request
trace *clientTrace // or nil
trace *httptrace.ClientTrace // or nil
ID uint32
resc chan resAndError
bufPipe pipe // buffered pipe with the flow-controlled response payload
@ -226,7 +278,7 @@ type clientStream struct {
// channel to be signaled. A non-nil error is returned only if the request was
// canceled.
func awaitRequestCancel(req *http.Request, done <-chan struct{}) error {
ctx := reqContext(req)
ctx := req.Context()
if req.Cancel == nil && ctx.Done() == nil {
return nil
}
@ -401,8 +453,8 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res
select {
case <-time.After(time.Second * time.Duration(backoff)):
continue
case <-reqContext(req).Done():
return nil, reqContext(req).Err()
case <-req.Context().Done():
return nil, req.Context().Err()
}
}
}
@ -439,16 +491,15 @@ func shouldRetryRequest(req *http.Request, err error, afterBodyWrite bool) (*htt
}
// If the Body is nil (or http.NoBody), it's safe to reuse
// this request and its Body.
if req.Body == nil || reqBodyIsNoBody(req.Body) {
if req.Body == nil || req.Body == http.NoBody {
return req, nil
}
// If the request body can be reset back to its original
// state via the optional req.GetBody, do that.
getBody := reqGetBody(req) // Go 1.8: getBody = req.GetBody
if getBody != nil {
if req.GetBody != nil {
// TODO: consider a req.Body.Close here? or audit that all caller paths do?
body, err := getBody()
body, err := req.GetBody()
if err != nil {
return nil, err
}
@ -494,7 +545,7 @@ func (t *Transport) dialClientConn(addr string, singleUse bool) (*ClientConn, er
func (t *Transport) newTLSConfig(host string) *tls.Config {
cfg := new(tls.Config)
if t.TLSClientConfig != nil {
*cfg = *cloneTLSConfig(t.TLSClientConfig)
*cfg = *t.TLSClientConfig.Clone()
}
if !strSliceContains(cfg.NextProtos, NextProtoTLS) {
cfg.NextProtos = append([]string{NextProtoTLS}, cfg.NextProtos...)
@ -545,7 +596,7 @@ func (t *Transport) expectContinueTimeout() time.Duration {
if t.t1 == nil {
return 0
}
return transportExpectContinueTimeout(t.t1)
return t.t1.ExpectContinueTimeout
}
func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
@ -670,8 +721,19 @@ func (cc *ClientConn) idleStateLocked() (st clientConnIdleState) {
if cc.singleUse && cc.nextStreamID > 1 {
return
}
st.canTakeNewRequest = cc.goAway == nil && !cc.closed && !cc.closing &&
int64(cc.nextStreamID)+int64(cc.pendingRequests) < math.MaxInt32
var maxConcurrentOkay bool
if cc.t.StrictMaxConcurrentStreams {
// We'll tell the caller we can take a new request to
// prevent the caller from dialing a new TCP
// connection, but then we'll block later before
// writing it.
maxConcurrentOkay = true
} else {
maxConcurrentOkay = int64(len(cc.streams)+1) < int64(cc.maxConcurrentStreams)
}
st.canTakeNewRequest = cc.goAway == nil && !cc.closed && !cc.closing && maxConcurrentOkay &&
int64(cc.nextStreamID)+2*int64(cc.pendingRequests) < math.MaxInt32
st.freshConn = cc.nextStreamID == 1 && st.canTakeNewRequest
return
}
@ -711,8 +773,7 @@ func (cc *ClientConn) closeIfIdle() {
var shutdownEnterWaitStateHook = func() {}
// Shutdown gracefully close the client connection, waiting for running streams to complete.
// Public implementation is in go17.go and not_go17.go
func (cc *ClientConn) shutdown(ctx contextContext) error {
func (cc *ClientConn) Shutdown(ctx context.Context) error {
if err := cc.sendGoAway(); err != nil {
return err
}
@ -882,7 +943,7 @@ func checkConnHeaders(req *http.Request) error {
// req.ContentLength, where 0 actually means zero (not unknown) and -1
// means unknown.
func actualContentLength(req *http.Request) int64 {
if req.Body == nil || reqBodyIsNoBody(req.Body) {
if req.Body == nil || req.Body == http.NoBody {
return 0
}
if req.ContentLength != 0 {
@ -952,7 +1013,7 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf
cs := cc.newStream()
cs.req = req
cs.trace = requestTrace(req)
cs.trace = httptrace.ContextClientTrace(req.Context())
cs.requestedGzip = requestedGzip
bodyWriter := cc.t.getBodyWriterState(cs, body)
cs.on100 = bodyWriter.on100
@ -990,7 +1051,7 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf
readLoopResCh := cs.resc
bodyWritten := false
ctx := reqContext(req)
ctx := req.Context()
handleReadLoopResponse := func(re resAndError) (*http.Response, bool, error) {
res := re.res
@ -1418,7 +1479,7 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail
return nil, errRequestHeaderListSize
}
trace := requestTrace(req)
trace := httptrace.ContextClientTrace(req.Context())
traceHeaders := traceHasWroteHeaderField(trace)
// Header list size is ok. Write the headers.
@ -1841,7 +1902,7 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra
res.Header.Del("Content-Length")
res.ContentLength = -1
res.Body = &gzipReader{body: res.Body}
setResponseUncompressed(res)
res.Uncompressed = true
}
return res, nil
}
@ -2218,8 +2279,7 @@ func (rl *clientConnReadLoop) processResetStream(f *RSTStreamFrame) error {
}
// Ping sends a PING frame to the server and waits for the ack.
// Public implementation is in go17.go and not_go17.go
func (cc *ClientConn) ping(ctx contextContext) error {
func (cc *ClientConn) Ping(ctx context.Context) error {
c := make(chan struct{})
// Generate a random payload
var p [8]byte
@ -2453,3 +2513,91 @@ func (s bodyWriterState) scheduleBodyWrite() {
func isConnectionCloseRequest(req *http.Request) bool {
return req.Close || httpguts.HeaderValuesContainsToken(req.Header["Connection"], "close")
}
// registerHTTPSProtocol calls Transport.RegisterProtocol but
// converting panics into errors.
func registerHTTPSProtocol(t *http.Transport, rt noDialH2RoundTripper) (err error) {
defer func() {
if e := recover(); e != nil {
err = fmt.Errorf("%v", e)
}
}()
t.RegisterProtocol("https", rt)
return nil
}
// noDialH2RoundTripper is a RoundTripper which only tries to complete the request
// if there's already has a cached connection to the host.
// (The field is exported so it can be accessed via reflect from net/http; tested
// by TestNoDialH2RoundTripperType)
type noDialH2RoundTripper struct{ *Transport }
func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
res, err := rt.Transport.RoundTrip(req)
if isNoCachedConnError(err) {
return nil, http.ErrSkipAltProtocol
}
return res, err
}
func (t *Transport) idleConnTimeout() time.Duration {
if t.t1 != nil {
return t.t1.IdleConnTimeout
}
return 0
}
func traceGetConn(req *http.Request, hostPort string) {
trace := httptrace.ContextClientTrace(req.Context())
if trace == nil || trace.GetConn == nil {
return
}
trace.GetConn(hostPort)
}
func traceGotConn(req *http.Request, cc *ClientConn) {
trace := httptrace.ContextClientTrace(req.Context())
if trace == nil || trace.GotConn == nil {
return
}
ci := httptrace.GotConnInfo{Conn: cc.tconn}
cc.mu.Lock()
ci.Reused = cc.nextStreamID > 1
ci.WasIdle = len(cc.streams) == 0 && ci.Reused
if ci.WasIdle && !cc.lastActive.IsZero() {
ci.IdleTime = time.Now().Sub(cc.lastActive)
}
cc.mu.Unlock()
trace.GotConn(ci)
}
func traceWroteHeaders(trace *httptrace.ClientTrace) {
if trace != nil && trace.WroteHeaders != nil {
trace.WroteHeaders()
}
}
func traceGot100Continue(trace *httptrace.ClientTrace) {
if trace != nil && trace.Got100Continue != nil {
trace.Got100Continue()
}
}
func traceWait100Continue(trace *httptrace.ClientTrace) {
if trace != nil && trace.Wait100Continue != nil {
trace.Wait100Continue()
}
}
func traceWroteRequest(trace *httptrace.ClientTrace, err error) {
if trace != nil && trace.WroteRequest != nil {
trace.WroteRequest(httptrace.WroteRequestInfo{Err: err})
}
}
func traceFirstResponseByte(trace *httptrace.ClientTrace) {
if trace != nil && trace.GotFirstResponseByte != nil {
trace.GotFirstResponseByte()
}
}

View File

@ -199,7 +199,7 @@ func (w *writeResHeaders) staysWithinBuffer(max int) bool {
// TODO: this is a common one. It'd be nice to return true
// here and get into the fast path if we could be clever and
// calculate the size fast enough, or at least a conservative
// uppper bound that usually fires. (Maybe if w.h and
// upper bound that usually fires. (Maybe if w.h and
// w.trailers are nil, so we don't need to enumerate it.)
// Otherwise I'm afraid that just calculating the length to
// answer this question would be slower than the ~2µs benefit.
@ -329,7 +329,7 @@ func (wu writeWindowUpdate) writeFrame(ctx writeContext) error {
}
// encodeHeaders encodes an http.Header. If keys is not nil, then (k, h[k])
// is encoded only only if k is in keys.
// is encoded only if k is in keys.
func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) {
if keys == nil {
sorter := sorterPool.Get().(*sorter)

View File

@ -8,28 +8,8 @@ package nettest
import (
"runtime"
"strconv"
"strings"
"syscall"
)
var darwinVersion int
func init() {
if runtime.GOOS == "darwin" {
// See http://support.apple.com/kb/HT1633.
s, err := syscall.Sysctl("kern.osrelease")
if err != nil {
return
}
ss := strings.Split(s, ".")
if len(ss) == 0 {
return
}
darwinVersion, _ = strconv.Atoi(ss[0])
}
}
func supportsIPv6MulticastDeliveryOnLoopback() bool {
switch runtime.GOOS {
case "freebsd":
@ -38,16 +18,7 @@ func supportsIPv6MulticastDeliveryOnLoopback() bool {
// kernels don't deliver link-local scoped multicast
// packets correctly.
return false
case "darwin":
return !causesIPv6Crash()
default:
return true
}
}
func causesIPv6Crash() bool {
// We see some kernel crash when running IPv6 with IP-level
// options on Darwin kernel version 12 or below.
// See golang.org/issues/17015.
return darwinVersion < 13
}

View File

@ -2,14 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux solaris
// +build aix linux solaris
package nettest
func supportsIPv6MulticastDeliveryOnLoopback() bool {
return true
}
func causesIPv6Crash() bool {
return false
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package nettest

View File

@ -23,10 +23,6 @@ func supportsIPv6MulticastDeliveryOnLoopback() bool {
return false
}
func causesIPv6Crash() bool {
return false
}
func protocolNotSupported(err error) bool {
return false
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package nettest

View File

@ -36,7 +36,3 @@ func supportsRawIPSocket() (string, bool) {
func supportsIPv6MulticastDeliveryOnLoopback() bool {
return true
}
func causesIPv6Crash() bool {
return false
}

View File

@ -72,7 +72,7 @@ func TestableNetwork(network string) bool {
}
case "unixpacket":
switch runtime.GOOS {
case "android", "darwin", "freebsd", "js", "nacl", "plan9", "windows":
case "aix", "android", "darwin", "freebsd", "js", "nacl", "plan9", "windows":
return false
case "netbsd":
// It passes on amd64 at least. 386 fails (Issue 22927). arm is unknown.

View File

@ -224,6 +224,7 @@ func (d *Dialer) Dial(network, address string) (net.Conn, error) {
return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
}
if _, err := d.DialWithConn(context.Background(), c, network, address); err != nil {
c.Close()
return nil, err
}
return c, nil

View File

@ -79,8 +79,13 @@ func FromURL(u *url.URL, forward Dialer) (Dialer, error) {
}
switch u.Scheme {
case "socks5":
return SOCKS5("tcp", u.Host, auth, forward)
case "socks5", "socks5h":
addr := u.Hostname()
port := u.Port()
if port == "" {
port = "1080"
}
return SOCKS5("tcp", net.JoinHostPort(addr, port), auth, forward)
}
// If the scheme doesn't match any of the built-in schemes, see if it

View File

@ -6,16 +6,11 @@ go_library(
"events.go",
"histogram.go",
"trace.go",
"trace_go16.go",
"trace_go17.go",
],
importmap = "k8s.io/kubernetes/vendor/golang.org/x/net/trace",
importpath = "golang.org/x/net/trace",
visibility = ["//visibility:public"],
deps = [
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/golang.org/x/net/internal/timeseries:go_default_library",
],
deps = ["//vendor/golang.org/x/net/internal/timeseries:go_default_library"],
)
filegroup(

View File

@ -64,6 +64,7 @@ package trace
import (
"bytes"
"context"
"fmt"
"html/template"
"io"
@ -85,6 +86,12 @@ import (
// FOR DEBUGGING ONLY. This will slow down the program.
var DebugUseAfterFinish = false
// HTTP ServeMux paths.
const (
debugRequestsPath = "/debug/requests"
debugEventsPath = "/debug/events"
)
// AuthRequest determines whether a specific request is permitted to load the
// /debug/requests or /debug/events pages.
//
@ -111,8 +118,8 @@ var AuthRequest = func(req *http.Request) (any, sensitive bool) {
}
func init() {
_, pat := http.DefaultServeMux.Handler(&http.Request{URL: &url.URL{Path: "/debug/requests"}})
if pat != "" {
_, pat := http.DefaultServeMux.Handler(&http.Request{URL: &url.URL{Path: debugRequestsPath}})
if pat == debugRequestsPath {
panic("/debug/requests is already registered. You may have two independent copies of " +
"golang.org/x/net/trace in your binary, trying to maintain separate state. This may " +
"involve a vendored copy of golang.org/x/net/trace.")
@ -120,8 +127,20 @@ func init() {
// TODO(jbd): Serve Traces from /debug/traces in the future?
// There is no requirement for a request to be present to have traces.
http.HandleFunc("/debug/requests", Traces)
http.HandleFunc("/debug/events", Events)
http.HandleFunc(debugRequestsPath, Traces)
http.HandleFunc(debugEventsPath, Events)
}
// NewContext returns a copy of the parent context
// and associates it with a Trace.
func NewContext(ctx context.Context, tr Trace) context.Context {
return context.WithValue(ctx, contextKey, tr)
}
// FromContext returns the Trace bound to the context, if any.
func FromContext(ctx context.Context) (tr Trace, ok bool) {
tr, ok = ctx.Value(contextKey).(Trace)
return
}
// Traces responds with traces from the program.

View File

@ -1,21 +0,0 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.7
package trace
import "golang.org/x/net/context"
// NewContext returns a copy of the parent context
// and associates it with a Trace.
func NewContext(ctx context.Context, tr Trace) context.Context {
return context.WithValue(ctx, contextKey, tr)
}
// FromContext returns the Trace bound to the context, if any.
func FromContext(ctx context.Context) (tr Trace, ok bool) {
tr, ok = ctx.Value(contextKey).(Trace)
return
}

View File

@ -1,21 +0,0 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.7
package trace
import "context"
// NewContext returns a copy of the parent context
// and associates it with a Trace.
func NewContext(ctx context.Context, tr Trace) context.Context {
return context.WithValue(ctx, contextKey, tr)
}
// FromContext returns the Trace bound to the context, if any.
func FromContext(ctx context.Context) (tr Trace, ok bool) {
tr, ok = ctx.Value(contextKey).(Trace)
return
}