Fix localhost IP on Mac OS #1

Closed
cespare opened this Issue Dec 15, 2012 · 2 comments

Comments

Projects
None yet
1 participant
Owner

cespare commented Dec 15, 2012

Looks like it's getting ipv6 or something?

[::1] - - [15/Dec/2012 01:39:47] "GET / HTTP/1.1" 200 20426 0.0072

Check that out and make sure that's what we actually want to display.

Owner

cespare commented Feb 26, 2013

Not mac-specific. If I make a hello world server and then do curl ::1:8899/asdf, I get this as well.

Owner

cespare commented Feb 26, 2013

OK, so RemoteAddr of http.Request isn't actually a standard format. The strings look like this (using a Go net/http server):

IPv4: 127.0.0.1:36341
IPv6: [::1]:44092

So I think I'll just make a fancier IP stripping function that will try to remove [], if they exist.

cespare closed this in b0b32c6 Feb 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment