<html>
    <head />
        <body>
            Hi David -<br /><br />The old IPv6 code. Sigh. Unfortunately, this code was written with the idea of being a complete rewrite and not an add-on to the existing library but it's now used as an add-on and this causes all sorts of problems, including major compatibility issues.<br /><br />I really do think that code needs serious overhaul. It basically needs to be rewritten such that:<br />a) The external interface remains simply a byte array (be that an IPv4 style 4-element byte array or some sort of SocketAddress which really *is* a socket address and not some plugin-internal structure combining address, port, family, and the phase of the moon)<br />b) SocketAddress[Info] is used privately within the socket and never exposed to a client unless that client specifically asks for it (but definitely not via stuff like Socket&gt;&gt;[local|remote]Address)<br />c) NetNameResolver needs to return IPv4 addresses by default and only answer IPv6 if the client specifically requests it.<br /><br />Without this you're basically playing whack-a-mole trying to catch bugs that pop up randomly. A straightforward user like WebClient should be able to use Sockets without any change, defaulting to IPv4, and only when it specifically requests IPv6 support should it be exposed to IPv6. Otherwise this will be a complete nightmare.<br /><br />Cheers,<br />&nbsp; - Andreas<br /><br /><blockquote type="cite">
            <p>-------- Original-Nachricht --------<br />Datum: Sun, 15 Jul 2012 14:53:59 -0400<br />Von: &quot;David T. Lewis&quot; &lt;lewis@mail.msen.com&gt;<br />An: Andreas Raab &lt;Andreas.Raab@gmx.de&gt;<br />CC: squeak-dev@lists.squeakfoundation.org<br />Betreff: Re: [squeak-dev] WebClient test fails in trunk<br /><br /></p>
            Hi Andreas,<br /><br />The changes should hopefully work with any image regardless of whether<br />the new socket code is present, and regardless of what flavor of VM and<br />SocketPlugin are running.<br /><br />There should be no compatibity issues either for IPv4 or IPv6. The only<br />problem was that if the four-byte socket address is being represented by<br />a SocketAddress (subclass of ByteArray) rather than a ByteArray, then<br />converting it to a host name string with this does not work:<br /><br />  String streamContents:[:s| anAddress<br />    do:[:b| s print: b] separatedBy:[s nextPut: $.]]<br /><br />Aside from that, no real issues as far as I know (other than the trivial<br />undeclared CrLf issue).<br /><br />A SocketAddress is a kind of ByteArray, but it represents an opaque <br />reference to a data structure managed in the plugin. That data structure<br />does include the four-byte network address (for IPv4) but this should<br />not be directly referenced from the image.<br /><br />For example, on my PC with a 64 bit VM, the local address 127.0.0.2<br />is represented by a SocketAddress that, if printed out byte-by-byte,<br />would look like this:<br /><br /> '117.49.82.81.16.0.0.0.2.0.0.0.127.0.0.2.0.0.0.0.0.0.0.0'<br /><br />This is an 8 byte pointer, followed by the 32 bit network address, followed<br />by some other stuff I don't remember. But the printString for this object<br />provides a more useful representation:<br /><br /> '127.0.0.2(linux-jh8m),0(0)'<br /><br />Thus for a network address represented in the traditional way, printing<br />it out as bytes separated by $. does the right thing, and for the same<br />address represented by a SocketAddress, the first portion of the printString<br />up to $( is suitable. I did not check to see if this works with an IPv6<br />address, but it's good enough to cover the cases in the WebClient tests. <br /><br />I am guessing that for logging purposes, you would want to use the complete<br />SocketAddress&gt;&gt;printString '127.0.0.2(linux-jh8m),0(0)' while for converting<br />a socket address to a host string you would want only the address portion<br />'127.0.0.2', so I put two separate methods in WebUtils for those two cases. <br /><br />Dave<br /><br />On Sun, Jul 15, 2012 at 06:48:15PM +0200, Andreas Raab wrote:<br />&gt; Hi David -<br />&gt;  <br />&gt;  Are these patches needed only for IPv6 or also to support IPv4? If the  <br />&gt; latter, this would bother me greatly. I can understand why IPv6 may be  <br />&gt; implemented in incompatible ways but I can't see why there should be an  <br />&gt; incompatible interface to IPv4 addresses which have been used for  eternity <br />&gt; in Squeak. In particular given that (I believe) SocketAddress is a subclass <br />&gt; of ByteArray it strikes me as not particularly hard to have Sockets support <br />&gt; ByteArrays of length 4 as IPv4 socket addresses (and perhaps return <br />&gt; instances of SocketAddress with length 4 or so). In any case, I'm not <br />&gt; looking forward to seeing every last bit of networking code break - there <br />&gt; has to be a better way...<br />&gt; <br />&gt;  Cheers,<br />&gt;  ?? - Andreas<br />&gt; <br />&gt;  <br />&gt; &gt;             <br />&gt; &gt; -------- Original-Nachricht --------<br />&gt; &gt; Datum: Sun, 15 Jul 2012 11:46:54 -0400<br />&gt; &gt; Von: &quot;David T. Lewis&quot; &lt;lewis@mail.msen.com&gt;<br />&gt; &gt; An: The general-purpose Squeak developers list <br />&gt; &gt; &lt;squeak-dev@lists.squeakfoundation.org&gt;, andreas.raab@gmx.de<br />&gt; &gt; Betreff: Re: [squeak-dev] WebClient test fails in trunk<br />&gt; &gt; <br />&gt; &gt;             On Wed, Jul 04, 2012 at 11:46:58PM +0200, Levente Uzonyi <br />&gt; &gt; wrote:<br />&gt; &gt; &gt; On Tue, 3 Jul 2012, Frank Shearar wrote:<br />&gt; &gt; &gt; <br />&gt; &gt; &gt; &gt;On 3 July 2012 17:42, Frank Shearar &lt;frank.shearar@gmail.com&gt; wrote:<br />&gt; &gt; &gt; &gt;&gt;On 3 July 2012 17:38, Levente Uzonyi &lt;leves@elte.hu&gt; wrote:<br />&gt; &gt; &gt; &gt;&gt;&gt;On Tue, 3 Jul 2012, Frank Shearar wrote:<br />&gt; &gt; &gt; &gt;&gt;&gt;<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;Hi,<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;I took WebClient for a spin in a trunk image, and found a failing<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;test: WebClientServerTest &gt;&gt; #testServerDestroy throws a<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;&quot;ConnectionClosed: Connection closed while waiting for data&quot;. That<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;sounds familiar - I think this was introduced in a recent Network<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;change.<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;Still, it means WebClient needs fixing. I'll try fix it on my <br />&gt; &gt; evening<br />&gt; &gt; &gt; &gt;&gt;&gt;&gt;commute, but if anyone feels like racing me, I'll be happy!<br />&gt; &gt; &gt; &gt;&gt;&gt;<br />&gt; &gt; &gt; &gt;&gt;&gt;<br />&gt; &gt; &gt; &gt;&gt;&gt;Interesting, I had no issue with it on windows, except for some <br />&gt; &gt; extension<br />&gt; &gt; &gt; &gt;&gt;&gt;methods trying to use the CrLf class variable in HTTPSocket (or some <br />&gt; &gt; &gt; &gt;&gt;&gt;other<br />&gt; &gt; &gt; &gt;&gt;&gt;class), but that variable doesn't exist.<br />&gt; &gt; &gt; &gt;&gt;<br />&gt; &gt; &gt; &gt;&gt;Which reminds me of an important fact I should mention: I'm testing<br />&gt; &gt; &gt; &gt;&gt;this on an Ubuntu Lynx box.<br />&gt; &gt; &gt; <br />&gt; &gt; &gt; The VM also matters in this case. I tried it with an older CogVM which <br />&gt; &gt; &gt; doesn't have the new socket primitives.<br />&gt; &gt; <br />&gt; &gt; I wanted to check that the recent network updates were not causing<br />&gt; &gt; problems for WebClient. I found that some updates to WebClient are<br />&gt; &gt; needed to account for the fact that network addresses are now being<br />&gt; &gt; represented as SocketAddress rather than ByteArray when running on<br />&gt; &gt; a VM that supports the new network primitives.<br />&gt; &gt; <br />&gt; &gt; Attached is a change set that addresses all the issues that I could<br />&gt; &gt; find. I'm assuming that the testServerDestroy issue discussed above<br />&gt; &gt; has already been addressed, as I had no failures for that test.<br />&gt; &gt; <br />&gt; &gt; From the preamble:<br />&gt; &gt; <br />&gt; &gt;   Change Set:                WebClient-networkPatches-dtl<br />&gt; &gt;   Date:                        15 July 2012<br />&gt; &gt;   Author:                        David T Lewis<br />&gt; &gt;   <br />&gt; &gt;   These patches update WebClient to work with new network code in Squeak<br />&gt; &gt;   trunk (all tests green).<br />&gt; &gt;   <br />&gt; &gt;   Explanation: When using the new network code along with a VM that <br />&gt; &gt; supports the<br />&gt; &gt;   IPV6 primitives, socket addresses are instances of SocketAddress rather <br />&gt; &gt; than<br />&gt; &gt;   ByteArray. Conversion of a socket address to a string must be <br />&gt; &gt; implemented<br />&gt; &gt;   differently for SocketAddress.<br />&gt; &gt;   <br />&gt; &gt;   Also use String crlf instead of undeclared CrLf in HTTPSocket <br />&gt; &gt; class&gt;&gt;httpPostMultipart:args:accept:request:<br />&gt; &gt;   <br />&gt; &gt;   Note: Squeak automatically uses SocketAddress if the VM supports it at <br />&gt; &gt; image<br />&gt; &gt;   start time. To force use of old style ByteArray addresses, evaluate<br />&gt; &gt;   NetNameResolver useOldNetwork: true.<br />&gt; &gt;   <br />&gt; &gt;   Follow up: The WebClient methods in HTTPSocket are marked as overrides <br />&gt; &gt; (category<br />&gt; &gt;   *WebClient-HTTP-override) but are not overrides with respect to Squeak <br />&gt; &gt; trunk.<br />&gt; &gt;   The override category prevents these methods from appearing in a change <br />&gt; &gt; set<br />&gt; &gt;   fileout. Should these methods just be adopted in trunk?<br />&gt; &gt; <br />&gt; &gt; Dave<br />&gt; &gt; <br />&gt; &gt; <br />&gt;         <br /></blockquote>
        </body>
    </html>