From: Sergey Matveev Date: Thu, 7 Oct 2021 11:08:40 +0000 (+0300) Subject: More reliable and simpler PATH_INFO parse X-Git-Tag: v0.24.0~1 X-Git-Url: http://www.git.stargrave.org/?p=sgblog.git;a=commitdiff_plain;h=734114ee4d7cf81c6b2501fa3a1b62b0fecbef0d More reliable and simpler PATH_INFO parse --- diff --git a/cmd/sgblog/http.go b/cmd/sgblog/http.go index f81e38e..9f39171 100644 --- a/cmd/sgblog/http.go +++ b/cmd/sgblog/http.go @@ -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"))