From d987f7b0d54a7ebc1d305f9cdb29c1436335b33f Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Sat, 20 Apr 2013 08:56:45 -0500 Subject: [PATCH] user agent strings in connect logging are now properly quoted --- websocketpp/impl/connection_impl.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/websocketpp/impl/connection_impl.hpp b/websocketpp/impl/connection_impl.hpp index 48e702b31a..079c8e79ce 100644 --- a/websocketpp/impl/connection_impl.hpp +++ b/websocketpp/impl/connection_impl.hpp @@ -1757,8 +1757,13 @@ void connection::log_open_result() // User Agent std::string ua = m_request.get_header("User-Agent"); - s << (ua == "" ? "NULL" : ua) << " "; - + if (ua == "") { + s << "\"\" "; + } else { + // check if there are any quotes in the user agent + s << "\"" << utility::string_replace_all(ua,"\"","\\\"") << "\" "; + } + // URI s << (m_uri ? m_uri->get_resource() : "NULL") << " ";