parse real client IP
This commit is contained in:
@@ -665,6 +665,11 @@ func (h *httpHandler) dial(ctx context.Context, network, addr string) (conn net.
|
||||
conn, err = h.options.Router.Dial(ctxvalue.ContextWithBuffer(ctx, &buf), network, addr)
|
||||
if ro := ctx_internal.RecorderObjectFromContext(ctx); ro != nil {
|
||||
ro.Route = buf.String()
|
||||
|
||||
if conn != nil {
|
||||
ro.Src = conn.LocalAddr().String()
|
||||
ro.Dst = conn.RemoteAddr().String()
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
@@ -49,9 +49,12 @@ type metadata struct {
|
||||
|
||||
func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
|
||||
h.md.readTimeout = mdutil.GetDuration(md, "readTimeout")
|
||||
if h.md.readTimeout <= 0 {
|
||||
if h.md.readTimeout == 0 {
|
||||
h.md.readTimeout = 15 * time.Second
|
||||
}
|
||||
if h.md.readTimeout < 0 {
|
||||
h.md.readTimeout = 0
|
||||
}
|
||||
|
||||
if m := mdutil.GetStringMapString(md, "http.header", "header"); len(m) > 0 {
|
||||
hd := http.Header{}
|
||||
|
||||
Reference in New Issue
Block a user