garbados / dat-gateway

In-memory Dat to HTTP gateway
https://dat.bovid.space/
61 stars 13 forks source link

Change loopback hostname to dat.locahost #15

Closed da2x closed 5 years ago

da2x commented 5 years ago

Resolves issue #12.

da2x commented 5 years ago

Redirection from gateway/key/ => key.gateway/ is missing.

da2x commented 5 years ago

Does the .localhost thing work everywhere? I found it was kind of hit or miss on Windows.

Neither libc nor win32 resolves these by default, no. However, web browsers and higher level libraries usually do resolve them. I believe mDNSResponder (a.k.a. Android, iOS, and macOS) supports resolves them. Firefox and Chromium definitely handles it. The DNS stub servers in some home routers will also respond with 127.0.0.1 for anything ending in .localhost. So, smaybe.

However, this isn’t a new requirement as the existing solution already relied upon it.

RFC 6761 §6.3 allows for its use here, though this change cleans it up a bit by moving everything under dat.localhost to reduce collisions with other applications. The IPFS gateway uses the same convention.

(@RangerMauve I’m ctOS on IRC, by the by.)

da2x commented 5 years ago

All the tests passes now. It should be ready to integrate.

However, the test run seems to not exit when running on Travis. This works fine when running locally, and I’m frankly at a loss as to what would cause it to hang after having completed all the tests. Any ideas?

RangerMauve commented 5 years ago

I think we had test issues before. Not sure if @garbados found a workaround.

garbados commented 5 years ago

I've found some time to check this out. Thanks for the contribution @da2x :D

garbados commented 5 years ago

I've made a branch off this PR that merges with master and adjusts the new nock harness to handle the new test suites. All tests pass in 25s locally, fwiw. This PR looks great and I really appreciate all it accomplishes. I'll get it merged very soon :+1: