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

Capitalize "X-Xss-Protection:" -> "X-XSS-Protection:" #15

Open
jf opened this issue Jun 18, 2015 · 5 comments
Open

Capitalize "X-Xss-Protection:" -> "X-XSS-Protection:" #15

jf opened this issue Jun 18, 2015 · 5 comments

Comments

@jf
Copy link

jf commented Jun 18, 2015

I'm not so sure about the support for the current capitalization now (X-Xss-Protection) in the various browsers; I think it shouldnt be a problem if we trust them to follow the HTTP spec properly (HTTP Header names are case-insensitive)... but it'd still be nice to capitalize it properly to X-XSS-Protection:

  1. XSS is an acronym
  2. the README uses X-XSS-Protection as well
@unrolled
Copy link
Contributor

Hey! I think I might be missing something here... I just checked the code and it is properly cased: https://github.com/martini-contrib/secure/blob/master/secure.go#L41 Are you seeing this in the code or the output?

@jf
Copy link
Author

jf commented Jun 19, 2015

Thanks, Cory. I'm seeing this in the output. There is no middleware before this, and I am updated to the latest commit (de8e19a)

@unrolled
Copy link
Contributor

Alright, I dug into this a bit more and heres what I found out. Go canonicalizes the header keys automatically for us (whether we like it or not): https://golang.org/src/net/http/header.go#L166

// CanonicalHeaderKey returns the canonical format of the
// header key s.  The canonicalization converts the first
// letter and any letter following a hyphen to upper case;
// the rest are converted to lowercase.  For example, the
// canonical key for "accept-encoding" is "Accept-Encoding".

@jf
Copy link
Author

jf commented Jun 24, 2015

Thanks, Cory! Appreciate you digging into this for me. So what's your verdict on this?

@unrolled
Copy link
Contributor

I don't think we can do anything about this. As long as we use Go's Header().Add() function, it'll change our header keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants