Skip to content

Commit 42e9733

Browse files
Fix python 3 compatibility in server_http.py (mtrojnar#350)
Building osslsigncode fails on systems with older versions of Python 3 due to the server_http.py script, part of the test procedure. This script requires the ThreadingHTTPServer module, introduced in Python version 3.7. A workaround has been implemented to create a ThreadingHTTPServer locally, ensuring backward compatibility with older Python versions.
1 parent b2024ce commit 42e9733

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/server_http.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import sys
77
import threading
88
from urllib.parse import urlparse
9-
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
9+
from http.server import SimpleHTTPRequestHandler, HTTPServer
10+
from socketserver import ThreadingMixIn
1011

1112
RESULT_PATH = os.getcwd()
1213
FILES_PATH = os.path.join(RESULT_PATH, "./Testing/files/")
@@ -27,6 +28,8 @@
2728
"-queryfile", REQUEST,
2829
"-out", RESPONS]
2930

31+
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
32+
daemon_threads = True
3033

3134
class RequestHandler(SimpleHTTPRequestHandler):
3235
"""Handle the HTTP POST request that arrive at the server"""

0 commit comments

Comments
 (0)