X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=httpinput.cpp;h=301aa3f9f81ebfe5c6b5d2f519841e19ceb1bf50;hb=861b758382bd863743232da244bc66533658440f;hp=e54aedba2f593711c08af8b9f614adf0fddfdc1c;hpb=8b38253eca5071946b12579541f2095ccbad2e1e;p=cubemap diff --git a/httpinput.cpp b/httpinput.cpp index e54aedb..301aa3f 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -89,14 +89,13 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port) if (err == -1) { log(WARNING, "[%s] Lookup of '%s' failed (%s).", url.c_str(), host.c_str(), gai_strerror(err)); - freeaddrinfo(ai); return -1; } addrinfo *base_ai = ai; // Connect to everything in turn until we have a socket. - while (ai && !should_stop()) { + for ( ; ai && !should_stop(); ai = ai->ai_next) { int sock = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP); if (sock == -1) { // Could be e.g. EPROTONOSUPPORT. The show must go on. @@ -154,7 +153,6 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port) } safe_close(sock); - ai = ai->ai_next; } // Give the last one as error. @@ -387,7 +385,7 @@ void HTTPInput::do_work() if (ret == 0) { // This really shouldn't happen... - log(ERROR, "[%s] Socket unexpectedly closed while reading header", + log(ERROR, "[%s] Socket unexpectedly closed while reading data", url.c_str()); state = CLOSING_SOCKET; continue;