aboutsummaryrefslogtreecommitdiff
path: root/test/test_http.py
diff options
context:
space:
mode:
authorXiao Di Guan <xdg@puxlit.net>2018-11-03 05:18:20 +1100
committerSergey M <dstftw@gmail.com>2018-11-03 01:18:20 +0700
commit95e42d7336d01f505d6551a21df52f3ae234e96b (patch)
tree795dc08fedf4db29ac64a938197bebf7f5f0ebfe /test/test_http.py
parentcf0db4d99785532d767d0ca1cc029c73d16bb045 (diff)
[extractor/common] Ensure response handle is not prematurely closed before it can be read if it matches expected_status (resolves #17195, closes #17846, resolves #17447)
Diffstat (limited to 'test/test_http.py')
-rw-r--r--test/test_http.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/test/test_http.py b/test/test_http.py
index 409fec9c8..3ee0a5dda 100644
--- a/test/test_http.py
+++ b/test/test_http.py
@@ -8,6 +8,7 @@ import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from test.helper import http_server_port
from youtube_dl import YoutubeDL
from youtube_dl.compat import compat_http_server, compat_urllib_request
import ssl
@@ -16,15 +17,6 @@ import threading
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
-def http_server_port(httpd):
- if os.name == 'java' and isinstance(httpd.socket, ssl.SSLSocket):
- # In Jython SSLSocket is not a subclass of socket.socket
- sock = httpd.socket.sock
- else:
- sock = httpd.socket
- return sock.getsockname()[1]
-
-
class HTTPTestRequestHandler(compat_http_server.BaseHTTPRequestHandler):
def log_message(self, format, *args):
pass