]> Sergey Matveev's repositories - sgblog.git/commitdiff
More reliable and simpler PATH_INFO parse
authorSergey Matveev <stargrave@stargrave.org>
Thu, 7 Oct 2021 11:08:40 +0000 (14:08 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 7 Oct 2021 11:08:40 +0000 (14:08 +0300)
cmd/sgblog/http.go

index f81e38eb4075302fcf730473c9a0389a46e7f179..9f39171c4c962943afff958ccb486b8d54ba6999 100644 (file)
@@ -171,8 +171,8 @@ func serveHTTP() {
                log.Fatalln(err)
        }
 
-       pathInfo, exists := os.LookupEnv("PATH_INFO")
-       if !exists {
+       pathInfo := os.Getenv("PATH_INFO")
+       if len(pathInfo) == 0 {
                pathInfo = "/"
        }
        queryValues, err := url.ParseQuery(os.Getenv("QUERY_STRING"))