aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYotam Nachum <me@yotam.net>2019-12-20 20:54:53 +0200
committerYotam Nachum <me@yotam.net>2019-12-20 20:54:53 +0200
commit3a9ce465662599488ca98692a963bb680cfd872a (patch)
treec56a9372f2ef5038f3dbf1b01a854fa7f4d603d9
parentExecute requested file if it's executable (diff)
downloadshavit-3a9ce465662599488ca98692a963bb680cfd872a.tar.gz
shavit-3a9ce465662599488ca98692a963bb680cfd872a.zip
Add an option to toggle execution feature
-rw-r--r--handler.go2
-rw-r--r--input.go3
2 files changed, 4 insertions, 1 deletions
diff --git a/handler.go b/handler.go
index 0c81c2e..b913906 100644
--- a/handler.go
+++ b/handler.go
@@ -127,7 +127,7 @@ func (h Handler) Handle(r gemini.Request) gemini.Response {
return gemini.ErrorResponse(err)
}
- if isExecutable(path) {
+ if h.cfg.ExecuteFiles && isExecutable(path) {
return h.serveExecutable(r, path)
}
diff --git a/input.go b/input.go
index 6b3d0e8..12ccf78 100644
--- a/input.go
+++ b/input.go
@@ -42,6 +42,9 @@ type Config struct {
// default to 5
ExecTimeout int64 `toml:"exec_timeout"`
+ // default to false because the content might not be trusted
+ ExecuteFiles bool
+
TLSCert string `toml:"tls_certificate"`
TLSKey string `toml:"tls_key"`
}