fmt
This commit is contained in:
parent
253fba2824
commit
8cf1358f1c
44
config.go
44
config.go
|
@ -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) {
|
||||
|
|
3
spsrv.go
3
spsrv.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue