Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: runtime/bin/http_impl.dart

Issue 10803033: Add the ability to get info of a Http connection, e.g. host and port. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/bin/http.dart ('K') | « runtime/bin/http.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/http_impl.dart
diff --git a/runtime/bin/http_impl.dart b/runtime/bin/http_impl.dart
index ef590d78287710c3954d4b63c05ce7799676cc8f..417d068c7e5313321ee6db2519decb263a003688 100644
--- a/runtime/bin/http_impl.dart
+++ b/runtime/bin/http_impl.dart
@@ -707,6 +707,10 @@ class _HttpRequestResponseBase {
_bodyBytesWritten += bytes;
}
+ HttpConnectionInfo get connectionInfo() {
Bill Hesse 2012/07/19 15:05:10 Why not => notation here?
+ return _httpConnection.connectionInfo();
+ }
+
int _state;
bool _headResponse;
@@ -1241,6 +1245,18 @@ class _HttpConnectionBase implements Hashable {
return new _DetachedSocket(socket, _httpParser.unparsedData);
}
+ HttpConnectionInfo get connectionInfo() {
+ if (_socket == null || _closing || _error) return null;
+ try {
+ HttpConnectionInfo info = new _HttpConnectionInfo();
+ info.remoteHost = _socket.remoteHost;
Bill Hesse 2012/07/19 15:05:10 Why not have a constructor _HttpConnectionInfo(thi
Anders Johnsen 2012/07/19 15:12:44 _HttpConnectionInfo is a simple data container. Us
+ info.remotePort = _socket.remotePort;
+ info.localPort = _socket.port;
+ return info;
+ } catch (var e) { }
+ return null;
+ }
+
abstract void _onConnectionClosed(e);
abstract void _responseDone();
@@ -2100,6 +2116,13 @@ class _HttpClient implements HttpClient {
}
+class _HttpConnectionInfo implements HttpConnectionInfo {
+ String remoteHost;
+ String remotePort;
+ String localPort;
+}
+
+
class _DetachedSocket implements DetachedSocket {
_DetachedSocket(this._socket, this._unparsedData);
Socket get socket() => _socket;
« runtime/bin/http.dart ('K') | « runtime/bin/http.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698