Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

url.parse should handle protocols that separate the host from path with : #1627

Closed
isaacs opened this Issue Sep 1, 2011 · 3 comments

Comments

Projects
None yet
4 participants

isaacs commented Sep 1, 2011

Example:

// actual
> url.parse("ssh://user@foo.com:folder")
{ protocol: 'ssh:',
  slashes: true,
  auth: 'user',
  host: 'user@foo.com',
  hostname: 'foo.com',
  href: 'ssh://user@foo.com/:folder',
  pathname: '/:folder' }
// expect
> url.parse("ssh://user@foo.com:folder")
{ protocol: 'ssh:',
  slashes: true,
  auth: 'user',
  host: 'user@foo.com',
  hostname: 'foo.com',
  href: 'ssh://user@foo.com:folder',
  pathname: 'folder' }

@Darkie Darkie added a commit to Darkie/node that referenced this issue Oct 26, 2011

@Darkie Darkie Corrected issue #1627
Corrected issue #1627 by adding some string manipulation on pathname in
urlFormat(obj) which is called by urlParse(url, parseQueryString,
slashesDenoteHost).
ae6dcef

Darkie commented Oct 26, 2011

I think I've corrected this issue, I added some string manipulation to polish the pathname in case of host separated by the path with :.

rayshan commented Jul 26, 2014

This was fixed for input that has a protocol:

> url.parse('ssh://git@github.com:bower/Bower.git')
{ protocol: 'ssh:',
  slashes: true,
  auth: 'git',
  host: 'github.com',
  port: null,
  hostname: 'github.com',
  hash: null,
  search: null,
  query: null,
  pathname: '/:bower/Bower.git',
  path: '/:bower/Bower.git',
  href: 'ssh://git@github.com/:bower/Bower.git' }

However still doesn't look right when there isn't a protocol:

> url.parse('git@github.com:bower/Bower.git')
{ protocol: null,
  slashes: null,
  auth: null,
  host: null,
  port: null,
  hostname: null,
  hash: null,
  search: null,
  query: null,
  pathname: 'git@github.com:bower/Bower.git',
  path: 'git@github.com:bower/Bower.git',
  href: 'git@github.com:bower/Bower.git' }

node -v v0.10.29

@rayshan rayshan referenced this issue in bower/registry Jul 26, 2014

Closed

Normalize GitHub urls #79

The intent at present is to move towards whatwg url spec compliance, which parsing : as a folder would be in violation of. Closing as wontfix, since implementing this will move us further from that goal. If I'm mistaken in closing this, please comment and I can reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment