mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
fixed possible invalid pointer when send error response
This commit is contained in:
parent
e1b4feb618
commit
69b0bef206
@ -109,7 +109,7 @@ namespace proxy {
|
|||||||
std::shared_ptr<boost::asio::ip::tcp::socket> m_sock;
|
std::shared_ptr<boost::asio::ip::tcp::socket> m_sock;
|
||||||
std::shared_ptr<boost::asio::ip::tcp::socket> m_proxysock;
|
std::shared_ptr<boost::asio::ip::tcp::socket> m_proxysock;
|
||||||
boost::asio::ip::tcp::resolver m_proxy_resolver;
|
boost::asio::ip::tcp::resolver m_proxy_resolver;
|
||||||
std::string m_OutproxyUrl;
|
std::string m_OutproxyUrl, m_Response;
|
||||||
bool m_Addresshelper;
|
bool m_Addresshelper;
|
||||||
i2p::http::URL m_ProxyURL;
|
i2p::http::URL m_ProxyURL;
|
||||||
i2p::http::URL m_RequestURL;
|
i2p::http::URL m_RequestURL;
|
||||||
@ -206,8 +206,8 @@ namespace proxy {
|
|||||||
<< "<body>" << content << "</body>\r\n"
|
<< "<body>" << content << "</body>\r\n"
|
||||||
<< "</html>\r\n";
|
<< "</html>\r\n";
|
||||||
res.body = ss.str();
|
res.body = ss.str();
|
||||||
std::string response = res.to_string();
|
m_Response = res.to_string();
|
||||||
boost::asio::async_write(*m_sock, boost::asio::buffer(response), boost::asio::transfer_all(),
|
boost::asio::async_write(*m_sock, boost::asio::buffer(m_Response), boost::asio::transfer_all(),
|
||||||
std::bind(&HTTPReqHandler::SentHTTPFailed, shared_from_this(), std::placeholders::_1));
|
std::bind(&HTTPReqHandler::SentHTTPFailed, shared_from_this(), std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,8 +217,8 @@ namespace proxy {
|
|||||||
res.code = 302;
|
res.code = 302;
|
||||||
res.add_header("Location", address);
|
res.add_header("Location", address);
|
||||||
res.add_header("Connection", "close");
|
res.add_header("Connection", "close");
|
||||||
std::string response = res.to_string();
|
m_Response = res.to_string();
|
||||||
boost::asio::async_write(*m_sock, boost::asio::buffer(response), boost::asio::transfer_all(),
|
boost::asio::async_write(*m_sock, boost::asio::buffer(m_Response), boost::asio::transfer_all(),
|
||||||
std::bind(&HTTPReqHandler::SentHTTPFailed, shared_from_this(), std::placeholders::_1));
|
std::bind(&HTTPReqHandler::SentHTTPFailed, shared_from_this(), std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user