File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -5786,6 +5786,40 @@ func Benchmark_Ctx_IsProxyTrusted(b *testing.B) {
57865786 })
57875787 })
57885788
5789+ // Scenario with trusted proxy check simple
5790+ b .Run ("WithProxyCheckSimple" , func (b * testing.B ) {
5791+ app := New (Config {
5792+ EnableTrustedProxyCheck : true ,
5793+ })
5794+ c := app .AcquireCtx (& fasthttp.RequestCtx {})
5795+ c .Request ().SetRequestURI ("http://google.com/test" )
5796+ c .Request ().Header .Set (HeaderXForwardedHost , "google1.com" )
5797+ b .ReportAllocs ()
5798+ b .ResetTimer ()
5799+ for n := 0 ; n < b .N ; n ++ {
5800+ c .IsProxyTrusted ()
5801+ }
5802+ app .ReleaseCtx (c )
5803+ })
5804+
5805+ // Scenario with trusted proxy check simple in parallel
5806+ b .Run ("WithProxyCheckSimpleParallel" , func (b * testing.B ) {
5807+ app := New (Config {
5808+ EnableTrustedProxyCheck : true ,
5809+ })
5810+ b .ReportAllocs ()
5811+ b .ResetTimer ()
5812+ b .RunParallel (func (pb * testing.PB ) {
5813+ c := app .AcquireCtx (& fasthttp.RequestCtx {})
5814+ c .Request ().SetRequestURI ("http://google.com/" )
5815+ c .Request ().Header .Set (HeaderXForwardedHost , "google1.com" )
5816+ for pb .Next () {
5817+ c .IsProxyTrusted ()
5818+ }
5819+ app .ReleaseCtx (c )
5820+ })
5821+ })
5822+
57895823 // Scenario with trusted proxy check
57905824 b .Run ("WithProxyCheck" , func (b * testing.B ) {
57915825 app := New (Config {
You can’t perform that action at this time.
0 commit comments