]> Sergey Matveev's repositories - godlighty.git/blobdiff - handler.go
Missing copying
[godlighty.git] / handler.go
index 76859813b79349fa1ad6e09f0807f11a14c2df64..d7037b43f109f008dfda8e1deddc0750f785cb7f 100644 (file)
@@ -1,6 +1,6 @@
 /*
 godlighty -- highly-customizable HTTP, HTTP/2, HTTPS server
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2021-2022 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import (
        "encoding/base64"
        "errors"
        "fmt"
-       "io/ioutil"
+       "io"
        "log"
        "net"
        "net/http"
@@ -47,12 +47,12 @@ const (
 
 var (
        gzPool = sync.Pool{
-               New: func() interface{} { return gzip.NewWriter(ioutil.Discard) },
+               New: func() interface{} { return gzip.NewWriter(io.Discard) },
        }
        zstdPool = sync.Pool{
                New: func() interface{} {
                        w, err := zstd.NewWriter(
-                               ioutil.Discard,
+                               io.Discard,
                                zstd.WithEncoderLevel(zstd.SpeedDefault),
                        )
                        if err != nil {
@@ -200,7 +200,7 @@ IndexLookup:
                        }
                        var readme []byte
                        for _, f := range append(cfg.Readmes, Readme) {
-                               readme, _ = ioutil.ReadFile(path.Join(pth, f))
+                               readme, _ = os.ReadFile(path.Join(pth, f))
                                if readme != nil {
                                        break
                                }
@@ -213,7 +213,7 @@ IndexLookup:
                        }
                        contentType = "text/html; charset=utf-8"
                } else {
-                       for _, index := range append(cfg.Indexes, Index) {
+                       for _, index := range append(cfg.Indices, Index) {
                                p := path.Join(pth, index)
                                if _, err := os.Stat(p); err == nil {
                                        pth = p
@@ -245,7 +245,7 @@ IndexLookup:
                if meta4fi.Size() > meta4.MaxSize {
                        goto SkipMeta4
                }
-               meta4Raw, err := ioutil.ReadFile(pth + meta4.Ext)
+               meta4Raw, err := os.ReadFile(pth + meta4.Ext)
                if err != nil {
                        goto SkipMeta4
                }