Set remote IP on PROXY handshake

This commit is contained in:
Vinnie Falco
2013-08-25 01:13:22 -07:00
parent 4170bcd294
commit b37c537b4a
4 changed files with 77 additions and 31 deletions

View File

@@ -85,6 +85,13 @@ public:
server_proxy = 8
};
typedef HandshakeDetectLogicPROXY::ProxyInfo ProxyInfo;
// Note that this returns the original flags
virtual Flag getFlags () = 0;
virtual ProxyInfo getProxyInfo () = 0;
virtual SSL* native_handle () = 0;
static MultiSocket* New (

View File

@@ -31,6 +31,7 @@ public:
, m_needsShutdown (false)
, m_next_layer (arg)
, m_native_ssl_handle (nullptr)
, m_origFlags (cleaned_flags (flags))
{
// See if our flags allow us to go directly
// into the ready state with an active stream.
@@ -55,6 +56,16 @@ protected:
// MultiSocket
//
Flag getFlags ()
{
return m_origFlags;
}
ProxyInfo getProxyInfo ()
{
return m_proxyInfo;
}
SSL* native_handle ()
{
bassert (m_native_ssl_handle != nullptr);
@@ -612,13 +623,6 @@ protected:
return new_ssl_stream ();
}
//--------------------------------------------------------------------------
void setProxyInfo (HandshakeDetectLogicPROXY::ProxyInfo const proxyInfo)
{
// Do something with it
}
//--------------------------------------------------------------------------
//
// Synchronous handshake operation
@@ -670,7 +674,7 @@ protected:
if (op.getLogic ().success ())
{
setProxyInfo (op.getLogic ().getInfo ());
m_proxyInfo = op.getLogic ().getInfo ();
// Strip off the PROXY flag.
m_flags = m_flags.without (Flag::proxy);
@@ -846,7 +850,7 @@ protected:
{
if (m_proxy.getLogic ().success ())
{
m_owner.setProxyInfo (m_proxy.getLogic ().getInfo ());
m_owner.m_proxyInfo = m_proxy.getLogic ().getInfo ();
// Strip off the PROXY flag.
m_owner.m_flags = m_owner.m_flags.without (Flag::proxy);
@@ -936,7 +940,9 @@ private:
ScopedPointer <Socket> m_ssl_stream; // the ssl portion of our stream if it exists
bool m_needsShutdown;
StreamSocket m_next_layer;
ProxyInfo m_proxyInfo;
SSL* m_native_ssl_handle;
Flag m_origFlags;
};
#endif