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

Fix. Make sure that scheme part of the URI is treated in a case-insensit... #2505

Closed
wants to merge 1 commit into from

Conversation

kwilczynski
Copy link
Contributor

...ive manner.

This is as per http://en.wikipedia.org/wiki/URI_scheme, and solves some
edges i.e., following (30x) URL from the "Location" header where we
have to deal with "HTTP://".

Signed-off-by: Krzysztof Wilczynski krzysztof.wilczynski@linux.com

@kwilczynski
Copy link
Contributor Author

Fixes #2500.

@kwilczynski
Copy link
Contributor Author

Paging @sersut @stevendanna @lamont-granquist .

# As per: https://github.com/opscode/chef/issues/2500
it 'should treat scheme part of the URI in a case-insensitive manner' do
http = Chef::HTTP.allocate # Calling Chef::HTTP::new sets @url, don't want that.
expect do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can split this nested expect into two distinct cases, if needed.

@kwilczynski
Copy link
Contributor Author

Note:
We are not going to change the URL parsing in lib/chef/provider/remote_file/fetcher.rb as canonical form is always lower-case preferred, so we shell keep warning users about that.

@jonlives
Copy link
Contributor

This looks good to me - http://tools.ietf.org/html/rfc3986#section-3.1 states that the scheme should be case insensitive, and we should support that. What say you, @jaymzh? Majority maintainer approval needed!

👍 from me.

@kwilczynski
Copy link
Contributor Author

@jonlives what's your take on fixing the first case in #2500? Should we make it case insensitive too?

…sitive manner.

This is as per http://en.wikipedia.org/wiki/URI_scheme, and solves some
edges i.e., following (30x) URL from the "Location" header where we
have to deal with "HTTP://".

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
@jonlives
Copy link
Contributor

To my way of thinking I'd say that we should support case insensitive schemes in both cases per the RFC - if there are stylistic reasons for not doing this I'll defer to @sersut et. al.

@lamont-granquist
Copy link
Contributor

fix looks obviously correct and has tests... 👍

FWIW, my guess is there's a bunch of similar mistakes scattered around the codebase.

@kwilczynski
Copy link
Contributor Author

@jonlives @lamont-granquist let me fix lib/chef/provider/remote_file/fetcher.rb too, then.

@jaymzh
Copy link
Collaborator

jaymzh commented Nov 29, 2014

Always side with the RFC. :)

👍 for this.

@kwilczynski
Copy link
Contributor Author

So @jonlives @lamont-granquist @jaymzh , there is nothing else to fix (i.e., calls to uri.scheme, etc.), as with Chef 12 (client) we moved to Ruby 2.1.x which has the benefit of a change made to URI:

If we have not back port to Chef 11 (client), the simpler way to go about would be to add small monkey-patch fixing URI as per the change from the change in Ruby.

Other than that, this is good to go, I believe.

@lamont-granquist
Copy link
Contributor

wouldn't worry about Chef-11 backport, this is not a critical bugfix

@jonlives
Copy link
Contributor

jonlives commented Dec 2, 2014

@tyler-ball you ok with this? If so, will merge it.

@tyler-ball
Copy link
Contributor

:shipit:

@lamont-granquist
Copy link
Contributor

@jonlives you know about updating the md files?

@jonlives
Copy link
Contributor

jonlives commented Dec 2, 2014

@lamont-granquist que?

@lamont-granquist
Copy link
Contributor

The process for Merges... more than just clicking the button... gotta add the CHANGELOG.md and possibly RELEASE_NOTES.md and DOC_UPDATES.md files. and i also rebase all the commits -- that keeps the history clean and also gets it branched off current master and then the travis tests will run again and you can see if someone broke the PR via commits to master (spec test conflicts rather than git merge conflicts).

@jonlives
Copy link
Contributor

jonlives commented Dec 2, 2014

Gotcha - will get to that later this week most likely.

@lamont-granquist
Copy link
Contributor

so usually what i do is create a branch like lcg/2505 to the pr/2505 head and rebase there against origin/master and then add md files and push the new branch. https://help.github.com/articles/checking-out-pull-requests-locally/ really helps.

jonlives added a commit that referenced this pull request Dec 29, 2014
Merge pull request #2505 from kwilczynski/http-create-url
@jonlives
Copy link
Contributor

Merged via #2708

@jonlives jonlives closed this Dec 29, 2014
@jonlives jonlives deleted the kwilczynski/http-create-url branch December 29, 2014 13:56
@kwilczynski kwilczynski removed their assignment Jan 22, 2015
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants