I'm a bit sceptical to the recent change of Stdio and Protocols.HTTP.Query regarding address families.
The comment says that the constants are required because open_socket does not accept a destination address (true enough, although it would be possible to change that instead), but why does the code need to call open_socket anyway? It doesn't actually do anything with the socket before calling connect() on it.
Query.pike keeps the con variable global in the object so I assume it is used later. Inside Stdio.File there are checks if the socket was opened earlier and the behavior changes accoringly.
Passing the remote address to open_socket() would be semantically quite different from providing a local address if the only purpose is to get the adress family and not binding the socket.
Anyway, those changes were the minimal needed to get
Protocols.HTTP.get_url("http://%5B::1%5D:1234/something/")
to succeed. Whether Query.pike could be redesigned was beyond the scope of my fix since I needed IPv6 functionality in place yesterday for a customer test.
Passing the remote address to open_socket() would be semantically quite different from providing a local address if the only purpose is to get the adress family and not binding the socket.
I'm not quite sure I follow you. Of course it's different from providing a local address. So?
Anyway, those changes were the minimal needed to get
Protocols.HTTP.get_url("http://%5B::1%5D:1234/something/")
to succeed. Whether Query.pike could be redesigned was beyond the scope of my fix since I needed IPv6 functionality in place yesterday for a customer test.
But they are not sufficient to get
Protocols.HTTP.get_url("http://ipv6.google.com/something/")
to work.
I think it's very bad to commit ad-hoc hacks to the repository without prior discussion at this point in the release cycle. What you do in your working copy is your own business of course.
But they are not sufficient to get
Protocols.HTTP.get_url("http://ipv6.google.com/something/")
to work.
Ok, true. So you'd want open_socket() to take extra parameters for the target machine's address and resolve that internally? How did the people implementing v6 support in Pike 7.7 intend it to work?
Though moving the DNS lookup in Query.pike::thread_request() ought to fix that since we'd check the IP instead of the host name.
Ok, true. So you'd want open_socket() to take extra parameters for the target machine's address and resolve that internally?
Well, the extra parameter is already there. But I'd rather see the target machine's address passed by user code than an integer computed by dubious means. open_socket() can then use get_inet_addr() to convert the string into an address family in exactly the same way that connect() would have done.
How did the people implementing v6 support in Pike 7.7 intend it to work?
My intention was that you should never have to worry about what protocol family an address uses. The protocol family numers are intentionally not exposed because a need to use them indicates a failure to achieve that goal, and a need to redesign some part of the API (in this case open_socket()).
Stdio.File::open_socket() doesn't have such a parameter that I can find. Which one are you referring to? The "host" parameter seems intended for binding local interface only.
If you'd like to rework Query.pike to get rid of open_socket() I see no problem in changing that. For now I'm inclined to update Query.pike with that DNS move to make things slightly better.
Ok, I was looking for something similar to what connect() uses, not an incompatible API change (unless you want a weird address/family union type).
My suggestion was for a union type, yes. connect() still needs to call it internally with the numeric argument (to prevent a double lookup). It should also have a new name, something like "target_hint".
If it wasn't for compatibility, I'd prefer removing open_socket() completely.
Query.pike keeps the con variable global in the object so I assume it is used later.
This comment may be irrelevant to the rest of the thread, but if memory serves me right, that con object is used if you want to use the connection to do keep-alive (either manually or with Session help).
Yes, you can keep the object and reuse it. But in that scenario, you reuse con _after_ the connect(), not between the open_socket() and the connect(), so I don't think the call to open_socket() is necessary for this to work.
Hence the lessened relevance to the thread topic. :-) (I guessed it might be a property unknown to both Jonas and the Query refdocs and/or implementation's comments, either or all of which could use fixing.)
So, will you two sort this out without exposing the guts of IP to the user, or should I revert this and open up the 7.9 branch.
pike-devel@lists.lysator.liu.se