mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-30 03:02:25 -05:00
[chore] Update gin to v1.9.0 (#1553)
This commit is contained in:
parent
689a10fe17
commit
ecdc8379fa
347 changed files with 166814 additions and 3671 deletions
9
vendor/github.com/gin-gonic/gin/gin.go
generated
vendored
9
vendor/github.com/gin-gonic/gin/gin.go
generated
vendored
|
|
@ -11,6 +11,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
|
|
@ -40,6 +41,9 @@ var defaultTrustedCIDRs = []*net.IPNet{
|
|||
},
|
||||
}
|
||||
|
||||
var regSafePrefix = regexp.MustCompile("[^a-zA-Z0-9/-]+")
|
||||
var regRemoveRepeatedChar = regexp.MustCompile("/{2,}")
|
||||
|
||||
// HandlerFunc defines the handler used by gin middleware as return value.
|
||||
type HandlerFunc func(*Context)
|
||||
|
||||
|
|
@ -166,7 +170,7 @@ type Engine struct {
|
|||
trustedCIDRs []*net.IPNet
|
||||
}
|
||||
|
||||
var _ IRouter = &Engine{}
|
||||
var _ IRouter = (*Engine)(nil)
|
||||
|
||||
// New returns a new blank Engine instance without any middleware attached.
|
||||
// By default, the configuration is:
|
||||
|
|
@ -668,6 +672,9 @@ func redirectTrailingSlash(c *Context) {
|
|||
req := c.Request
|
||||
p := req.URL.Path
|
||||
if prefix := path.Clean(c.Request.Header.Get("X-Forwarded-Prefix")); prefix != "." {
|
||||
prefix = regSafePrefix.ReplaceAllString(prefix, "")
|
||||
prefix = regRemoveRepeatedChar.ReplaceAllString(prefix, "/")
|
||||
|
||||
p = prefix + "/" + req.URL.Path
|
||||
}
|
||||
req.URL.Path = p + "/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue