blob: a2decee4e6e72ffb82b6de750813faf2079ce6ad (
plain) (
tree)
|
|
package main
import (
"flag"
"log"
"net/http"
"net/http/cgi"
"strings"
)
func main() {
path := flag.String("path", "", "Path to the cgi binary")
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")
flag.Parse()
forwarder := &cgi.Handler{
Path: *path,
Root: *prefix,
Env: strings.Split(*env, ","),
Dir: *dir,
}
http.Handle("/", forwarder)
log.Fatalf("server stopped working: %s", http.ListenAndServe(":8080", nil))
}
|