You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If i understand correctly fiberCtx.SetReadDeadline actually doesn't work and probably will not. Also if at same time we will add ability to get client IP address from huma.Context it will not work with current fiber adapter implementation.
Currently fiberAdapter.ServeHTTP calls App.Test to handle requests. This method uses testConn to mock incoming connection.
But testConn.Set*Deadline methods do nothing (source):
Closure returned by adaptor.handlerFunc serves as fiberAdapter.ServeHTTP, it declares fctx variable and initialize it by calling RequestCtx.Init method.
fakeAddrer doesn't have it's own SetReadDeadline implementation so it calls SetReadDeadline method of it's underlying net.Conn (nil), because of that c.orig.Context().Conn().SetReadDeadline(deadline) in fiberCtx.SetReadDeadline panics.
IMHO: We can simply return nil from fiberCtx.SetReadDeadline without doing anything because it will not work anyway.
The text was updated successfully, but these errors were encountered:
If i understand correctly
fiberCtx.SetReadDeadline
actually doesn't work and probably will not. Also if at same time we will add ability to get client IP address fromhuma.Context
it will not work with current fiber adapter implementation.Currently
fiberAdapter.ServeHTTP
callsApp.Test
to handle requests. This method usestestConn
to mock incoming connection.But
testConn.Set*Deadline
methods do nothing (source):And
testConn.*Addr
methods return hardcoded values (source):About using adaptor middleware
Closure returned by
adaptor.handlerFunc
serves asfiberAdapter.ServeHTTP
, it declares fctx variable and initialize it by callingRequestCtx.Init
method.RequestCtx.Init
method callsRequestCtx.Init2
passing fakeAddrer struct asnet.Conn
value without setting underlyingnet.Conn
to anythingRequestCtx.Init2
setsc
field to providednet.Conn
valueRequestCtx.Conn
returns it'sc
property value (fakeAddrer
with underlyingnet.Conn
set to nil)fakeAddrer doesn't have it's own
SetReadDeadline
implementation so it callsSetReadDeadline
method of it's underlyingnet.Conn
(nil
), because of thatc.orig.Context().Conn().SetReadDeadline(deadline)
infiberCtx.SetReadDeadline
panics.IMHO: We can simply return
nil
fromfiberCtx.SetReadDeadline
without doing anything because it will not work anyway.The text was updated successfully, but these errors were encountered: