Index: sdk/lib/io/http_impl.dart |
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart |
index ca47bd85db6a35f0d697fe7100153740040539bd..09e03c87a99b43ab9c51c62d7bf2dde746e9516c 100644 |
--- a/sdk/lib/io/http_impl.dart |
+++ b/sdk/lib/io/http_impl.dart |
@@ -90,6 +90,8 @@ class _HttpRequest extends _HttpInboundMessage implements HttpRequest { |
_HttpSession _session; |
+ Uri _requestedUri; |
+ |
_HttpRequest(_HttpResponse this.response, |
_HttpIncoming _incoming, |
_HttpServer this._httpServer, |
@@ -127,6 +129,27 @@ class _HttpRequest extends _HttpInboundMessage implements HttpRequest { |
Uri get uri => _incoming.uri; |
+ Uri get requestedUri { |
+ if (_requestedUri == null) { |
+ var proto = headers['x-forwarded-proto']; |
+ var scheme = proto != null ? proto.first : |
+ _httpConnection._socket is SecureSocket ? "https" : "http"; |
+ var host = headers['x-forwarded-host']; |
+ if (host != null) { |
+ host = host.first; |
+ } else { |
+ host = headers['host']; |
+ if (host != null) { |
+ host = host.first; |
+ } else { |
+ host = "${_httpServer.address.host}:${_httpServer.port}"; |
+ } |
+ } |
+ _requestedUri = Uri.parse("$scheme://$host$uri"); |
+ } |
+ return _requestedUri; |
+ } |
+ |
String get method => _incoming.method; |
HttpSession get session { |