SOCKS4/4a/5 proxy support in SocketsHttpHandler (#48883)
* Separate method for proxy scheme validation. * Pass socks connection kind. * Unauthorized socks5 connection. * Username and password auth. * Fix response address. * Fix proxyUri value and assertion. * Use HttpConnectionKind for SOCKS. * Handle more connection kind assertions. * SOCKS4/4a support. * Move version selection into SocksHelper. * Call sync version of read write. * Cancellation by disposing stream. * Dispose cancellation registration. * IP addressing for SOCKS5. * IP addressing for SOCKS4. * Wrap write method. * Cancellation and optimization. * Optimize. * Apply suggestions from code review Co-authored-by: NMiha Zupan <mihazupan.zupan1@gmail.com> * Clarify logic. * Remove ssl assertion. * SocksException. * Make SocksException derive from IOException. * Use binary primitives to write port in BE. * Socks loopback test. * Expand test matrix. * Try to solve certificate issue. * Pass handler to httpclient. * Update ConnectToTcpHostAsync. * Remove custom self-signed cert use from Socks test * Fix LoopbackSocksServer's parsing of Socks4a domain name * Only set RequestVersionExact for H2C Setting it in general breaks H2 => H1.1 downgrade on platforms without ALPN * Add auth test. * Add IP in test matrix. * Only override host when required. * Don't attempt NT Auth for Socks proxies * Skip HTTP2 ssl test on platforms without ALPN support * Use NetworkCredential directly * Pass AddressFamily to sync Dns resolution too * Consistently check encoded string lengths * Fix Socks5 user/pass auth * Add IPv6 test for socks5 * Exception nits * Add exceptional tests. * Fix exceptional test. * Fix NRT compilation Co-authored-by: NMiha Zupan <mihazupan.zupan1@gmail.com> * Server shouldn't wait for request in exceptional test. * Add exception message to test. * Update auth failure handling. * SOCKS4 and 5 uses different auth model, requires different error message. * Revert accidental indent change. * Expand test matrix to include Sync HTTP1 * Read received bytes before returning error response in Socks4 loopback * Use named bool arguments * Improve exception messages * !IsEmpty => Length != 0 * Improve exception messages 2 * Avoid enforing Socks4 VN value Co-authored-by: NMiha Zupan <mihazupan.zupan1@gmail.com>
Showing
想要评论请 注册 或 登录