Skip to content

Commit

Permalink
Fix python 3 compatibility in server_http.py (#350)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ThinLinc-Zeijlon authored Feb 16, 2024
1 parent b2024ce commit 42e9733
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/server_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import sys
import threading
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()
FILES_PATH = os.path.join(RESULT_PATH, "./Testing/files/")
Expand All @@ -27,6 +28,8 @@
"-queryfile", REQUEST,
"-out", RESPONS]

class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
daemon_threads = True

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

0 comments on commit 42e9733

Please sign in to comment.