Chromium Code Reviews| Index: sdk/lib/io/http_impl.dart |
| =================================================================== |
| --- sdk/lib/io/http_impl.dart (revision 17714) |
| +++ sdk/lib/io/http_impl.dart (working copy) |
| @@ -161,6 +161,8 @@ |
| // Create session, store it in connection, and return. |
| return _session = _httpServer._sessionManager.createSession(); |
| } |
| + |
| + HttpConnectionInfo get connectionInfo => _httpConnection.connectionInfo; |
| } |
| @@ -260,6 +262,8 @@ |
| return _httpRequest._httpClientConnection.detachSocket(); |
| } |
| + HttpConnectionInfo get connectionInfo => _httpRequest.connectionInfo; |
| + |
| bool get _shouldAuthenticate { |
| // Only try to authenticate if there is a challenge in the response. |
| List<String> challenge = headers[HttpHeaders.WWW_AUTHENTICATE]; |
| @@ -442,6 +446,8 @@ |
| return future; |
| } |
| + HttpConnectionInfo get connectionInfo => _httpRequest.connectionInfo; |
| + |
| void _fullBodyWritten() { |
| if (!_httpRequest._incoming.fullBodyRead) { |
| _httpRequest._httpConnection._socket.destroy(); |
| @@ -607,6 +613,8 @@ |
| _followRedirects = followRedirects; |
| } |
| + HttpConnectionInfo get connectionInfo => _httpClientConnection.connectionInfo; |
| + |
| void _onIncoming(_HttpIncoming incoming) { |
| var response = new _HttpClientResponse(incoming, |
| this, |
| @@ -919,6 +927,8 @@ |
| // TODO(ajohnsen): Remove socket from httpclient. |
| void destroy() => _socket.destroy(); |
| + |
| + HttpConnectionInfo get connectionInfo => new _HttpConnectionInfo(_socket); |
| } |
| class _ConnnectionInfo { |
| @@ -1236,6 +1246,8 @@ |
| }); |
| } |
| + HttpConnectionInfo get connectionInfo => new _HttpConnectionInfo(_socket); |
| + |
| bool get _isActive => _state == _ACTIVE; |
| bool get _isIdle => _state == _IDLE; |
| bool get _isClosing => _state == _CLOSING; |
| @@ -1411,11 +1423,26 @@ |
| class _HttpConnectionInfo implements HttpConnectionInfo { |
| + factory _HttpConnectionInfo(Socket socket) { |
|
Anders Johnsen
2013/01/29 08:25:41
Nit: As 'null' is a valid result, I think this sho
Søren Gjesse
2013/01/29 08:38:18
Done.
|
| + if (socket == null) return null; |
| + try { |
| + _HttpConnectionInfo info = new _HttpConnectionInfo._(); |
| + info.remoteHost = socket.remoteHost; |
| + info.remotePort = socket.remotePort; |
| + info.localPort = socket.port; |
| + return info; |
| + } catch (e) { } |
| + return null; |
| + } |
| + |
| + _HttpConnectionInfo._(); |
| + |
| String remoteHost; |
| int remotePort; |
| int localPort; |
| } |
| + |
| class _DetachedSocket implements Socket { |
| final Stream<List<int>> _incoming; |
| final Socket _socket; |