Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/route/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ func (engine *Engine) ServeHTTP(c context.Context, ctx *app.RequestContext) {
defer engine.recv(ctx)
}

rPath := string(ctx.Request.URI().Path())
rPath := bytesconv.B2s(ctx.Request.URI().Path())

// align with https://datatracker.ietf.org/doc/html/rfc2616#section-5.2
if len(ctx.Request.Host()) == 0 && ctx.Request.Header.IsHTTP11() && bytesconv.B2s(ctx.Request.Method()) != consts.MethodConnect {
Expand All @@ -767,7 +767,7 @@ func (engine *Engine) ServeHTTP(c context.Context, ctx *app.RequestContext) {
httpMethod := bytesconv.B2s(ctx.Request.Header.Method())
unescape := false
if engine.options.UseRawPath {
rPath = string(ctx.Request.URI().PathOriginal())
rPath = bytesconv.B2s(ctx.Request.URI().PathOriginal())
unescape = engine.options.UnescapePathValues
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/route/routes_timing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ func BenchmarkRouteStatic(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
r.ServeHTTP(context.Background(), ctx)
// ctx.index = -1
ctx.SetIndex(-1)
}
}

Expand All @@ -640,7 +640,7 @@ func BenchmarkRouteParam(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
r.ServeHTTP(context.Background(), ctx)
// ctx.index = -1
ctx.SetIndex(-1)
}
}

Expand All @@ -653,6 +653,6 @@ func BenchmarkRouteAny(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
r.ServeHTTP(context.Background(), ctx)
// ctx.index = -1
ctx.SetIndex(-1)
}
}