diff options
| -rw-r--r-- | parse.go | 13 | ||||
| -rw-r--r-- | types.go | 10 |
2 files changed, 20 insertions, 3 deletions
@@ -265,9 +265,18 @@ func parseServerDirectives(server *Server, buf *bufio.Reader) error { return nil } +func emptyExceptTemplates(mods *Modifiers) bool { + if mods == nil { + return true + } + cpy := *mods + cpy.Templates = nil + return cpy.Empty() +} + func validateRoute(serverType string, dir *RouteDirective) error { - if dir.Type == "git" && !dir.Modifiers.Empty() { - return errors.New("git directives don't support 'with' modifiers") + if dir.Type == "git" && !emptyExceptTemplates(&dir.Modifiers) { + return errors.New("unsupported 'with' modifier on 'git' directive") } if dir.Type == "cgi" && (dir.Modifiers.Exec || dir.Modifiers.DirList || dir.Modifiers.DirDefault != "") { @@ -25,7 +25,15 @@ type Modifiers struct { } func (m Modifiers) Empty() bool { - return m.DirDefault == "" && !m.DirList && !m.Exec && !m.ExtendedGophermap + return (m.DirDefault == "" && + !m.DirList && + !m.Exec && + !m.ExtendedGophermap && + m.ExecCmd == "" && + !m.AutoAtom && + m.Titan == nil && + m.titanName == "" && + m.Templates == nil) } type RouteDirective struct { |
