[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#703422: Use bracket notation or full URI notation when printing IPv6 addresses



Control: owner -1 !

On 19 March 2013 20:45, Ondřej Surý <ondrej@debian.org> wrote:
> Package: apt
> Version: 0.9.7.8
> Severity: wishlist
>
> Hi,
>
> I was recently helping to debug an issue with APT (which turned out to
> be just left-over IPv6 proxy configuration) and I have noticed that
> the APT output prints raw IPv6 addresses without brackets which is
> very confusing.
>
> Err http://ftp.cz.debian.org unstable Release.gpg
>   Could not connect to 2001:db8::ff00:42:8329:8049 (2001:db8::ff00:42:8329). - connect (110: Connection timed out)
>
> Would it be possible either to use bracket form, e.g.:
>
>   Could not connect to [2001:db8::ff00:42:8329]:8049 (2001:db8::ff00:42:8329). - connect (110: Connection timed out)
>

Yes.  As this usage appears to be a URI authority part (i.e.
"HOST:PORT") it should certainly use the standard URI syntax.

I see that the URI class (apt-pkg/strutl.h) is supposed to be capable
of producing the correct string, but not used here or in some other
places (HTTP Host headers <http://bugs.debian.org/620344>).  A quick
check demonstrates that at least somes parts of the URI to string
operator are not functioning properly:

 URI z;
 z.Host = "::1";

 cout << (string) z << "\n";
 =>
 ::1

which should rather produce "[::1]".  Inspecting the source indicates
that it attempts to work even for a relative reference such as above,
so this should be fixed.  The test libapt/uri_test.cc does not check
at all the string operator, hence this probably is broken for some
time.

Setting myself as owner and will send a patch in next days to fix URI
class, use it to produce correctly formatted "HOST:PORT" where
appropriate (e.g. Host headers, OPs message), and extend testing
coverage.  I have very recently studied RFCs related to URI, IPv6, and
URI usage in HTTP to address these types of issues in gnu guile.

> Or (which might be better and easier since it doesn't require any
> address-or-ipv6-address detection) use full URI as specified in the
> Acquire::http::Proxy directive, e.g.:
>
>   Could not connect to http://[2001:db8::ff00:42:8329]:8049 (2001:db8::ff00:42:8329). - connect (110: Connection timed out)

The full URI is not available at the point this error is generated.
No particular protocol has been attempted, so the current message
(without 'http://') is probably more accurate: connection to this host
on that port failed.

>
> It would really help the debugging.
>
>
> Also it might be a good idea to say something about proxy unavailable - (that's not IPv6 specific), e.g.:
>
>   Could not connect to proxy http://[2001:db8::ff00:42:8329]:8049 (2001:db8::ff00:42:8329). - connect (110: Connection timed out)

Likewise, no information about proxy is available at this point, nor
is any proxy-specific communication yet attempted.  The host and port
are enough to identify the problematic configuration (proxy or mirror)
anyway.

Regards


Reply to: