Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

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

Closed
isaacs opened this issue Sep 1, 2011 · 3 comments
Closed
Labels

Comments

@isaacs
Copy link

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 added a commit to Darkie/node that referenced this issue Oct 26, 2011
Corrected issue nodejs#1627 by adding some string manipulation on pathname in
urlFormat(obj) which is called by urlParse(url, parseQueryString,
slashesDenoteHost).
@Darkie
Copy link

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
Copy link

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

@chrisdickinson
Copy link

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants