kataras / iris

The fastest HTTP/2 Go Web Framework. New, modern and easy to learn. Fast development with Code you control. Unbeatable cost-performance ratio :rocket:
https://www.iris-go.com
BSD 3-Clause "New" or "Revised" License
25.27k stars 2.47k forks source link

how to disable golang.org/issue/25192 message? #1875

Open Akira0215 opened 2 years ago

Akira0215 commented 2 years ago

my url == http://127.0.0.1:8879/test?cmd=2330,0;

func main() { appIris := iris.New() appIris.Get("/test", func(ctx iris.Context) { testParam(ctx) }) appIris.Run(iris.Addr(8879) / 0./, iris.WithPostMaxMemory(maxSize)) }

func testParam(ctx iris.Context) { fmt.Println("testParam : ", ctx.Request().URL.RawQuery) }

always show message [HTTP Server] http: URL query contains semicolon, which is no longer a supported separator; parts of the query may be stripped when parsed; see golang.org/issue/25192

need to fix or disable it

thanks ~

kataras commented 2 years ago

Hello @Akira0215, that's a good one.

Based on the comments at https://github.com/golang/go/issues/25192#issuecomment-992302703 and https://github.com/golang/go/issues/25192#issuecomment-992309838, after go 1.17 (caused the issue). We have the option to use a middleware to convert the ; to & or/and ignore the http server warning log. I've just pushed a commit which can solve your(and thousands more) issue. Update your Iris version to the latest commit and follow:

replace ; with &:

app := iris.New()
app.UseRouter(iris.AllowQuerySemicolons)

or/and just ignore the standard http warning log:

app.Run(iris.Addr(":8879"), iris.WithoutServerError(iris.ErrURLQuerySemicolon))
// OR
app.Listen(":8879", iris.WithoutServerError(iris.ErrURLQuerySemicolon))

Thanks!

Akira0215 commented 2 years ago

@kataras thank you very much i will wait next version. thank you

kataras commented 2 years ago

It' already released @Akira0215, go get github.com/kataras/iris/v12@v12.2.0-beta1 or just @master. You are welcome!