|
|
|
@ -146,7 +146,7 @@ func servePath(c *tls.Conn, request *url.URL, serve *pathConfig) (int, int64) {
|
|
|
|
|
if !serve.HiddenFiles { |
|
|
|
|
for _, piece := range requestSplit { |
|
|
|
|
if len(piece) > 0 && piece[0] == '.' { |
|
|
|
|
return writeStatus(c, statusTemporaryFailure), -1 |
|
|
|
|
return writeStatus(c, statusNotFound), -1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -161,7 +161,9 @@ func servePath(c *tls.Conn, request *url.URL, serve *pathConfig) (int, int64) {
|
|
|
|
|
if !serve.SymLinks { |
|
|
|
|
for i := range requestSplit[pathSlashes:] { |
|
|
|
|
info, err := os.Lstat(path.Join(root, strings.Join(requestSplit[pathSlashes:pathSlashes+i+1], "/"))) |
|
|
|
|
if err != nil || info.Mode()&os.ModeSymlink == os.ModeSymlink { |
|
|
|
|
if err != nil { |
|
|
|
|
return writeStatus(c, statusNotFound), -1 |
|
|
|
|
} else if info.Mode()&os.ModeSymlink == os.ModeSymlink { |
|
|
|
|
return writeStatus(c, statusTemporaryFailure), -1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -263,11 +265,10 @@ func handleRequest(c *tls.Conn, request *url.URL, requestData string) (int, int6
|
|
|
|
|
|
|
|
|
|
requireInput := serve.Input != "" || serve.SensitiveInput != "" |
|
|
|
|
if request.RawQuery == "" && requireInput { |
|
|
|
|
if serve.Input != "" { |
|
|
|
|
return writeHeader(c, statusInput, serve.Input), -1, "" |
|
|
|
|
} else if serve.SensitiveInput != "" { |
|
|
|
|
if serve.SensitiveInput != "" { |
|
|
|
|
return writeHeader(c, statusSensitiveInput, serve.SensitiveInput), -1, "" |
|
|
|
|
} |
|
|
|
|
return writeHeader(c, statusInput, serve.Input), -1, "" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if matchedRegexp || matchedPrefix { |
|
|
|
|