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

Always return normalized urls in lower case #8

Closed
walro opened this issue Mar 25, 2014 · 13 comments · Fixed by #23
Closed

Always return normalized urls in lower case #8

walro opened this issue Mar 25, 2014 · 13 comments · Fixed by #23

Comments

@walro
Copy link
Contributor

walro commented Mar 25, 2014

This would avoid problems with Autoping as it currently requires at least the protocol to be in lower-case.

I can't think of any drawback of doing this, can anyone else?

@walro walro changed the title Always return normalizeds urls in lower case Always return normalized urls in lower case Mar 25, 2014
@dentarg
Copy link
Collaborator

dentarg commented Mar 25, 2014

From http://stackoverflow.com/questions/7996919/should-url-be-case-sensitive

Depends on the hosting os. Sites that are hosted on Windows tend to be case insensitive as the underlying file system is case insensitive. Sites hosted on Unix type systems tend to be case sensitive as their underlying file systems are typically case sensitive. The host name part of the URL is always case insensitive, it's the rest of the path that varies.

Another answer cites W3:

There may be URLs, or parts of URLs, where case doesn't matter, but identifying these may not be easy. Users should always consider that URLs are case-sensitive.

@walro
Copy link
Contributor Author

walro commented Mar 25, 2014

Yeah, true. How about just the protocol part? I'll change the issue title in that case.

@jage
Copy link
Contributor

jage commented Mar 25, 2014

  • Scheme name: normalize to lower case
  • The rest: Don't touch

@walro
Copy link
Contributor Author

walro commented Mar 25, 2014

Sounds good to me

@dentarg
Copy link
Collaborator

dentarg commented Mar 25, 2014

http://stackoverflow.com/questions/2148603/is-the-protocol-name-in-urls-case-sensitive

The scheme is case-insensitive: http://tools.ietf.org/html/rfc3986#section-3.1

The hostname is also case-insensitive, since it's dns.

The rest is case sensitive.

@jage
Copy link
Contributor

jage commented Mar 25, 2014

Actually, I've changed my mind.

Lower case everything, but don't use it for other than comparison. Always save the original URL (with lower case protocol), and use that when requesting or linking to the resource.

@dentarg
Copy link
Collaborator

dentarg commented Mar 25, 2014

@jage Uhm, this is a library, it doesn't save anything?

@jage
Copy link
Contributor

jage commented Mar 25, 2014

@jage Uhm, this is a library, it doesn't save anything?

Yes, I'm thinking of when you're using this library. We need to separate normalized URLs and original URLs.

@jage
Copy link
Contributor

jage commented Mar 25, 2014

So, lower case scheme and hostname. Write a test and code that makes the test pass, then we can close this issue.

@dentarg
Copy link
Collaborator

dentarg commented Mar 25, 2014

I'm thinking of when you're using this library.

Isn't that a discussion we should have in another issue? Or do you propose additional functions to this library?

@jage
Copy link
Contributor

jage commented Mar 25, 2014

Isn't that a discussion we should have in another issue?

No need for a special issue.

Since we're discussing it here I thought it would be suitable to give my thoughts about how to actually use the normalized URLs.

Or do you propose additional functions to this library?

No.

You can't reason about how this library should act unless you talk about how it should be used.

@dentarg
Copy link
Collaborator

dentarg commented Mar 25, 2014

Closing this in favor of #9, because I think that is more clear than changing the title of this issue. I like our issues short and precise.

If we want the hostname in lower case, I think we should open a new issue about that. I'm not sure we should add that functionality just because.

It's a good idea, that @jage mentioned, to be able to do comparisons, but I think we can open a new issue on this repo to discuss that.

@dentarg dentarg closed this as completed Mar 25, 2014
@dentarg
Copy link
Collaborator

dentarg commented Jul 15, 2014

Lower case everything, but don't use it for other than comparison. Always save the original URL (with lower case protocol), and use that when requesting or linking to the resource.

I agree with this. I think it's the correct behavior for this gem.

I think I had a hard time agreeing before, because we are doing it wrong in zambezi, we don't save original the URL, we save the normalized URL.

@dentarg dentarg reopened this Jul 15, 2014
jage added a commit that referenced this issue Jan 13, 2015
URLs are not case-insensitive, but since our normalized URLs are just
used internally, it's ok. The original URL should always be used when
actually requesting a resource.

Close #8
@jage jage closed this as completed in #23 Jan 13, 2015
roback pushed a commit that referenced this issue Sep 9, 2015
This is the same behavior as the .NET normalization.

Part of #12.

Related to #8, #9 (and #23).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants