diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -2,12 +2,14 @@ package main import ( "flag" + "io/fs" "log" "net" "net/http" "net/http/cgi" "os" "os/signal" + "strconv" "strings" ) @@ -16,6 +18,7 @@ func main() { dir := flag.String("dir", "", "set a different working directory from the base path of 'path'") env := flag.String("env", "", "set environment variables for the CGI process") prefix := flag.String("uri-prefix", "/", "set the URL prefix when the CGI process is hosted in a sub directory") + socketMode := flag.String("mode", "777", "set the filesystem mode when using a unix socket") addr := flag.String("listen", "127.0.0.1:8080", "set the listen address") flag.Parse() @@ -38,6 +41,14 @@ func main() { if err != nil { log.Fatalf("could not start to listen: %s", err) } + if listenType == "unix" { + mode, err := strconv.ParseUint(*socketMode, 8, 32) + if err != nil { + log.Fatalf("could not parse mode: %s", err) + } + log.Printf("what we parsed: %s", fs.FileMode(mode)) + os.Chmod(listenAddr, fs.FileMode(mode)) + } forwarder := &cgi.Handler{ Path: *path, |