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

Unified Diff: runtime/bin/vmservice/server.dart

Issue 2146613002: Relax service protocol origin check to allow connections from localhost on any port (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/server.dart
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index a30b203ace0d5498099d07ae3f6df0fc659d62dd..8204cb9d0cae221e290c7f72e6ba8144710510ed 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -116,8 +116,13 @@ class Server {
}
void _addOrigin(String host, String port) {
- String origin = 'http://$host:$port';
- _allowedOrigins.add(origin);
+ if (port == null) {
+ String origin = 'http://$host';
+ _allowedOrigins.add(origin);
+ } else {
+ String origin = 'http://$host:$port';
+ _allowedOrigins.add(origin);
+ }
}
bool _isAllowedOrigin(String origin) {
@@ -216,9 +221,10 @@ class Server {
// Add the numeric ip and host name to our allowed origins.
_addOrigin(ip, port);
_addOrigin(_server.address.host.toString(), port);
- // Explicitly add localhost and 127.0.0.1.
- _addOrigin('localhost', port);
- _addOrigin('127.0.0.1', port);
+ // Explicitly add localhost and 127.0.0.1 on any port (necessary for
+ // adb port forwarding).
+ _addOrigin('127.0.0.1', null);
+ _addOrigin('localhost', null);
if (_displayMessages) {
print('Observatory listening on http://$ip:$port');
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698