Skip to content
Myr

Quick Fix c.ClientIP() mistakely parsing to 127.0.0.1 for who not using r.Run() to run http server (#2832)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Notealot · committed by GitHub · parent 97b3c0d · Browse files · 2 files+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+6 added−2 removed

  • other:+6 added−2 removed

2 files+6 added−2 removed

modified:gin.go+2 added-2 removed
181 unmodified lines
182 MaxMultipartMemory: defaultMultipartMemory,183 trees: make(methodTrees, 0, 9),184 delims: render.Delims{Left: "{{", Right: "}}"},185 secureJSONPrefix: "while(1);",186 trustedCIDRs: []*net.IPNet{{IP: net.IP{0x0, 0x0, 0x0, 0x0}, Mask: net.IPMask{0x0, 0x0, 0x0, 0x0}}},187 }188 engine.RouterGroup.engine = engine189 engine.pool.New = func() interface{} {190 return engine.allocateContext()
73 unmodified lines
264 engine.noRoute = handlers265 engine.rebuild404Handlers()266}267267// NoMethod sets the handlers called when NoMethod.268// NoMethod sets the handlers called when Engine.HandleMethodNotAllowed = true.269func (engine *Engine) NoMethod(handlers ...HandlerFunc) {269 engine.HandleMethodNotAllowed = true270 engine.noMethod = handlers271 engine.rebuild405Handlers()272}273
354 unmodified lines
modified:middleware_test.go+4 added
116 unmodified lines
117118func TestMiddlewareNoMethodDisabled(t *testing.T) {119 signature := ""120 router := New()121122 // NoMethod disabled123 router.HandleMethodNotAllowed = false124125 router.Use(func(c *Context) {126 signature += "A"127 c.Next()128 signature += "B"
17 unmodified lines
146 })147 router.POST("/", func(c *Context) {148 signature += " XX "149 })150151 // RUN152 w := performRequest(router, "GET", "/")153154 // TEST
100 unmodified lines