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

feat(headers): Add Pragma header field #267

Merged
merged 1 commit into from
Jan 24, 2015
Merged

feat(headers): Add Pragma header field #267

merged 1 commit into from
Jan 24, 2015

Conversation

pyfisch
Copy link
Contributor

@pyfisch pyfisch commented Jan 22, 2015

Add the HTTP/1.0 Pragma header field used to prevent older Caches, that
do not understand the Cache-Control header field from caching the ressource.

Closes #237

fn parse_header(raw: &[Vec<u8>]) -> Option<Pragma> {
parsing::from_one_raw_str(raw).and_then(|s: String| {
let c = s.to_ascii_lowercase();
let slice = &c.clone()[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the clone here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, bug in code. I want to preserve the upper/lowercase of the value, but the matching should be case insensitive. You will see it in the fixed code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have a change, you can use git commit --amend to add code to one commit, or git rebase -i master to smash multiple commits into one.

I imagine you can just remove the .clone(), and the rest should work, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right .clone() can be simply removed. It was needed for an older version that did not convert the string to lowercase.

Add the HTTP/1.0 `Pragma` header field used to prevent older Caches, that
do not understand the `Cache-Control` header field from caching the ressource.

Closes #237
@pyfisch
Copy link
Contributor Author

pyfisch commented Jan 24, 2015

Rebased and fixed everything.

@reem
Copy link
Contributor

reem commented Jan 24, 2015

LGTM.

reem added a commit that referenced this pull request Jan 24, 2015
feat(headers): Add `Pragma` header field
@reem reem merged commit e23e2fe into hyperium:master Jan 24, 2015
@pyfisch pyfisch deleted the pragma branch February 16, 2015 18:33
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

Successfully merging this pull request may close these issues.

add Pragma header
3 participants