[asio] Resolving Aliases

Hi Guys, While writing the HTTP client in the C++ Networking Library, I ran into a bizarre problem: resolving virtual hosts. For example, given a host named 'bucket.s3.amazonaws.com', trying to resolve it with Boost.Asio (in 1.35) causes a 'Host not found (authoritative)' error. Is this a known issue, and if so what's my alternative? TIA -- Dean Michael C. Berris Software Engineer, Friendster, Inc.

Dean Michael Berris wrote:
Hi Guys,
While writing the HTTP client in the C++ Networking Library, I ran into a bizarre problem: resolving virtual hosts.
For example, given a host named 'bucket.s3.amazonaws.com', trying to resolve it with Boost.Asio (in 1.35) causes a 'Host not found (authoritative)' error. Is this a known issue, and if so what's my alternative?
As far as DNS is concerned, there's no difference between the URL of a virtual and a singular host. Are you sure you weren't experiencing network problems? Sebastian

On Mon, Aug 18, 2008 at 1:08 AM, Sebastian Redl <sebastian.redl@getdesigned.at> wrote:
Dean Michael Berris wrote:
For example, given a host named 'bucket.s3.amazonaws.com', trying to resolve it with Boost.Asio (in 1.35) causes a 'Host not found (authoritative)' error. Is this a known issue, and if so what's my alternative?
As far as DNS is concerned, there's no difference between the URL of a virtual and a singular host. Are you sure you weren't experiencing network problems?
Well, doing 'host bucket.s3.amazonaws.com' from the shell works fine (it recognized that it's a virtualhost) so I don't think I was experiencing network problems then. It only seems to occur with Boost.Asio's resolver implementation -- somehow it's not processing aliases correctly. -- Dean Michael C. Berris Software Engineer, Friendster, Inc.

On Sunday 17 August 2008 20:23:02 Dean Michael Berris wrote:
Well, doing 'host bucket.s3.amazonaws.com' from the shell works fine (it recognized that it's a virtualhost) so I don't think I was experiencing network problems then.
It only seems to occur with Boost.Asio's resolver implementation -- somehow it's not processing aliases correctly.
Works fine here: $ ./resolve bucket.s3.amazonaws.com 72.21.202.39 $ cat resolve.cpp #include <iostream> #include <boost/asio/ip/tcp.hpp> using namespace boost::asio; int main(int argc, char* argv[]) { io_service ios; try { ip::tcp::resolver_iterator res = ip::tcp::resolver(ios).resolve(ip::tcp::resolver_query(argv[1], "80")); for(;res != ip::tcp::resolver_iterator(); ++res) { std::cout << res->endpoint().address().to_string() << std::endl; } } catch(std::exception const& ex) { std::cerr << "Error: " << ex.what() << '\n'; } } -- Dizzy "Linux is obsolete" -- AST

Hi dizzy, On Tue, Aug 19, 2008 at 5:55 PM, dizzy <dizzy@roedu.net> wrote:
On Sunday 17 August 2008 20:23:02 Dean Michael Berris wrote:
Well, doing 'host bucket.s3.amazonaws.com' from the shell works fine (it recognized that it's a virtualhost) so I don't think I was experiencing network problems then.
It only seems to occur with Boost.Asio's resolver implementation -- somehow it's not processing aliases correctly.
Works fine here: $ ./resolve bucket.s3.amazonaws.com 72.21.202.39
If you check with 'host', you should get: bucket.s3.amazonaws.com is an alias for s3-directional-w.amazonaws.com. s3-directional-w.amazonaws.com is an alias for s3-2-w.amazonaws.com. s3-2-w.amazonaws.com has address 207.171.191.252 Although doing reverse lookup using 'host 72.21.202.39', I get: 39.202.21.72.in-addr.arpa domain name pointer s3.amazonaws.com So I guess this might be a location-dependent thing, because when I reverse-lookup the IP I get (207.171.191.252): 252.191.171.207.in-addr.arpa domain name pointer 191-252.amazon.com At any rate, I've found a work-around specific to AmazonAWS which somehow works for me (which basically means ditching the alias syntax for the meantime). [snip] -- Dean Michael C. Berris Software Engineer, Friendster, Inc.

How can we print out the DNS query and response messages? to make the problem clearer! On Tue, Aug 19, 2008 at 6:26 PM, Dean Michael Berris <mikhailberis@gmail.com
wrote:
Hi dizzy,
On Tue, Aug 19, 2008 at 5:55 PM, dizzy <dizzy@roedu.net> wrote:
On Sunday 17 August 2008 20:23:02 Dean Michael Berris wrote:
Well, doing 'host bucket.s3.amazonaws.com' from the shell works fine (it recognized that it's a virtualhost) so I don't think I was experiencing network problems then.
It only seems to occur with Boost.Asio's resolver implementation -- somehow it's not processing aliases correctly.
Works fine here: $ ./resolve bucket.s3.amazonaws.com 72.21.202.39
If you check with 'host', you should get:
bucket.s3.amazonaws.com is an alias for s3-directional-w.amazonaws.com. s3-directional-w.amazonaws.com is an alias for s3-2-w.amazonaws.com. s3-2-w.amazonaws.com has address 207.171.191.252
Although doing reverse lookup using 'host 72.21.202.39', I get:
39.202.21.72.in-addr.arpa domain name pointer s3.amazonaws.com
So I guess this might be a location-dependent thing, because when I reverse-lookup the IP I get (207.171.191.252):
252.191.171.207.in-addr.arpa domain name pointer 191-252.amazon.com
At any rate, I've found a work-around specific to AmazonAWS which somehow works for me (which basically means ditching the alias syntax for the meantime).
[snip]
-- Dean Michael C. Berris Software Engineer, Friendster, Inc. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- ------------------------------- Enjoy life! Barco You
participants (4)
-
Barco You
-
Dean Michael Berris
-
dizzy
-
Sebastian Redl