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
Łukasz Nowak
caddy
Commits
dc6c986b
Commit
dc6c986b
authored
Jan 28, 2017
by
Matt Holt
Committed by
GitHub
Jan 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1381 from tw4452852/958
httpserver: support QUIC reload
parents
16250da3
65cb966d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
caddyhttp/httpserver/server.go
caddyhttp/httpserver/server.go
+19
-13
No files found.
caddyhttp/httpserver/server.go
View file @
dc6c986b
...
...
@@ -145,8 +145,17 @@ func (s *Server) Listen() (net.Listener, error) {
return
ln
.
(
*
net
.
TCPListener
),
nil
}
// ListenPacket is a noop to implement the Server interface.
func
(
s
*
Server
)
ListenPacket
()
(
net
.
PacketConn
,
error
)
{
return
nil
,
nil
}
// ListenPacket creates udp connection for QUIC if it is enabled,
func
(
s
*
Server
)
ListenPacket
()
(
net
.
PacketConn
,
error
)
{
if
QUIC
{
udpAddr
,
err
:=
net
.
ResolveUDPAddr
(
"udp"
,
s
.
Server
.
Addr
)
if
err
!=
nil
{
return
nil
,
err
}
return
net
.
ListenUDP
(
"udp"
,
udpAddr
)
}
return
nil
,
nil
}
// Serve serves requests on ln. It blocks until ln is closed.
func
(
s
*
Server
)
Serve
(
ln
net
.
Listener
)
error
{
...
...
@@ -172,15 +181,6 @@ func (s *Server) Serve(ln net.Listener) error {
s
.
tlsGovChan
=
caddytls
.
RotateSessionTicketKeys
(
s
.
Server
.
TLSConfig
)
}
if
QUIC
{
go
func
()
{
err
:=
s
.
quicServer
.
ListenAndServe
()
if
err
!=
nil
{
log
.
Printf
(
"[ERROR] listening for QUIC connections: %v"
,
err
)
}
}()
}
err
:=
s
.
Server
.
Serve
(
ln
)
if
QUIC
{
s
.
quicServer
.
Close
()
...
...
@@ -188,8 +188,14 @@ func (s *Server) Serve(ln net.Listener) error {
return
err
}
// ServePacket is a noop to implement the Server interface.
func
(
s
*
Server
)
ServePacket
(
pc
net
.
PacketConn
)
error
{
return
nil
}
// ServePacket serves QUIC requests on pc until it is closed.
func
(
s
*
Server
)
ServePacket
(
pc
net
.
PacketConn
)
error
{
if
QUIC
{
err
:=
s
.
quicServer
.
Serve
(
pc
.
(
*
net
.
UDPConn
))
return
fmt
.
Errorf
(
"serving QUIC connections: %v"
,
err
)
}
return
nil
}
// ServeHTTP is the entry point of all HTTP requests.
func
(
s
*
Server
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
...
...
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