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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[networking] Fix various bugs in socks proxy implementation #8065
Merged
Conversation
This file contains 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
Grub4K
reviewed
Sep 15, 2023
Co-authored-by: Simon Sawicki <accounts@grub4k.xyz>
This reverts commit 5423583.
coletdjnz
requested review from
Grub4K and
bashonly
and removed request for
pukkandan
September 16, 2023 21:22
Grub4K
reviewed
Sep 17, 2023
bashonly
approved these changes
Sep 17, 2023
Co-authored-by: Simon Sawicki <accounts@grub4k.xyz>
Grub4K
approved these changes
Sep 17, 2023
aalsuwaidi
pushed a commit
to aalsuwaidi/yt-dlp
that referenced
this pull request
Apr 21, 2024
- Fixed support for IPv6 socks proxies - Fixed support for IPv6 over socks5 - Fixed --source-address not being obeyed for socks4 and socks5 - Fixed socks4a when the destination address is an IPv4 address Closes yt-dlp#7959 Fixes ytdl-org/youtube-dl#15368 Authored by: coletdjnz Co-authored-by: Simon Sawicki <accounts@grub4k.xyz> Co-authored-by: bashonly <bashonly@bashonly.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #7959
Fixes ytdl-org/youtube-dl#15368
--source-address
is not obeyed for either socks4 and socks5Template
Before submitting a pull request make sure you have:
In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:
What is the purpose of your pull request?
Copilot Summary
馃 Generated by Copilot at 6801a5f
Summary
馃悰馃寪馃И
This pull request enhances the socks proxy support in
yt-dlp
by adding IPv6 and source_address capabilities, fixing bugs, and improving the testing and implementation of the proxy handlers. It modifies the filestest/test_socks.py
,yt_dlp/networking/_helper.py
,yt_dlp/networking/_urllib.py
, andyt_dlp/socks.py
.Walkthrough
yt_dlp/networking/_helper.py
that allows specifying the source_address for the socket connection (link, link)yt_dlp/networking/_urllib.py
to simplify the _create_http_connection function and to add the _create_connection attribute to the SocksConnection class (link, link, link)yt_dlp/socks.py
to handle both IPv4 and IPv6 addresses and to pass the address family information to the proxy (link, link, link, link)yt_dlp/socks.py
, and only append the domain name to the packet in that case (link)test/test_socks.py
, and modify the assertion to accept both the ipv4_address and the domain_address as valid (link, link)test/test_socks.py
, which was failing for both socks4 and socks5 proxies (link, link)test/test_socks.py
, which was failing for the socks4 proxy (link)test/test_socks.py
, which was failing for the socks5 proxy, and remove the port check from the assertion (link, link)test/test_socks.py
, to accept both the ipv4_address and the ipv6_address as valid (link)test/test_socks.py
, and modify the timeout value in the test_timeout test case (link, link, link, link, link)test/test_socks.py
, to make it more likely to trigger the timeout exception (link)