mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-07 07:44:13 +00:00
Merge pull request #1295 from l-n-s/websocket_support
Support websocket connections over HTTP proxy
This commit is contained in:
commit
a463dbc5fb
@ -219,7 +219,11 @@ namespace proxy {
|
|||||||
/* replace headers */
|
/* replace headers */
|
||||||
req.UpdateHeader("User-Agent", "MYOB/6.66 (AN/ON)");
|
req.UpdateHeader("User-Agent", "MYOB/6.66 (AN/ON)");
|
||||||
/* add headers */
|
/* add headers */
|
||||||
req.UpdateHeader("Connection", "close"); /* keep-alive conns not supported yet */
|
/* close connection, if not Connection: (U|u)pgrade (for websocket) */
|
||||||
|
auto h = req.GetHeader ("Connection");
|
||||||
|
auto x = h.find("pgrade");
|
||||||
|
if (!(x != std::string::npos && std::tolower(h[x - 1]) == 'u'))
|
||||||
|
req.UpdateHeader("Connection", "close");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -256,7 +256,13 @@ namespace client
|
|||||||
{
|
{
|
||||||
if (!m_ConnectionSent && !line.compare(0, 10, "Connection"))
|
if (!m_ConnectionSent && !line.compare(0, 10, "Connection"))
|
||||||
{
|
{
|
||||||
m_OutHeader << "Connection: close\r\n";
|
/* close connection, if not Connection: (U|u)pgrade (for websocket) */
|
||||||
|
auto x = line.find("pgrade");
|
||||||
|
if (x != std::string::npos && std::tolower(line[x - 1]) == 'u')
|
||||||
|
m_OutHeader << line << "\r\n";
|
||||||
|
else
|
||||||
|
m_OutHeader << "Connection: close\r\n";
|
||||||
|
|
||||||
m_ConnectionSent = true;
|
m_ConnectionSent = true;
|
||||||
}
|
}
|
||||||
else if (!m_ProxyConnectionSent && !line.compare(0, 16, "Proxy-Connection"))
|
else if (!m_ProxyConnectionSent && !line.compare(0, 16, "Proxy-Connection"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user