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

url.parse problem with underscore in hostname #1360

Closed
galonsky opened this issue Jul 19, 2011 · 6 comments
Closed

url.parse problem with underscore in hostname #1360

galonsky opened this issue Jul 19, 2011 · 6 comments

Comments

@galonsky
Copy link

var url = require('url');
var obj = url.parse('http://bucket_name.s3.amazonaws.com/image.jpg');
console.log(obj);

on 0.4.6 (expected output):

{ protocol: 'http:',
  slashes: true,
  host: 'bucket_name.s3.amazonaws.com',
  hostname: '',
  pathname: '/image.jpg',
  href: 'http://bucket_name.s3.amazonaws.com/image.jpg' }

on 0.4.9, 0.5.0, 0.5.1:

{ protocol: 'http:',
  slashes: true,
  host: 'bucket',
  hostname: 'bucket',
  href: 'http://bucket/_name.s3.amazonaws.com/image.jpg',
  pathname: '/_name.s3.amazonaws.com/image.jpg' }
@bnoordhuis
Copy link
Member

Won't fix, sorry. Underscores are not allowed in hostnames.

@isaacs
Copy link

isaacs commented Jul 19, 2011

Hm, it seems like browsers actually allow this, and DNS lookups and everything work as expected. Also, it's a really tiny fix. Reopening.

@isaacs isaacs reopened this Jul 19, 2011
@isaacs
Copy link

isaacs commented Jul 19, 2011

@bnoordhuis Care to review? isaacs/node@dcecfc5

@bnoordhuis
Copy link
Member

@isaacs Good patch, wrong problem.

@isaacs
Copy link

isaacs commented Jul 19, 2011

@bnoordhuis Sure, but it's the problem we can actually solve. I don't know how to get the internet to stop supporting URL conventions that aren't allowed by the spec ;)

@isaacs
Copy link

isaacs commented Jul 19, 2011

For example, this site loads up fine with curl, Chrome, Safari, and node's HTTP client: http://foo_bar_blatz.izs.me/

@isaacs isaacs closed this as completed in dcecfc5 Jul 19, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants