summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/server.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-06-18 11:13:12 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-06-18 11:13:12 -0600
commit6706c9225a8dcb976785bdf2c35eb151d54ac18c (patch)
tree1e278a1261e826d0bda3c924bd179aabd0af2e92 /modules/caddyhttp/server.go
parent5137859e47678aae81e178ca7d164f9e2b4e3121 (diff)
Implement templates handler; various minor cleanups and bug fixes
Diffstat (limited to 'modules/caddyhttp/server.go')
-rw-r--r--modules/caddyhttp/server.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index 3de82f6..61b5631 100644
--- a/modules/caddyhttp/server.go
+++ b/modules/caddyhttp/server.go
@@ -15,10 +15,10 @@ import (
// Server is an HTTP server.
type Server struct {
Listen []string `json:"listen,omitempty"`
- ReadTimeout caddy.Duration `json:"read_timeout,omitempty"`
- ReadHeaderTimeout caddy.Duration `json:"read_header_timeout,omitempty"`
- WriteTimeout caddy.Duration `json:"write_timeout,omitempty"`
- IdleTimeout caddy.Duration `json:"idle_timeout,omitempty"`
+ ReadTimeout caddy.Duration `json:"read_timeout,omitempty"`
+ ReadHeaderTimeout caddy.Duration `json:"read_header_timeout,omitempty"`
+ WriteTimeout caddy.Duration `json:"write_timeout,omitempty"`
+ IdleTimeout caddy.Duration `json:"idle_timeout,omitempty"`
MaxHeaderBytes int `json:"max_header_bytes,omitempty"`
Routes RouteList `json:"routes,omitempty"`
Errors *httpErrorConfig `json:"errors,omitempty"`
@@ -40,6 +40,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// set up the context for the request
repl := caddy.NewReplacer()
ctx := context.WithValue(r.Context(), caddy.ReplacerCtxKey, repl)
+ ctx = context.WithValue(ctx, ServerCtxKey, s)
ctx = context.WithValue(ctx, TableCtxKey, make(map[string]interface{})) // TODO: Implement this
r = r.WithContext(ctx)
@@ -126,5 +127,7 @@ type httpErrorConfig struct {
// the logging configuration first.
}
-// TableCtxKey is the context key for the request's variable table.
+const ServerCtxKey caddy.CtxKey = "server"
+
+// TableCtxKey is the context key for the request's variable table. TODO: implement this
const TableCtxKey caddy.CtxKey = "table"