Skip to content

Loading isolates from localhost doesn't work with a proxy #15215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nex3 opened this issue Nov 20, 2013 · 11 comments
Closed

Loading isolates from localhost doesn't work with a proxy #15215

nex3 opened this issue Nov 20, 2013 · 11 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@nex3
Copy link
Member

nex3 commented Nov 20, 2013

For details, see issue #15161. Here's a simple script that loads an isolate from localhost:

    void main() {
      HttpServer.bind('localhost', 0).then((server) {
        server.listen((request) {
          request.response.write("fn() => print('in isolate');");
          request.response.close();
        });

        new File('/tmp/test.dart').writeAsStringSync('''
    import "http://${server.address.host}:${server.port}/file.dart";

    main() => fn();
    ''');

        Isolate.spawn(bufferedSpawn, '/tmp/test.dart');
      });
    }

    bufferedSpawn(uri) => Isolate.spawnUri(Uri.parse(uri), [], null);

@nex3
Copy link
Member Author

nex3 commented Nov 20, 2013

Marked this as blocking #15161.

@sgjesse
Copy link
Contributor

sgjesse commented Dec 18, 2013

Saving the code in spawn_uri.dart, and running with a proxy fails:

$ http_proxy=xxx dart spawn_uri.dart

Uncaught Error: IsolateSpawnException: 'SocketException: Failed host lookup: 'xxx' (OS Error: Name or service not known, errno = -2)'file:///tmp/test.dart': error: line 1 pos 5: library handler failed
...

However setting no_proxy to localhost makes it run:

$ http_proxy=xxx no_proxy=localhost dart spawn_uri.dart
in isolate

According to issue #15161 setting the no_proxy to contain localhost does not solve the problem though.

Under all circumstances we should add special handling of at least loopback addresses in dart:io, so that these addresses are not accessed through a proxy by default no matter what is in no_proxy.


Removed Priority-Unassigned, Library-Isolate, Area-Library labels.
Added Priority-Medium, Area-IO labels.

@sgjesse
Copy link
Contributor

sgjesse commented Jan 2, 2014

I have looked into how the http_proxy and no_proxy settings are handled by wget an curl. Both of these programs does not have any special handling of loopback addresses, and one needs to explicitly use no_proxy, e.g.

$ http_proxy=proxyserver:1008 no_proxy=localhost curl http://localhost:8080/index.html

Here the no_proxy setting is required to access the HTTP server running on localhost. The same is the case for wget.

This is the same for browser proxy configuration scripts, see http://findproxyforurl.com/example-pac-file/ for bypassing the proxy server for loopback connections.

Based on that I am not sure we should add special handling of loopback to the Dart HTML proxy handling.


Added Waiting label.

@nex3
Copy link
Member Author

nex3 commented Jan 6, 2014

I have no strong opinion on respecting the HTTP proxy for dart:io requests, although it's difficult for me to see the utility. For isolates, though, it's clear that using them to load Dart code from the current process is an important use case, and respecting the proxy in that case causes serious problems that are very difficult to debug. Any user with a proxy will have pub fail with a message that doesn't make it at all obvious what the problem is.

@kevmoo
Copy link
Member

kevmoo commented May 14, 2014

Removed Area-IO label.
Added Library-IO, Area-Library labels.

@nex3 nex3 added Type-Defect library-io area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels May 14, 2014
@kevmoo kevmoo removed the waiting label Feb 8, 2016
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Priority-Medium labels Mar 1, 2016
@Bikeman868
Copy link

I notice that this thread is from 2014 and I am still having this issue in 2017. Was this issue never fixed? and is there a workaround?

@kevmoo
Copy link
Member

kevmoo commented Aug 15, 2017

@Bikeman868 – another option is to use data: URIs – then you don't even need to spin up a server.

@Bikeman868
Copy link

Bikeman868 commented Aug 15, 2017

@kevmoo I have quite good knowledge of the Dart language but very little knowledge of how the Pub tool works or how to configure it. I just use pub get and pub build and that's it. I have no clue what data: URIs are and have never spun up a server.

My issue is described in dart-lang/pub#1677

@kevmoo
Copy link
Member

kevmoo commented Sep 13, 2017

Can I close this re dart-lang/pub#1677 (comment) ?

@Bikeman868
Copy link

Bikeman868 commented Sep 14, 2017 via email

@Bikeman868
Copy link

Oh, this is not the issue in your link. Yes, please close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants