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
d0a02166
Commit
d0a02166
authored
Apr 09, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added flag to disable http/2 support (still enabled by default)
parent
2a0cfb60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
main.go
main.go
+6
-1
server/server.go
server/server.go
+5
-2
No files found.
main.go
View file @
d0a02166
...
@@ -9,10 +9,14 @@ import (
...
@@ -9,10 +9,14 @@ import (
"github.com/mholt/caddy/server"
"github.com/mholt/caddy/server"
)
)
var
conf
string
var
(
conf
string
http2
bool
)
func
init
()
{
func
init
()
{
flag
.
StringVar
(
&
conf
,
"conf"
,
server
.
DefaultConfigFile
,
"the configuration file to use"
)
flag
.
StringVar
(
&
conf
,
"conf"
,
server
.
DefaultConfigFile
,
"the configuration file to use"
)
flag
.
BoolVar
(
&
http2
,
"http2"
,
true
,
"enable HTTP/2 support"
)
// flag temporary until http2 merged into std lib
}
}
func
main
()
{
func
main
()
{
...
@@ -34,6 +38,7 @@ func main() {
...
@@ -34,6 +38,7 @@ func main() {
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
s
.
HTTP2
=
http2
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
func
(
s
*
server
.
Server
)
{
go
func
(
s
*
server
.
Server
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
...
...
server/server.go
View file @
d0a02166
...
@@ -26,6 +26,7 @@ var servers = make(map[string]*Server)
...
@@ -26,6 +26,7 @@ var servers = make(map[string]*Server)
// Server represents an instance of a server, which serves
// Server represents an instance of a server, which serves
// static content at a particular address (host and port).
// static content at a particular address (host and port).
type
Server
struct
{
type
Server
struct
{
HTTP2
bool
// temporary while http2 is not in std lib (TODO: remove flag when part of std lib)
config
config
.
Config
config
config
.
Config
fileServer
middleware
.
Handler
fileServer
middleware
.
Handler
stack
middleware
.
Handler
stack
middleware
.
Handler
...
@@ -83,8 +84,10 @@ func (s *Server) Serve() error {
...
@@ -83,8 +84,10 @@ func (s *Server) Serve() error {
Handler
:
s
,
Handler
:
s
,
}
}
// TODO: This call may not be necessary after HTTP/2 is merged into std lib
if
s
.
HTTP2
{
http2
.
ConfigureServer
(
server
,
nil
)
// TODO: This call may not be necessary after HTTP/2 is merged into std lib
http2
.
ConfigureServer
(
server
,
nil
)
}
// Execute shutdown commands on exit
// Execute shutdown commands on exit
go
func
()
{
go
func
()
{
...
...
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