Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
024f4ecd
Commit
024f4ecd
authored
Nov 11, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make spdy.roundtripper usable with UpgradeAwareProxyHandler
parent
868f6e1c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
roundtripper.go
pkg/util/httpstream/spdy/roundtripper.go
+5
-0
http.go
pkg/util/net/http.go
+6
-0
http_test.go
pkg/util/net/http_test.go
+21
-0
No files found.
pkg/util/httpstream/spdy/roundtripper.go
View file @
024f4ecd
...
...
@@ -72,6 +72,11 @@ func NewSpdyRoundTripper(tlsConfig *tls.Config) *SpdyRoundTripper {
return
&
SpdyRoundTripper
{
tlsConfig
:
tlsConfig
}
}
// implements pkg/util/net.TLSClientConfigHolder for proper TLS checking during proxying with a spdy roundtripper
func
(
s
*
SpdyRoundTripper
)
TLSClientConfig
()
*
tls
.
Config
{
return
s
.
tlsConfig
}
// dial dials the host specified by req, using TLS if appropriate, optionally
// using a proxy server if one is configured via environment variables.
func
(
s
*
SpdyRoundTripper
)
dial
(
req
*
http
.
Request
)
(
net
.
Conn
,
error
)
{
...
...
pkg/util/net/http.go
View file @
024f4ecd
...
...
@@ -138,6 +138,10 @@ func CloneTLSConfig(cfg *tls.Config) *tls.Config {
}
}
type
TLSClientConfigHolder
interface
{
TLSClientConfig
()
*
tls
.
Config
}
func
TLSClientConfig
(
transport
http
.
RoundTripper
)
(
*
tls
.
Config
,
error
)
{
if
transport
==
nil
{
return
nil
,
nil
...
...
@@ -146,6 +150,8 @@ func TLSClientConfig(transport http.RoundTripper) (*tls.Config, error) {
switch
transport
:=
transport
.
(
type
)
{
case
*
http
.
Transport
:
return
transport
.
TLSClientConfig
,
nil
case
TLSClientConfigHolder
:
return
transport
.
TLSClientConfig
(),
nil
case
RoundTripperWrapper
:
return
TLSClientConfig
(
transport
.
WrappedRoundTripper
())
default
:
...
...
pkg/util/net/http_test.go
View file @
024f4ecd
...
...
@@ -218,3 +218,24 @@ func TestProxierWithNoProxyCIDR(t *testing.T) {
}
}
}
type
fakeTLSClientConfigHolder
struct
{
called
bool
}
func
(
f
*
fakeTLSClientConfigHolder
)
TLSClientConfig
()
*
tls
.
Config
{
f
.
called
=
true
return
nil
}
func
(
f
*
fakeTLSClientConfigHolder
)
RoundTrip
(
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
return
nil
,
nil
}
func
TestTLSClientConfigHolder
(
t
*
testing
.
T
)
{
rt
:=
&
fakeTLSClientConfigHolder
{}
TLSClientConfig
(
rt
)
if
!
rt
.
called
{
t
.
Errorf
(
"didn't find tls config"
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment