-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(headers): add AcceptCharset header #300
Conversation
Adds support for the Accept-Charset header. Encodes the charset as a string.
Looks good to me, although I would prefer a stronger typed charset type. |
I am happy to add an enum for the charset type, but I think we would need to agree which list of charsets to include (and have the capability of specifying a string). Would the list in the "Preferred MIME Name" column of the IANA rgistry (as suggested by rfc2616) be suitable? |
I'd prefer stronger typed also, but that list is quite long. Can either keep as String for now, or try an enum with 5-10 of the most common, and then a |
Actually the list is not that long. It can be a separate crate like mime.rs |
The suggested list has 24 entries, which seems reasonable to me. @pyfisch Would you be interested in owning such a crate (seems it would go well alongside rust-language-tags)? @seanmonstar would you be OK adding such a dependency? |
24 entries is short enough to live in hyper imo, but I wouldn't mind another crate in hyperium to help split things up. |
24 can fit in hyper. I made mime a separate crate as it seemed useful for others. |
Make Charset more strongly typed.
Just noticed https://github.com/lifthrasiir/rust-encoding. |
Oh nice. That'd be rad if we could integrate that, since we already depend on encoding (via rust-url). @lifthrasiir thoughts about a type that we could use in the headers? A label? |
@seanmonstar lifthrasiir/rust-encoding#64 is probably relevant. I'm not sure whether this is truly desirable or not though. |
@lifthrasiir yep, that sounds exactly what would be best here... |
"ISO-8859-8" => Iso_8859_8, | ||
"ISO-8859-9" => Iso_8859_9, | ||
"ISO-8859-10" => Iso_8859_10, | ||
"Shift-JIS" => Shift_Jis, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be "SHIFT-JIS"
since you're using uppercase?
merged manually |
I'm pretty sure the |
@sbstp oh! i see what you mean, since |
Do you want me to PR a fix? |
Sure. Though, if the name is supposed to mixed case like that, then the fix On Tue, Mar 3, 2015, 9:15 PM Simon Bernier St-Pierre <
|
I was only going to fix the parsing part, since uppercase should handle mixed case. |
Adds support for the Accept-Charset header. Encodes the charset as a string.