Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
caddyhttp: Minor cleanup and fix nil pointer deref in caddyfile adapter
Matthew Holt committed
Oct 28, 2019 at 15:08 UTC
442fd748f6ef1215fb859d8aefe6c817988d189a
3 files changed
+20
-5
caddyconfig/httpcaddyfile/httptype.go
+6
@@ -215,6 +215,12 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
215
if tlsApp.Automation == nil {
216
tlsApp.Automation = new(caddytls.AutomationConfig)
217
}
218
+ if !hasACMECA {
219
+ acmeCA = ""
220
+ }
221
+ if !hasEmail {
222
+ email = ""
223
+ }
224
tlsApp.Automation.Policies = append(tlsApp.Automation.Policies, caddytls.AutomationPolicy{
225
ManagementRaw: caddyconfig.JSONModuleObject(caddytls.ACMEManagerMaker{
226
CA: acmeCA.(string),
modules/caddyhttp/caddyauth/command.go
+4
@@ -56,6 +56,10 @@ func cmdHashPassword(fs caddycmd.Flags) (int, error) {
56
plaintext := []byte(fs.String("plaintext"))
57
salt := []byte(fs.String("salt"))
58
59
+ if len(plaintext) == 0 {
60
+ return caddy.ExitCodeFailedStartup, fmt.Errorf("password is required")
61
+ }
62
+
63
var hash []byte
64
var err error
65
switch algorithm {
modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go
+10
-5
@@ -82,12 +82,17 @@ func (t *Transport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
82
//
83
// is equivalent to:
84
//
85
-// matcher indexFiles {
85
+// matcher canonicalPath {
86
// file {
87
-// try_files {path} index.php
87
+// try_files {path}/index.php
88
+// }
89
+// not {
90
+// path */
91
// }
92
// }
90
-// rewrite match:indexFiles {http.matchers.file.relative}
93
+// redir match:canonicalPath {path}/ 308
94
+//
95
+// try_files {path} {path}/index.php index.php
96
//
97
// matcher phpFiles {
98
// path *.php
@@ -101,8 +106,8 @@ func (t *Transport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
106
// Thus, this directive produces multiple routes, each with a different
107
// matcher because multiple consecutive routes are necessary to support
108
// the common PHP use case. If this "common" config is not compatible
104
-// with a user's PHP requirements, they can use the manual approach as
105
-// above to configure it precisely as they need.
109
+// with a user's PHP requirements, they can use a manual approach based
110
+// on the example above to configure it precisely as they need.
111
//
112
// If a matcher is specified by the user, for example:
113
//