#include <msp/core/application.h>
#include <msp/core/getopt.h>
+#include <msp/debug/demangle.h>
#include <msp/http/client.h>
#include <msp/http/request.h>
#include <msp/http/response.h>
HttpGet(int, char **);
virtual int main();
+private:
+ void socket_error(const exception &);
};
HttpGet::HttpGet(int argc, char **argv):
int HttpGet::main()
{
Http::Client client;
+ client.signal_socket_error.connect(sigc::mem_fun(this, &HttpGet::socket_error));
if(verbose)
{
IO::print(client.get_request()->str());
client.wait_response();
const Http::Response *response = client.get_response();
- IO::print("=== Got response ===\n");
- IO::print(response->str());
+ if(response)
+ {
+ IO::print("=== Got response ===\n");
+ IO::print(response->str());
+ }
}
else
{
return 1;
}
+
+void HttpGet::socket_error(const exception &e)
+{
+ IO::print("=== Error ===\n");
+ IO::print("%s\n", Debug::demangle(typeid(e).name()));
+ IO::print("%s\n", e.what());
+}