Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: request.Referer() #24816

Closed
anotherGoogleFan opened this issue Apr 12, 2018 · 4 comments

Comments

Projects
None yet
6 participants
@anotherGoogleFan
Copy link

commented Apr 12, 2018

In source code, the Referer() function is like this:
func (r *Request) Referer() string { return r.Header.Get("Referer") }

But in many places, the referrer in header is Referrer, not Referer. So I guess this can be improved, for example, like this:
func (r *Request) Referer() string { if referrer := r.Header.Get("Referer"); referrer != "" { return referrer } return r.Header.Get("Referrer") }

@dominikh

This comment has been minimized.

Copy link
Member

commented Apr 12, 2018

in many places

can you point to some of these places?

@anotherGoogleFan

This comment has been minimized.

Copy link
Author

commented Apr 12, 2018

for example, in https://w3c.github.io/webappsec-referrer-policy it says:
Note: The header name does not share the HTTP Referer header’s misspelling.

and in https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-95229140, it uses "Referrer", not "Referer".

@vdobler

This comment has been minimized.

Copy link
Contributor

commented Apr 12, 2018

The first document https://w3c.github.io/webappsec-referrer-policy clearly states that the header still is called "Referer" and the new header "Referrer-Policy" does not duplicate that typo. The second document https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-95229140 is not concerned at all with HTTP headers.
Can you provide supporting evidence that the HTTP Referer header is written as "Referrer" in the wild?

@andybons andybons added this to the Unplanned milestone Apr 12, 2018

@bradfitz

This comment has been minimized.

Copy link
Member

commented Apr 13, 2018

I don't think we're going to change this, so I'm going to close this for now. We can reopen if there's evidence that this is actually common in the wild, but I've never heard of it.

@bradfitz bradfitz closed this Apr 13, 2018

@golang golang locked and limited conversation to collaborators Apr 13, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.