From 1e2762e6484855d4c8796144a52c827f8c4889c1 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Fri, 3 May 2013 07:57:08 -0500 Subject: [PATCH] adds error handling to proxy initiation --- websocketpp/transport/asio/endpoint.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/websocketpp/transport/asio/endpoint.hpp b/websocketpp/transport/asio/endpoint.hpp index e235f62587..1425187e02 100644 --- a/websocketpp/transport/asio/endpoint.hpp +++ b/websocketpp/transport/asio/endpoint.hpp @@ -373,12 +373,20 @@ protected: port = u->get_port_str(); } else { try { + lib::error_code ec; + uri_ptr pu(new uri(proxy)); - tcon->proxy_init(u->get_host_port()); + ec = tcon->proxy_init(u->get_host_port()); + if (ec) { + cb(tcon->get_handle(),ec); + return; + } + host = pu->get_host(); port = pu->get_port_str(); } catch (uri_exception) { cb(tcon->get_handle(),make_error_code(error::proxy_invalid)); + return; } }