Browse Source

caddyhttp: Minor cleanup and fix nil pointer deref in caddyfile adapter

master
Matthew Holt 6 years ago
parent
commit
442fd748f6
No known key found for this signature in database GPG Key ID: 2A349DD577D586A5
  1. 6
      caddyconfig/httpcaddyfile/httptype.go
  2. 4
      modules/caddyhttp/caddyauth/command.go
  3. 15
      modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go

6
caddyconfig/httpcaddyfile/httptype.go

@ -215,6 +215,12 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
if tlsApp.Automation == nil {
tlsApp.Automation = new(caddytls.AutomationConfig)
}
if !hasACMECA {
acmeCA = ""
}
if !hasEmail {
email = ""
}
tlsApp.Automation.Policies = append(tlsApp.Automation.Policies, caddytls.AutomationPolicy{
ManagementRaw: caddyconfig.JSONModuleObject(caddytls.ACMEManagerMaker{
CA: acmeCA.(string),

4
modules/caddyhttp/caddyauth/command.go

@ -56,6 +56,10 @@ func cmdHashPassword(fs caddycmd.Flags) (int, error) {
plaintext := []byte(fs.String("plaintext"))
salt := []byte(fs.String("salt"))
if len(plaintext) == 0 {
return caddy.ExitCodeFailedStartup, fmt.Errorf("password is required")
}
var hash []byte
var err error
switch algorithm {

15
modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go

@ -82,12 +82,17 @@ func (t *Transport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
//
// is equivalent to:
//
// matcher indexFiles {
// matcher canonicalPath {
// file {
// try_files {path} index.php
// try_files {path}/index.php
// }
// not {
// path */
// }
// }
// rewrite match:indexFiles {http.matchers.file.relative}
// redir match:canonicalPath {path}/ 308
//
// try_files {path} {path}/index.php index.php
//
// matcher phpFiles {
// path *.php
@ -101,8 +106,8 @@ func (t *Transport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
// Thus, this directive produces multiple routes, each with a different
// matcher because multiple consecutive routes are necessary to support
// the common PHP use case. If this "common" config is not compatible
// with a user's PHP requirements, they can use the manual approach as
// above to configure it precisely as they need.
// with a user's PHP requirements, they can use a manual approach based
// on the example above to configure it precisely as they need.
//
// If a matcher is specified by the user, for example:
//

Loading…
Cancel
Save