[Mono-dev] Bug in System.UriBuilder and System.Net.WebRequest and probably related classes (doesn't handle zone id)

Sebastian Dröge slomo at circular-chaos.org
Sat Mar 22 12:22:03 EDT 2008


Hi,
it seems that System.UriBuilder and System.Net.WebRequest (and probably
related classes) don't handle the zone id in URIs with IPv6 address
correctly.

See https://bugzilla.novell.com/show_bug.cgi?id=372840

An example URI would be http://fe80::1234%1/blabla or even more
confusing http://fe80::1234%1:80/blabla. See RFC4007 section 11.2.


The problem with System.UriBuilder is now, that if one passes
"fe80::1234%1" as host it will escape the % with %25 which will then be
a completely invalid URL. It should instead keep the host part as is (is
there any escaping for the host part required at all in any case?).

The second issue is, that System.Net.WebRequest.Create() with such an
URI simply won't work. When calling GetResponse() on it the following
happens:

System.Net.WebException: Error: ConnectFailure
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
[0x00000] 
  at System.Net.HttpWebRequest.GetResponse () [0x00000] 


System.Net.WebRequest (or whatever is responsible for this some level
below) should instead parse the host part of the URI and put the zone id
(if it's numeric, otherwise see below) into the sin6_scope_id field of
struct sockaddr_in6 (at least that's how it would be done in C).

System.Net.Sockets.Socket can set the ScopeId already.

Now, if the zone id is _not_ numeric (it could be "eth0" on Linux for
example) one has to ask the OS which interface id is corresponding to
the zone id.

As already this basic classes don't support it correctly I expect the
same problem at different places too.

It would be nice if this could be fixed for mono 2.0 already as it
currently breaks banshee's DAAP sharing (the client side) when one has a
link-local IPv6 address.

Thanks

PS: I'm not subscribed to the list so please CC me :)

Novell Bug: https://bugzilla.novell.com/show_bug.cgi?id=372840
Banshee bug: http://bugzilla.gnome.org/show_bug.cgi?id=523618
RFC4007: http://tools.ietf.org/html/rfc4007
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080322/11725837/attachment.bin 


More information about the Mono-devel-list mailing list