Skip to content

Expose local_addr information from TcpStream #2767

@kubuzetto

Description

@kubuzetto

Currently, the HttpInfo expansion struct only exposes the remote_addr information from the underlying TcpStream. It would be desirable to also access the local_addr.

Since the client chooses a random* port from the ephemeral range for the local address; and the IP address might also be picked at random on devices with multiple NICs; the only reliable method of finding out the local address of an HTTP request would be to retrieve it from the TcpStream. Since hyper does not propagate the value to the response; the information is unavailable to those who need it.

Since TcpStream already contains this information, all we need to do is to add a field in the HttpInfo struct and assigning it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature. This is adding a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions