Skip to content

net/http: document fields set in Request.URL in handler #3805

@gopherbot

Description

@gopherbot

by kelwert@mtu.edu:

I'm not entirely sure which of these should be missing, but, when using
http.ListenAndServe, it appears, that in the URL field, a good number of the fields are
missing that should be set.

r.URL.Opaque is empty
r.URL.User is nil, even when a username is passed, though I'm not 100% sure with this one
r.URL.Host is not set. This is really just an inconvenience. It can be hacked around
with r.URL.Host = r.Host
r.URL.Fragment is empty
r.URL.Scheme is empty.

These were tested using localhost, so I could understand if Host wasn't set (though, I
think it probably should be), but Scheme should really be set.

This is relatively simple to reproduce. Just set up a handler for http.ListenAndServe
and check what's set in r.URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions