Feature - Implemented Localhost referrer blocked

HippoKing

Member
Referer: "http://localhost:60080/game.php"
Request from bogus referer ignored

I guess this doesn't make a lot of sense. I understand rejecting requests where the referrer isn't mafia's address, but I don't really see it rejects localhost. Obviously that could be bound to something other than the loopback, but that doesn't seem likely enough to warrant ignoring requests from there.
 

jasonharper

Developer
What exactly are you doing that's resulting in that referrer address with "localhost" instead of "127.0.0.1"? The only thing that's supposed to get through that check is the relay browser, which is explicitly opened with the numeric form of the address.
 

HippoKing

Member
I was writing something which requested HTML pages being served by mafia, which I did via localhost rather than the IP. Obviously this is easily fixed by using the IP, it just didn't make a lot of sense to me.
 

Veracity

Developer
Staff member
Some time in the future, won't this cause an IPv6 related problem?
IPv6 is, itself, inherently a problem. Would that such a kludge had never been invented and thrust onto the world as if it "solved" anything.

The URL specification says that you can specify the host as either "The internet domain name of the host in RFC1037 format" or "the IP address as a set of four decimal digits" - which is to say, an IPv4 address.

127.0.0.1 is an IPv4 address which is defined to be "localhost". I have no idea if there is an IPv6 equivalent. Even if there is, you can't use a numeric IPv6 address in a URL. But that's moot; even if some hosts eventually only have public IPv6 address, I have no reason to believe that the 127.0.0.1 -> localhost mapping will ever become unsupported, and using 127.0.0.1 will only be a "problem" if HTTP is ever revised to disallow numeric IPv4 addresses in URLs.

In other words, your fear is a red herring.
 

holatuwol

Developer
127.0.0.1 is an IPv4 address which is defined to be "localhost". I have no idea if there is an IPv6 equivalent.
::1 is what shows up in my /etc/hosts for the IPv6 localhost, but the internal relay server would have to bind to the IPv6 address for it to work (right now, it only binds to the IPv4 address).
 

heeheehee

Developer
Staff member
127.0.0.1 is an IPv4 address which is defined to be "localhost". I have no idea if there is an IPv6 equivalent.

::1, I believe.

But yeah, IPv6 was supposed to become mainstream almost 15 years ago. It's still not standard. :p

It's unlikely that IPv6 will replace IPv4 entirely any time soon, especially since NATs fulfill much of the same role that IPv6 was supposed to (i.e. increase addressing space).

edit: That's hilarious. Hola and I both quoted the same phrase with roughly the same rebuttal.
 

holatuwol

Developer
This seemed like fun to implement, so if it's a loopback address, KoLmafia will now accept it. KoLmafia will still ignore requests sent to it over IPv6 unless you customize it to do otherwise, but things like http://localhost:60080 will work just fine now.
 
Top