mtrojnar / osslsigncode

OpenSSL based Authenticode signing for PE/MSI/Java CAB files
Other
731 stars 124 forks source link

Fix python 3 compatibility in server_http.py #350

Closed ThinLinc-Zeijlon closed 4 months ago

ThinLinc-Zeijlon commented 4 months ago

Building osslsigncode fails on systems with older versions of Python 3. This is due to the server_http.py script, that runs as a part of the test procedure. It imports the ThreadingHTTPServer-module which was added to Python in version 3.7.

Replacing ThreadingHTTPServer with a plain HTTPServer allows us to build for older versions of Python 3 without excluding the tests from the build.

mtrojnar commented 4 months ago

Our tests don't require HTTP server concurrency indeed, because we only issue one HTTP request at a time.

mtrojnar commented 4 months ago

The PR causes Linux and OSX tests to hang. It can't be merged before the hang is fixed..

olszomal commented 4 months ago

@ThinLinc-Zeijlon Shutdown for HTTPServer hangs. What do you think about this fix:

threading.Thread(target=server.shutdown, daemon=True).start()

@mtrojnar OSX tests are permanently broken.

mtrojnar commented 4 months ago

@mtrojnar OSX tests are permanently broken.

I did notice that. Although they were failing without this PR, this PR makes them also hanging, which was not the case before.

ThinLinc-Zeijlon commented 4 months ago

@ThinLinc-Zeijlon Shutdown for HTTPServer hangs. What do you think about this fix:

threading.Thread(target=server.shutdown, daemon=True).start()

Yes, maybe that could work.

Please see my latest commit also, turns out it was easy to replicate the the ThreadingHTTPServer locally, maybe that can be a way forward also.

mtrojnar commented 4 months ago

Please see my latest commit also, turns out it was easy to replicate the the ThreadingHTTPServer locally, maybe that can be a way forward also.

I like this solution.