-
Notifications
You must be signed in to change notification settings - Fork 5.2k
SOCKS4/4a/5 proxy support in SocketsHttpHandler #48883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
5f2407a
Separate method for proxy scheme validation.
huoyaoyuan 7a70c33
Pass socks connection kind.
huoyaoyuan d0aa8fc
Unauthorized socks5 connection.
huoyaoyuan b091355
Username and password auth.
huoyaoyuan 98a1d12
Fix response address.
huoyaoyuan c4cdd8e
Fix proxyUri value and assertion.
huoyaoyuan b5e3701
Use HttpConnectionKind for SOCKS.
huoyaoyuan 15b2a8f
Handle more connection kind assertions.
huoyaoyuan 56bf28b
SOCKS4/4a support.
huoyaoyuan a2a80f7
Move version selection into SocksHelper.
huoyaoyuan 1d7fa76
Call sync version of read write.
huoyaoyuan 44cce2e
Cancellation by disposing stream.
huoyaoyuan 140bbc1
Dispose cancellation registration.
huoyaoyuan 694b869
IP addressing for SOCKS5.
huoyaoyuan e68224a
IP addressing for SOCKS4.
huoyaoyuan 24e1e2d
Wrap write method.
huoyaoyuan d1a8eae
Cancellation and optimization.
huoyaoyuan 7836231
Optimize.
huoyaoyuan da3ef58
Apply suggestions from code review
huoyaoyuan 7371407
Clarify logic.
huoyaoyuan c007769
Remove ssl assertion.
huoyaoyuan 0517a87
SocksException.
huoyaoyuan ca9babe
Make SocksException derive from IOException.
huoyaoyuan 50a723a
Use binary primitives to write port in BE.
huoyaoyuan 3b6eb5f
Socks loopback test.
huoyaoyuan 4882181
Expand test matrix.
huoyaoyuan 5d21f2b
Try to solve certificate issue.
huoyaoyuan 5ef161c
Pass handler to httpclient.
huoyaoyuan 2df3d41
Merge branch 'main' into socks-proxy
huoyaoyuan 87ef694
Update ConnectToTcpHostAsync.
huoyaoyuan 4462be5
Merge branch 'main' into socks-proxy
MihaZupan b487d1f
Remove custom self-signed cert use from Socks test
MihaZupan de78efc
Fix LoopbackSocksServer's parsing of Socks4a domain name
MihaZupan df1d77f
Only set RequestVersionExact for H2C
MihaZupan f9465b5
Merge branch 'main' into socks-proxy
MihaZupan ee02582
Add auth test.
huoyaoyuan efc32b8
Add IP in test matrix.
huoyaoyuan ddb2f8d
Only override host when required.
huoyaoyuan e30ee4e
Don't attempt NT Auth for Socks proxies
MihaZupan 7b68507
Skip HTTP2 ssl test on platforms without ALPN support
MihaZupan dfb737c
Use NetworkCredential directly
MihaZupan 1bd2c0e
Pass AddressFamily to sync Dns resolution too
MihaZupan 5c26033
Consistently check encoded string lengths
MihaZupan 1308e14
Fix Socks5 user/pass auth
MihaZupan 76b61ce
Add IPv6 test for socks5
MihaZupan 54bde51
Exception nits
MihaZupan 4d7a545
Add exceptional tests.
huoyaoyuan 7a7bae0
Merge branch 'main'
huoyaoyuan 1e5cde4
Fix exceptional test.
huoyaoyuan 8bbb9e8
Fix NRT compilation
huoyaoyuan 32a36b5
Server shouldn't wait for request in exceptional test.
huoyaoyuan 9ed3686
Add exception message to test.
huoyaoyuan e70eb62
Update auth failure handling.
huoyaoyuan c79979c
SOCKS4 and 5 uses different auth model, requires different error mess…
huoyaoyuan bca15fa
Revert accidental indent change.
huoyaoyuan 0ae546d
Expand test matrix to include Sync HTTP1
MihaZupan b06f145
Read received bytes before returning error response in Socks4 loopback
MihaZupan 7f20191
Use named bool arguments
MihaZupan 2ff779a
Improve exception messages
MihaZupan c08e717
!IsEmpty => Length != 0
MihaZupan 52df362
Improve exception messages 2
MihaZupan 95400e2
Avoid enforing Socks4 VN value
MihaZupan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocksException.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.IO; | ||
|
||
namespace System.Net.Http | ||
{ | ||
internal class SocksException : IOException | ||
{ | ||
public SocksException(string message) : base(message) { } | ||
|
||
public SocksException(string message, Exception innerException) : base(message, innerException) { } | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.