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()
|
response, err := cmd.Output()
|
||||||
if ctx.Err() == context.DeadlineExceeded {
|
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"))
|
conn.Write([]byte("42 CGI process timed out!\r\n"))
|
||||||
log.Status = 42
|
log.Status = 42
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err != nil {
|
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"))
|
conn.Write([]byte("42 CGI error!\r\n"))
|
||||||
log.Status = 42
|
log.Status = 42
|
||||||
return
|
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()
|
header, _, err := bufio.NewReader(strings.NewReader(string(response))).ReadLine()
|
||||||
status, err2 := strconv.Atoi(strings.Fields(string(header))[0])
|
status, err2 := strconv.Atoi(strings.Fields(string(header))[0])
|
||||||
if err != nil || err2 != nil {
|
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"))
|
conn.Write([]byte("42 CGI error!\r\n"))
|
||||||
log.Status = 42
|
log.Status = 42
|
||||||
return
|
return
|
||||||
|
|
10
handler.go
10
handler.go
|
@ -102,10 +102,10 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
||||||
authorised = false
|
authorised = false
|
||||||
for _, clientCert := range clientCerts {
|
for _, clientCert := range clientCerts {
|
||||||
for _, allowedFingerprint := range allowedFingerprints {
|
for _, allowedFingerprint := range allowedFingerprints {
|
||||||
if getCertFingerprint(clientCert) == allowedFingerprint {
|
if getCertFingerprint(clientCert) == allowedFingerprint {
|
||||||
authorised = true
|
authorised = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ func parseMollyFiles(path string, info os.FileInfo, config *Config, errorLogEntr
|
||||||
config.DirectoryReverse = mollyFile.DirectoryReverse
|
config.DirectoryReverse = mollyFile.DirectoryReverse
|
||||||
config.DirectoryTitles = mollyFile.DirectoryTitles
|
config.DirectoryTitles = mollyFile.DirectoryTitles
|
||||||
for pathRegex, newType := range mollyFile.MimeOverrides {
|
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)
|
accessLogEntries := make(chan LogEntry, 10)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
entry := <- accessLogEntries
|
entry := <-accessLogEntries
|
||||||
writeLogEntry(accessLogFile, entry)
|
writeLogEntry(accessLogFile, entry)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
errorLogEntries := make(chan string, 10)
|
errorLogEntries := make(chan string, 10)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
message := <- errorLogEntries
|
message := <-errorLogEntries
|
||||||
errorLogFile.WriteString( time.Now().Format(time.RFC3339) + " " + message + "\n")
|
errorLogFile.WriteString(time.Now().Format(time.RFC3339) + " " + message + "\n")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue