]> Sergey Matveev's repositories - sgblog.git/commitdiff
More compact Base64 ETag master v0.34.0
authorSergey Matveev <stargrave@stargrave.org>
Tue, 26 Mar 2024 08:39:57 +0000 (11:39 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 26 Mar 2024 08:39:57 +0000 (11:39 +0300)
cmd/sgblog/http.go
common.go

index 2e0c2d8dea5080bcd1ecc726807106245412e8e6..000037ab210e666decf8880593d58aaab31be7af 100644 (file)
@@ -19,7 +19,7 @@ import (
        "bytes"
        "crypto/sha1"
        _ "embed"
-       "encoding/hex"
+       "encoding/base64"
        "encoding/xml"
        "errors"
        "fmt"
@@ -98,7 +98,7 @@ func makeA(href, text string) string {
 }
 
 func etagString(etag hash.Hash) string {
-       return `"` + hex.EncodeToString(etag.Sum(nil)) + `"`
+       return `"` + base64.RawURLEncoding.EncodeToString(etag.Sum(nil)) + `"`
 }
 
 func urlParse(what string) *url.URL {
index 41ba4c3e1e4a1b16d65c8addfb5ddced44f77cc7..e7ac21752d701e533c25f62ccba47e8e87fcce5f 100644 (file)
--- a/common.go
+++ b/common.go
@@ -30,7 +30,7 @@ import (
 )
 
 const (
-       Version = "0.33.0"
+       Version = "0.34.0"
        WhenFmt = "2006-01-02 15:04:05Z07:00"
 )