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

http_session: don't disable InsecureRequestWarning #4525

Conversation

bastimeyer
Copy link
Member

@bastimeyer bastimeyer commented May 12, 2022

ref #4523 (comment)

InsecureRequestWarning can be emitted by urllib3 here:
https://github.com/urllib3/urllib3/blob/1.26.9/src/urllib3/connectionpool.py#L1042-L1062


Example with HTTPS requests on a temporarily set up TLS certificate that's self-signed:

Without --http-no-ssl-verify (SSLCertVerificationError):

$ streamlink httpstream://https://test.bastimeyer.de/test.mp4 best
[cli][info] Found matching plugin http for URL httpstream://https://test.bastimeyer.de/test.mp4
[cli][info] Available streams: live (worst, best)
[cli][info] Opening stream: live (http)
[cli][info] Starting player: mpv
[cli][error] Try 1/1: Could not open stream <HTTPStream('https://test.bastimeyer.de/test.mp4')> (Could not open stream: Unable to open URL: https://test.bastimeyer.de/test.mp4 (HTTPSConnectionPool(host='test.bastimeyer.de', port=443): Max retries exceeded with url: /test.mp4 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)')))))
error: Could not open stream <HTTPStream('https://test.bastimeyer.de/test.mp4')>, tried 1 times, exiting

With --http-no-ssl-verify:

$ streamlink httpstream://https://test.bastimeyer.de/test.mp4 best --http-no-ssl-verify
[cli][info] Found matching plugin http for URL httpstream://https://test.bastimeyer.de/test.mp4
[cli][info] Available streams: live (worst, best)
[cli][info] Opening stream: live (http)
[cli][info] Starting player: mpv
/home/basti/venv/streamlink-310/lib/python3.10/site-packages/urllib3/connectionpool.py:1043: InsecureRequestWarning: Unverified HTTPS request is being made to host 'test.bastimeyer.de'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
[cli][info] Stream ended
[cli][info] Closing currently open stream...

@bastimeyer bastimeyer force-pushed the httpsession/remove-insecure-request-warning branch from 4dd0932 to c735710 Compare May 12, 2022 11:50
@bastimeyer bastimeyer changed the title http_session: remove InsecureRequestWarning http_session: don't disable InsecureRequestWarning May 12, 2022
@gravyboat gravyboat merged commit e2d9b36 into streamlink:master May 12, 2022
@bastimeyer bastimeyer deleted the httpsession/remove-insecure-request-warning branch May 12, 2022 17:59
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants