Add HTTP proxy support in forward proxy (#745)
* Add HTTP proxy support in forward proxy Signed-off-by: noisyfox <timemanager.rick@gmail.com> * Typo * Throw exception if forward proxy not supported.
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Shadowsocks.Proxy
|
||||
public Exception ex { get; set; }
|
||||
}
|
||||
|
||||
private WrappedSocket _remote = new WrappedSocket();
|
||||
private readonly WrappedSocket _remote = new WrappedSocket();
|
||||
|
||||
private const int Socks5PktMaxSize = 4 + 16 + 2;
|
||||
private readonly byte[] _receiveBuffer = new byte[Socks5PktMaxSize];
|
||||
@@ -124,7 +124,7 @@ namespace Shadowsocks.Proxy
|
||||
st.Callback = callback;
|
||||
st.AsyncState = state;
|
||||
|
||||
_remote?.BeginSend(request, 0, request.Length, 0, Socks5RequestSendCallback, st);
|
||||
_remote.BeginSend(request, 0, request.Length, 0, Socks5RequestSendCallback, st);
|
||||
}
|
||||
|
||||
public void EndConnectDest(IAsyncResult asyncResult)
|
||||
@@ -140,7 +140,7 @@ namespace Shadowsocks.Proxy
|
||||
public void BeginSend(byte[] buffer, int offset, int size, SocketFlags socketFlags, AsyncCallback callback,
|
||||
object state)
|
||||
{
|
||||
_remote?.BeginSend(buffer, offset, size, socketFlags, callback, state);
|
||||
_remote.BeginSend(buffer, offset, size, socketFlags, callback, state);
|
||||
}
|
||||
|
||||
public int EndSend(IAsyncResult asyncResult)
|
||||
@@ -151,7 +151,7 @@ namespace Shadowsocks.Proxy
|
||||
public void BeginReceive(byte[] buffer, int offset, int size, SocketFlags socketFlags, AsyncCallback callback,
|
||||
object state)
|
||||
{
|
||||
_remote?.BeginReceive(buffer, offset, size, socketFlags, callback, state);
|
||||
_remote.BeginReceive(buffer, offset, size, socketFlags, callback, state);
|
||||
}
|
||||
|
||||
public int EndReceive(IAsyncResult asyncResult)
|
||||
@@ -161,12 +161,12 @@ namespace Shadowsocks.Proxy
|
||||
|
||||
public void Shutdown(SocketShutdown how)
|
||||
{
|
||||
_remote?.Shutdown(how);
|
||||
_remote.Shutdown(how);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
_remote?.Dispose();
|
||||
_remote.Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user