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

Remove ":" in Url.protocol? #8406

Closed
maxis1718 opened this issue Sep 5, 2016 · 2 comments
Closed

Remove ":" in Url.protocol? #8406

maxis1718 opened this issue Sep 5, 2016 · 2 comments
Labels
url Issues and PRs related to the legacy built-in url module.

Comments

@maxis1718
Copy link

Question: The protocol of an url http://a.b.c should be http or http:?

Observation: Given an url http://a.b.c, the following table shows the different parsing results of protocol among Node, Python and Java:

Node Python Java
http: http http

Note:

Current parsing logic: https://github.com/nodejs/node/blob/master/lib/url.js#L39

An example:

import URL from 'url';
let parsedUrl = URL.parse('http://a.b.c')

Url {
  protocol: 'http:',
  ...
}
@Trott
Copy link
Member

Trott commented Sep 5, 2016

Including the : complies with the WHATWG URL Standard:

The protocol attribute’s getter must return context object url’s scheme, followed by ":".

/cc @jasnell

@maxis1718 You may also be interested in the currently-being-worked-on URL parser that is intended to be fully WHATWG URL compliant. (The current one pre-dates the spec and is not fully compliant.)

@targos targos added the url Issues and PRs related to the legacy built-in url module. label Sep 5, 2016
@maxis1718
Copy link
Author

@Trott, cool! then I should create an issue for python 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
url Issues and PRs related to the legacy built-in url module.
Projects
None yet
Development

No branches or pull requests

3 participants