Skip to content
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

Support for socks5h:// proxies #22618

Open
3 tasks done
yurendry opened this issue Oct 5, 2019 · 0 comments · May be fixed by #28093
Open
3 tasks done

Support for socks5h:// proxies #22618

yurendry opened this issue Oct 5, 2019 · 0 comments · May be fixed by #28093
Labels

Comments

@yurendry
Copy link

yurendry commented Oct 5, 2019

Checklist

  • I'm reporting a feature request
  • I've verified that I'm running youtube-dl version 2019.09.28
  • I've searched the bugtracker for similar feature requests including closed ones

Description

The difference between SOCKS5 and SOCKS5H is that SOCKS5H resolves DNS requests through the proxy and SOCKS5 resolves them locally. The DNS leak has technically been addressed in #9677 and it appears to been removed based on tests I carried out sniffing for DNS packets while running youtube-dl with --proxy socks5:// (this is the relevant line, I think).

So youtube-dl --proxy socks5:// behaves how youtube-dl --proxy socks5h:// should behave, and the latter misbehaves:

youtube-dl --proxy socks5h://127.0.0.1:9050 https://www.youtube.com/watch?v=BaW_jenozKc
[youtube] BaW_jenozKc: Downloading webpage
ERROR: Unable to download webpage: <urlopen error Tunnel connection failed: 501 Tor is not an HTTP Proxy> (caused by URLError(error('Tunnel connection failed: 501 Tor is not an HTTP Proxy',),))

I suggest that youtube-dl should accept the socks5h protocol and use for it the implementation of SOCKS5 that already exists (where DNS is resolved by the SOCKS server).

And maybe socks5's implementation should be changed to resolve DNS locally to honour the specification. The only issue I can see with fixing the names of the protocols is any scripts with socks5:// in them will start leaking DNS requests.

@whew whew linked a pull request Feb 6, 2021 that will close this issue
11 tasks
pukkandan pushed a commit to pukkandan/yt-dlp-dev that referenced this issue Jul 15, 2023
New networking interface consists of a `RequestDirector` that directs
each `Request` to appropriate `RequestHandler` and returns the
`Response` or raises `RequestError`. The handlers define adapters to
transform its internal Request/Response/Errors to our interfaces.

User-facing changes:
- Fix issues with per request proxies on redirects for urllib
- Support for `ALL_PROXY` environment variable for proxy setting
- Support for `socks5h` proxy
   - Closes yt-dlp#6325, ytdl-org/youtube-dl#22618, ytdl-org/youtube-dl#28093
- Raise error when using `https` proxy instead of silently converting it to `http`

Authored by: coletdjnz
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this issue Apr 21, 2024
New networking interface consists of a `RequestDirector` that directs
each `Request` to appropriate `RequestHandler` and returns the
`Response` or raises `RequestError`. The handlers define adapters to
transform its internal Request/Response/Errors to our interfaces.

User-facing changes:
- Fix issues with per request proxies on redirects for urllib
- Support for `ALL_PROXY` environment variable for proxy setting
- Support for `socks5h` proxy
   - Closes yt-dlp#6325, ytdl-org/youtube-dl#22618, ytdl-org/youtube-dl#28093
- Raise error when using `https` proxy instead of silently converting it to `http`

Authored by: coletdjnz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant