This commit is contained in:
Hedy Li 2021-08-03 09:20:47 +08:00
parent 253fba2824
commit 8cf1358f1c
Signed by: hedy
GPG Key ID: B51B5A8D1B176372
2 changed files with 22 additions and 25 deletions

View File

@ -10,31 +10,31 @@ import (
)
type Config struct {
Port int
Hostname string
RootDir string
UserDirEnable bool
UserDir string
DirlistEnable bool
DirlistReverse bool
DirlistSort string
DirlistTitles bool
CGIPaths []string
UserCGIEnable bool
Port int
Hostname string
RootDir string
UserDirEnable bool
UserDir string
DirlistEnable bool
DirlistReverse bool
DirlistSort string
DirlistTitles bool
CGIPaths []string
UserCGIEnable bool
}
var defaultConf = &Config{
Port: 300,
Hostname: "localhost",
RootDir: "/var/spartan/",
DirlistEnable: true,
DirlistReverse: false,
DirlistSort: "name",
DirlistTitles: true,
UserDirEnable: true,
UserDir: "public_spartan",
CGIPaths: []string{"cgi/"},
UserCGIEnable: false, // Turned off by default because scripts are run by server user as of now
Port: 300,
Hostname: "localhost",
RootDir: "/var/spartan/",
DirlistEnable: true,
DirlistReverse: false,
DirlistSort: "name",
DirlistTitles: true,
UserDirEnable: true,
UserDir: "public_spartan",
CGIPaths: []string{"cgi/"},
UserCGIEnable: false, // Turned off by default because scripts are run by server user as of now
}
func LoadConfig(path string) (*Config, error) {

View File

@ -18,7 +18,6 @@ import (
flag "github.com/spf13/pflag"
)
type Request struct {
conn io.ReadWriteCloser
netConn *net.Conn
@ -114,7 +113,6 @@ func handleConnection(netConn net.Conn, conf *Config) {
return 0, nil, nil
})
// Sanity check incoming request URL content.
if ok := s.Scan(); !ok {
sendResponseHeader(conn, statusClientError, "Request not valid")
@ -335,4 +333,3 @@ func parseRequest(r string) (host, path string, contentLength int, err error) {
}
return
}