Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
740a6a7a
Commit
740a6a7a
authored
Sep 10, 2015
by
Alexander Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use func from stdlib to clone *tls.Config for calming vet
Signed-off-by:
Alexander Morozov
<
lk4d4@docker.com
>
parent
1236e492
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
server/server.go
server/server.go
+29
-4
No files found.
server/server.go
View file @
740a6a7a
...
...
@@ -113,6 +113,34 @@ func (s *Server) Serve() error {
return
server
.
ListenAndServe
()
}
// copy from net/http/transport.go
func
cloneTLSConfig
(
cfg
*
tls
.
Config
)
*
tls
.
Config
{
if
cfg
==
nil
{
return
&
tls
.
Config
{}
}
return
&
tls
.
Config
{
Rand
:
cfg
.
Rand
,
Time
:
cfg
.
Time
,
Certificates
:
cfg
.
Certificates
,
NameToCertificate
:
cfg
.
NameToCertificate
,
GetCertificate
:
cfg
.
GetCertificate
,
RootCAs
:
cfg
.
RootCAs
,
NextProtos
:
cfg
.
NextProtos
,
ServerName
:
cfg
.
ServerName
,
ClientAuth
:
cfg
.
ClientAuth
,
ClientCAs
:
cfg
.
ClientCAs
,
InsecureSkipVerify
:
cfg
.
InsecureSkipVerify
,
CipherSuites
:
cfg
.
CipherSuites
,
PreferServerCipherSuites
:
cfg
.
PreferServerCipherSuites
,
SessionTicketsDisabled
:
cfg
.
SessionTicketsDisabled
,
SessionTicketKey
:
cfg
.
SessionTicketKey
,
ClientSessionCache
:
cfg
.
ClientSessionCache
,
MinVersion
:
cfg
.
MinVersion
,
MaxVersion
:
cfg
.
MaxVersion
,
CurvePreferences
:
cfg
.
CurvePreferences
,
}
}
// ListenAndServeTLSWithSNI serves TLS with Server Name Indication (SNI) support, which allows
// multiple sites (different hostnames) to be served from the same address. This method is
// adapted directly from the std lib's net/http ListenAndServeTLS function, which was
...
...
@@ -123,10 +151,7 @@ func ListenAndServeTLSWithSNI(srv *http.Server, tlsConfigs []TLSConfig) error {
addr
=
":https"
}
config
:=
new
(
tls
.
Config
)
if
srv
.
TLSConfig
!=
nil
{
*
config
=
*
srv
.
TLSConfig
}
config
:=
cloneTLSConfig
(
srv
.
TLSConfig
)
if
config
.
NextProtos
==
nil
{
config
.
NextProtos
=
[]
string
{
"http/1.1"
}
}
...
...
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