fix worker logging to system instead of access log + root dir fetch failing

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
master
kim (grufwub) 4 years ago
parent 3a95db82e5
commit 4fdd45855d

@ -86,7 +86,7 @@ func (fs *FileSystem) Init(size int, fileSizeMax float64) {
func (fs *FileSystem) HandleRequest(requestPath string, host *ConnHost) ([]byte, *GophorError) {
/* Stat filesystem for request file type */
fileType := FileTypeDir;
if requestPath != "." {
if requestPath != "/" {
stat, err := os.Stat(requestPath)
if err != nil {
/* Check file isn't in cache before throwing in the towel */
@ -110,8 +110,11 @@ func (fs *FileSystem) HandleRequest(requestPath string, host *ConnHost) ([]byte,
switch {
case stat.Mode() & os.ModeDir != 0:
/* do nothing, already set :) */
break
case stat.Mode() & os.ModeType == 0:
fileType = FileTypeRegular
default:
fileType = FileTypeBad
}

@ -126,7 +126,7 @@ func (worker *Worker) RespondGopher(data []byte) *GophorError {
if gophorErr != nil {
return gophorErr
}
Config.LogSystem("Served: %s\n", requestPath)
worker.Log("served: %s\n", requestPath)
/* Serve response */
return worker.SendRaw(response)

Loading…
Cancel
Save