Run gofmt on everything for the first time ever!

This commit is contained in:
Solderpunk 2020-06-10 21:31:13 +02:00
parent 3e80488f92
commit b0b18971f4
5 changed files with 79 additions and 80 deletions

View File

@ -65,13 +65,13 @@ func handleSCGI(socket_path string, config Config, URL *url.URL, log *LogEntry,
// Send variables
vars := prepareSCGIVariables(config, URL, conn)
length := 0
for key, value := range(vars) {
for key, value := range vars {
length += len(key)
length += len(value)
length += 2
}
socket.Write([]byte(strconv.Itoa(length) + ":"))
for key, value := range(vars) {
for key, value := range vars {
socket.Write([]byte(key + "\x00"))
socket.Write([]byte(value + "\x00"))
}

View File

@ -5,6 +5,7 @@ import (
"crypto/tls"
"errors"
"fmt"
"github.com/BurntSushi/toml"
"io/ioutil"
"log"
"mime"
@ -15,7 +16,6 @@ import (
"regexp"
"strings"
"time"
"github.com/BurntSushi/toml"
)
func handleGeminiRequest(conn net.Conn, config Config, logEntries chan LogEntry) {
@ -161,7 +161,7 @@ func handleGeminiRequest(conn net.Conn, config Config, logEntries chan LogEntry)
// If this file is executable, get dynamic content
if info.Mode().Perm()&0111 == 0111 {
for _, cgiPath := range(config.CGIPaths) {
for _, cgiPath := range config.CGIPaths {
inCGIPath, err := regexp.Match(cgiPath, []byte(path))
if err == nil && inCGIPath {
handleCGI(config, path, URL, &log, conn)
@ -349,4 +349,3 @@ func serveFile(path string, log *LogEntry, conn net.Conn, config Config) {
log.Status = 20
conn.Write(contents)
}