Skip to content

net/http: set LocalAddrContextKey after conn accepted #18686

@bradfitz

Description

@bradfitz

From comment on closed issue: #6732 (comment)

The http server sets LocalAddrContextKey in Serve(Listener) before any accept.

So if you pass a Listener listening on 0.0.0.0, that is what LocalAddrContextKey will say also. The current implementation considered only the case of distinguishing between multiple explicit listeners, not distinguishing the addresses arriving on a wildcard interface.

Instead, we should set the context value after an accept takes place.

/cc @SpComb

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions