Skip to content
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

ipv6 result in PUB malfunction #21698

Closed
DartBot opened this issue Nov 22, 2014 · 5 comments
Closed

ipv6 result in PUB malfunction #21698

DartBot opened this issue Nov 22, 2014 · 5 comments

Comments

@DartBot
Copy link

DartBot commented Nov 22, 2014

This issue was originally filed by Denis.S.M...@gmail.com


What steps will reproduce the problem?

  1. MacOS X by default has IPv6 enabled on all interfaces including loopback :

ifconfig

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 ::1 prefixlen 128
    inet 127.0.0.1 netmask 0xff000000
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
    nd6 options=1<PERFORMNUD>

  1. Run pub build or pub get over a project which involves transformers (i.e. chrome or polymer)

What is the expected output? What do you see instead?

PUB would fail as it'll try to request urls from first (IPv6) address via http :

FINE: Loading transformers from [chrome]
IO : Created temp directory /var/folders/s1/lsm7y1kx21j2p68bxczstm380000gp/T/pub_hWgPJS
IO : Writing 175 characters to text file /var/folders/s1/lsm7y1kx21j2p68bxczstm380000gp/T/pub_hWgPJS/runInIsolate.dart.
ERR : Invalid character (at character 8)
    | http://::1:62057/packages/barback/src/asset/asset_set.dart
    | ^
FINE: Exception type: FormatException
ERR : dart:io _HttpRequest.requestedUri
    | package:shelf/shelf_io.dart 107 _fromHttpRequest
    | package:shelf/shelf_io.dart 56 handleRequest
    | package:shelf/shelf_io.dart 46 serveRequests.<fn>.<fn>
    | dart:isolate _RawReceivePortImpl._handleMessage

What version of the product are you using?
Dart VM version: 1.7.2 (Tue Oct 14 06:58:25 2014) on "macos_x64"

On what operating system?
OS X 10.9.4

What browser (if applicable)?

Please provide any additional information below.
The issue is resolved when you manually remove IPv6 addresses from loopback interface. But it need be properly handled by PUB itself

sudo ifconfig lo0 inet6 ::1 delete

sudo ifconfig lo0 inet6 fe80::1%lo0 delete

@floitschG
Copy link
Contributor

Added Area-Pub, Triaged labels.

@nex3
Copy link
Member

nex3 commented Nov 24, 2014

From the stack trace, this looks like an error in dart:io's [_HttpRequest.requestedUri].


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

@sgjesse
Copy link
Contributor

sgjesse commented Nov 25, 2014

This is caused in the generation of requestedUrl. However this results from an "illegal" Host header being used in the request. As the request is coming from the dart:io HTTP client the root cause of the bug is there.

Proposed fix in https://codereview.chromium.org/755883007/.

We could also try to make the handling in requestedUrl more resilient, but if a Host header is set without the address in square brackets there is not deterministic way to always figure out whether the component after the last colon is the port.

The following Host header

8080::8080:8080

Could mean both of

8080:0:0:0:0:0.8080:8080 port 80
8080:0:0:0:0:0:0.8080 port 8080

Background:

According to the URI specification IPv6 addresses must be encapsulated in square brackets. So the following curl request is "correct":

  $ curl "http://[::]:8080/path"

whereas this is not:

  $ curl http://:::8080/path

Browsers does not allow the URL "http://:::8080/path" to be used for a request.

The second curl request will still cause an exception in HttpRequest.requestedUri.

8080::8080:8080


Set owner to @sgjesse.
Added Started label.

@sgjesse
Copy link
Contributor

sgjesse commented Nov 26, 2014

Fixed in 41980 (https://code.google.com/p/dart/source/detail?r=41980).


Added Fixed label.

@sgjesse
Copy link
Contributor

sgjesse commented Nov 27, 2014

Follow-up fix to test on Windows in https://code.google.com/p/dart/source/detail?r=41981.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants