Fix python 3 compatibility in server_http.py (#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.
This commit is contained in:
Zeijlon (ThinLinc Team) 2024-02-16 12:39:48 +01:00 committed by GitHub
parent b2024cee9d
commit 42e9733916
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,7 +6,8 @@ import subprocess
import sys import sys
import threading import threading
from urllib.parse import urlparse from urllib.parse import urlparse
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer from http.server import SimpleHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
RESULT_PATH = os.getcwd() RESULT_PATH = os.getcwd()
FILES_PATH = os.path.join(RESULT_PATH, "./Testing/files/") FILES_PATH = os.path.join(RESULT_PATH, "./Testing/files/")
@ -27,6 +28,8 @@ OPENSSL_TS = ["openssl", "ts",
"-queryfile", REQUEST, "-queryfile", REQUEST,
"-out", RESPONS] "-out", RESPONS]
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
daemon_threads = True
class RequestHandler(SimpleHTTPRequestHandler): class RequestHandler(SimpleHTTPRequestHandler):
"""Handle the HTTP POST request that arrive at the server""" """Handle the HTTP POST request that arrive at the server"""