Live data from Hacker News

Shortest URLs on the Internet

jameswillia.ms

31–40 of 208 posts

Re: Shortest URLs on the Internet

#31
post #11

At one point of time, ` http://to ` resolved to a "It works!" page [1]. I've always thought it would be cool to have a URL shortener with links such as ` https://to/library ` or something similar. Oh, how much fun running your own TLD would be... [1] https://web.archive.org/web/20150319211308/http://to/

I wrote myself a Chrome extension that does this, using http://l/foo style links, and using Chrome's sync to share across devices. Works well enough but limited to desktops. Some large orgs maintain internal shorteners, like http://go links at Google.

What's the name of your extension? I've been using https://www.trot.to/go-links for this and it's nice to know I could scale it out to my company if I wanted, but I'd prefer something that didn't depend on a service for my personal usage.

Re: Shortest URLs on the Internet

#32
post #18
post #12

Earlier quoted context omitted.

I'm also curious. Especially since curl 7.64.1 (Release-Date: 2019-03-27, on macOS) says: % curl 'http://1.1/' error code: 1003 while curl 7.85.0 (Release-Date: 2022-08-31, on FreeBSD) says: % curl 'http://1.1/' 301 Moved Permanently 301 Moved Permanently cloudflare

That is because their http:// site redirects to https://

Sure, but why do the two different versions of curl give different results? With 7.64.1:

  % curl --dump-header /dev/tty 'http://1.1/'
  HTTP/1.1 403 Forbidden
  Date: Sun, 11 Sep 2022 19:01:53 GMT
  Content-Type: text/plain; charset=UTF-8
  Content-Length: 16
  Connection: close
  X-Frame-Options: SAMEORIGIN
  Referrer-Policy: same-origin
  Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
  Expires: Thu, 01 Jan 1970 00:00:01 GMT
  Server: cloudflare
  CF-RAY: 7492a7924b2bd895-CPH

  error code: 1003
(Note that curl 'https://1.0.0.1/' works just fine, so it's not like curl is blocked by the server on general principle.)

With 7.85.0:

  % curl --dump-header /dev/tty 'http://1.1/'
  HTTP/1.1 301 Moved Permanently
  Server: cloudflare
  Date: Sun, 11 Sep 2022 19:03:09 GMT
  Content-Type: text/html
  Content-Length: 167
  Connection: keep-alive
  Location: https://1.0.0.1/
  CF-RAY: 7492a96a181df18a-PIT

  
  301 Moved Permanently
  
  301 Moved Permanently
  cloudflare
  
  

Re: Shortest URLs on the Internet

#33
post #12
post #8

Earlier quoted context omitted.

Why does 1.1 resolve to 1.0.0.1? I don't recall this being in any of the documents about CIDRs. Are browsers implicitly mapping IPv4 addresses temporarily into IPv6 addresses during parsing, such that "1.1" becomes "1::1", and then gets IPv6 abbreviated-form expansion applied to it?

I'm also curious. Especially since curl 7.64.1 (Release-Date: 2019-03-27, on macOS) says: % curl 'http://1.1/' error code: 1003 while curl 7.85.0 (Release-Date: 2022-08-31, on FreeBSD) says: % curl 'http://1.1/' 301 Moved Permanently 301 Moved Permanently cloudflare

Yeah, that was a bug in curl till 7.77.

If you want to full details, see [0]

[0] https://daniel.haxx.se/blog/2021/04/19/curl-those-funny-ipv4...

Re: Shortest URLs on the Internet

#34
post #12
post #8

Earlier quoted context omitted.

Why does 1.1 resolve to 1.0.0.1? I don't recall this being in any of the documents about CIDRs. Are browsers implicitly mapping IPv4 addresses temporarily into IPv6 addresses during parsing, such that "1.1" becomes "1::1", and then gets IPv6 abbreviated-form expansion applied to it?

I'm also curious. Especially since curl 7.64.1 (Release-Date: 2019-03-27, on macOS) says: % curl 'http://1.1/' error code: 1003 while curl 7.85.0 (Release-Date: 2022-08-31, on FreeBSD) says: % curl 'http://1.1/' 301 Moved Permanently 301 Moved Permanently cloudflare

Interesting. If you use curl -v, you can see that the difference is that the newer version of curl canonicalizes(?) the Host: header to "1.0.0.1", which the server recognizes and responds to with a redirect. The older version sends "1.1" as the Host: header, which the server doesn't recognize, so you get a "403 Forbidden" response with the cryptic "error code: 1003" in the body.

I get the same behavior from other nonstandard ways of specifying 1.0.0.1, like "curl http://01.00.00.01/"

Re: Shortest URLs on the Internet

#35
post #32
post #18

Earlier quoted context omitted.

That is because their http:// site redirects to https://

Sure, but why do the two different versions of curl give different results? With 7.64.1: % curl --dump-header /dev/tty 'http://1.1/' HTTP/1.1 403 Forbidden Date: Sun, 11 Sep 2022 19:01:53 GMT Content-Type: text/plain; charset=UTF-8 Content-Length: 16 Connection: close X-Frame-Options: SAMEORIGIN Referrer-Policy: same-origin Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-chec…

Curl wasn’t able to normalise ip adresses till this commit [0]

[0] https://github.com/curl/curl/commit/56a037cc0ad1b2a770d0c08d...

Re: Shortest URLs on the Internet

#36
post #8

Earlier quoted context omitted.

Why does 1.1 resolve to 1.0.0.1? I don't recall this being in any of the documents about CIDRs. Are browsers implicitly mapping IPv4 addresses temporarily into IPv6 addresses during parsing, such that "1.1" becomes "1::1", and then gets IPv6 abbreviated-form expansion applied to it?

There's some weird legacy parsing for IPv4 addresses with less than four components. 1.2.3.4 can be represented equivalently as 1.2.772, 1.131844, or 16909060. (Note that 772 = 0x0304, 131844 = 0x020304, and 16909060 = 0x01020304.) TL;DR: the second "1" in "1.1" is treated as a 24-bit integer. Longer explanation: https://blog.dave.tf/post/ip-addr-parsing/

Aha. I had thought I recalled the two-dot case being 16+16, rather than 8+24.

Re: Shortest URLs on the Internet

#38

Earlier quoted context omitted.

I suspect it gets mapped to 1.0.0.1 because no other resolution is possible. Any other locations for the two zeros results in an invalid IP (either starting or ending in 0).

Absolutely nothing wrong with ending with a .0. I suspect you are confused by n.n.n.0/24 being a network address in a /24 network which is obviously very common. However there are way more networks of other sizes that have .0 addresses in them.

I once had my ISP (BHN) assign me a public IP that ended in .0 That turned out to be a neat experiment. I regularly hit webpages and other services that would deny my connection. I guess they considered me multicast traffic or some sort of bogon.

Re: Shortest URLs on the Internet

#39

Cool to know, i guess. TIL that dotless record on newer gTLDs is forbidden, which explains my age-old question: "if google holds google., why are they only using it on domains.google? Surely having the url https://google would be desirable for the folks in marketing?". The answer is that they can't possibly because the ban was added precisely because of this.

It's not really the same, but Microsoft has https://www.microsoft/ as a redirect to their .com, which causes some weird side effects in Chrome's omnibox, because it automatically adds the www subdomain: https://imgur.com/a/2cVxnYf

Re: Shortest URLs on the Internet

#40
post #28
post #11

At one point of time, ` http://to ` resolved to a "It works!" page [1]. I've always thought it would be cool to have a URL shortener with links such as ` https://to/library ` or something similar. Oh, how much fun running your own TLD would be... [1] https://web.archive.org/web/20150319211308/http://to/

At Google and many other tech companies, internal machines are configured to have go/ work just like you describe. Looks like someone even made a whole company around it https://www.golinks.com/blog/go-links-history/

They had this at Chase when I worked there. As I recall discoverability was a problem though.
Post reply on HN