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
ae7e0982
Commit
ae7e0982
authored
Jul 24, 2017
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpserver: Only enable QUIC for sites with TLS & HTTP2 enabled
parent
6e0317a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
caddyhttp/httpserver/server.go
caddyhttp/httpserver/server.go
+7
-7
No files found.
caddyhttp/httpserver/server.go
View file @
ae7e0982
...
@@ -77,14 +77,14 @@ func NewServer(addr string, group []*SiteConfig) (*Server, error) {
...
@@ -77,14 +77,14 @@ func NewServer(addr string, group []*SiteConfig) (*Server, error) {
}
}
s
.
Server
.
TLSConfig
=
tlsConfig
s
.
Server
.
TLSConfig
=
tlsConfig
// Enable QUIC if desired
if
QUIC
{
s
.
quicServer
=
&
h2quic
.
Server
{
Server
:
s
.
Server
}
s
.
Server
.
Handler
=
s
.
wrapWithSvcHeaders
(
s
.
Server
.
Handler
)
}
// if TLS is enabled, make sure we prepare the Server accordingly
// if TLS is enabled, make sure we prepare the Server accordingly
if
s
.
Server
.
TLSConfig
!=
nil
{
if
s
.
Server
.
TLSConfig
!=
nil
{
// enable QUIC if desired (requires HTTP/2)
if
HTTP2
&&
QUIC
{
s
.
quicServer
=
&
h2quic
.
Server
{
Server
:
s
.
Server
}
s
.
Server
.
Handler
=
s
.
wrapWithSvcHeaders
(
s
.
Server
.
Handler
)
}
// wrap the HTTP handler with a handler that does MITM detection
// wrap the HTTP handler with a handler that does MITM detection
tlsh
:=
&
tlsHandler
{
next
:
s
.
Server
.
Handler
}
tlsh
:=
&
tlsHandler
{
next
:
s
.
Server
.
Handler
}
s
.
Server
.
Handler
=
tlsh
// this needs to be the "outer" handler when Serve() is called, for type assertion
s
.
Server
.
Handler
=
tlsh
// this needs to be the "outer" handler when Serve() is called, for type assertion
...
@@ -302,7 +302,7 @@ func (s *Server) Serve(ln net.Listener) error {
...
@@ -302,7 +302,7 @@ func (s *Server) Serve(ln net.Listener) error {
// ServePacket serves QUIC requests on pc until it is closed.
// ServePacket serves QUIC requests on pc until it is closed.
func
(
s
*
Server
)
ServePacket
(
pc
net
.
PacketConn
)
error
{
func
(
s
*
Server
)
ServePacket
(
pc
net
.
PacketConn
)
error
{
if
QUIC
{
if
s
.
quicServer
!=
nil
{
err
:=
s
.
quicServer
.
Serve
(
pc
.
(
*
net
.
UDPConn
))
err
:=
s
.
quicServer
.
Serve
(
pc
.
(
*
net
.
UDPConn
))
return
fmt
.
Errorf
(
"serving QUIC connections: %v"
,
err
)
return
fmt
.
Errorf
(
"serving QUIC connections: %v"
,
err
)
}
}
...
...
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