gofmt fixes.
This commit is contained in:
parent
44af303de6
commit
990b7071d0
3 changed files with 11 additions and 11 deletions
|
@ -29,13 +29,13 @@ func handleCGI(config Config, path string, URL *url.URL, log *LogEntry, errorLog
|
|||
}
|
||||
response, err := cmd.Output()
|
||||
if ctx.Err() == context.DeadlineExceeded {
|
||||
errorLog <- "Terminating CGI process " + path + " due to exceeding 10 second runtime limit."
|
||||
errorLog <- "Terminating CGI process " + path + " due to exceeding 10 second runtime limit."
|
||||
conn.Write([]byte("42 CGI process timed out!\r\n"))
|
||||
log.Status = 42
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
errorLog <- "Error starting CGI executable " + path + ": " + err.Error()
|
||||
errorLog <- "Error starting CGI executable " + path + ": " + err.Error()
|
||||
conn.Write([]byte("42 CGI error!\r\n"))
|
||||
log.Status = 42
|
||||
return
|
||||
|
@ -44,7 +44,7 @@ func handleCGI(config Config, path string, URL *url.URL, log *LogEntry, errorLog
|
|||
header, _, err := bufio.NewReader(strings.NewReader(string(response))).ReadLine()
|
||||
status, err2 := strconv.Atoi(strings.Fields(string(header))[0])
|
||||
if err != nil || err2 != nil {
|
||||
errorLog <- "Unable to parse first line of output from CGI process " + path + " as valid Gemini response header."
|
||||
errorLog <- "Unable to parse first line of output from CGI process " + path + " as valid Gemini response header."
|
||||
conn.Write([]byte("42 CGI error!\r\n"))
|
||||
log.Status = 42
|
||||
return
|
||||
|
|
10
handler.go
10
handler.go
|
@ -102,10 +102,10 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
|||
authorised = false
|
||||
for _, clientCert := range clientCerts {
|
||||
for _, allowedFingerprint := range allowedFingerprints {
|
||||
if getCertFingerprint(clientCert) == allowedFingerprint {
|
||||
authorised = true
|
||||
break
|
||||
}
|
||||
if getCertFingerprint(clientCert) == allowedFingerprint {
|
||||
authorised = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ func parseMollyFiles(path string, info os.FileInfo, config *Config, errorLogEntr
|
|||
config.DirectoryReverse = mollyFile.DirectoryReverse
|
||||
config.DirectoryTitles = mollyFile.DirectoryTitles
|
||||
for pathRegex, newType := range mollyFile.MimeOverrides {
|
||||
config.MimeOverrides[pathRegex] = newType
|
||||
config.MimeOverrides[pathRegex] = newType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
6
main.go
6
main.go
|
@ -60,15 +60,15 @@ func main() {
|
|||
accessLogEntries := make(chan LogEntry, 10)
|
||||
go func() {
|
||||
for {
|
||||
entry := <- accessLogEntries
|
||||
entry := <-accessLogEntries
|
||||
writeLogEntry(accessLogFile, entry)
|
||||
}
|
||||
}()
|
||||
errorLogEntries := make(chan string, 10)
|
||||
go func() {
|
||||
for {
|
||||
message := <- errorLogEntries
|
||||
errorLogFile.WriteString( time.Now().Format(time.RFC3339) + " " + message + "\n")
|
||||
message := <-errorLogEntries
|
||||
errorLogFile.WriteString(time.Now().Format(time.RFC3339) + " " + message + "\n")
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in a new issue