ServiceStack/ServiceStack — pull request #434 by mcguinness (2013-02-02 00:50:12+00:00)
Title: Fix for IPv6 UserHostAddress parsing with HttpListener AppHost on a custom port (e.g. 8080)

Looks like HttpListener AppHosts returns IPv6 addresses differently than ASP.NET. When accessing a REST path using the host name (http://test:8080/my/path) vs localhost (http://localhost:8080/my/path), parsing of UserHostAddress is blowing up.

System.ArgumentException: Could not parse Ipv6 Address: fe80::8c4f:9c97:a06b:26c6%13:8080 / fe80::8c4f:9c97:a06b:26c6%13:8080 ---> System.FormatException: An invalid IP address was specified. ---> System.Net.Sockets.SocketException: An invalid argument was supplied
--- End of inner exception stack trace ---
at System.Net.IPAddress.InternalParse(String ipString, Boolean tryParse)
at System.Net.IPAddress.Parse(String ipString)
at ServiceStack.WebHost.Endpoints.Extensions.HttpRequestExtensions.GetAttributes(IHttpRequest request)
--- End of inner exception stack trace ---
at ServiceStack.WebHost.Endpoints.Extensions.HttpRequestExtensions.GetAttributes(IHttpRequest request)
at ServiceStack.WebHost.Endpoints.RestHandler.GetResponse(IHttpRequest httpReq, IHttpResponse httpRes, Object request)
at ServiceStack.WebHost.Endpoints.RestHandler.ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, String operationName