-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
add etag header #180
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
add etag header #180
Conversation
Thanks for getting this started! Would you be able to fill in the missing parts from the spec? You can find a link to it in the issue you referenced. Specifically, the weak indicator needs to be stores on the struct, and the value must be inside quotation marks. |
Hooray, this will make rebasing servo/servo#4117 easier :D |
Build is failing, but apparently due to files not touched by this commit :/ |
use header::Header; | ||
|
||
#[test] | ||
fn test_etag() { |
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.
Can we split this up into smaller tests?
Don't worry if the tests fail for another reason. That's pretty normal with rustc changing a little every day. |
// 2. in the range %x23 to %x7E, or | ||
// 3. in the range %x80 to %xFF | ||
fn check_slice_validity(slice: &str) -> bool { | ||
for c in slice.bytes() { |
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.
I'd use a match statement here:
match c {
b'\x21' | b'\x23' ... b'\x7e' | b'\x80' ... b'\xff' => (),
_ => return false
}
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.
done
Excellent! This is looking really close. Also, could you remove the |
@@ -93,6 +93,9 @@ pub mod content_type; | |||
/// Exposes the Date header. | |||
pub mod date; | |||
|
|||
/// Exposes the Etag header. | |||
pub mod etag; |
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.
Could you also add a pub use self::etag::Etag
up top?
One last nit, and I think this is good to go. Also, could you squash this into a single commit? I was trying to decide if it'd be better to have this as an |
Squashed. Also, how do I test for tags containing chars in the |
Seems odd. You can do |
Thanks for wrapping this up! Looks great. |
Welcome, and thanks for the mentoring :) |
fixes #170