[projects/pld-builder.new] request_handler_server: drop the "None: " in front of error replies
arekm
arekm at pld-linux.org
Mon Oct 26 17:17:46 CET 2026
commit 0483d7329e7068c2c9a6897cc6f2cfc8475ef446
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Oct 24 18:25:45 2026 +0200
request_handler_server: drop the "None: " in front of error replies
make-request.sh sends no X-Filename, so every error it showed to the
developer started with "None: ".
PLD_Builder/request_handler_server.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/PLD_Builder/request_handler_server.py b/PLD_Builder/request_handler_server.py
index 2430684..0cc6abe 100644
--- a/PLD_Builder/request_handler_server.py
+++ b/PLD_Builder/request_handler_server.py
@@ -39,6 +39,10 @@ class ForkingHTTPServer(ForkingMixIn, HTTPServer):
signal.signal(signal.SIGINT, signal.SIG_DFL)
super().finish_request(request, client_address)
+def about(filename):
+ # only file_sender names what it posts; make-request.sh does not
+ return filename + ": " if filename else ""
+
def status_text(s):
# the reason phrase is one latin-1 line; make-request shows it to the user
return re.sub(r'[^\x20-\x7e]', '?', s)
@@ -75,14 +79,14 @@ class MyHandler(BaseHTTPRequestHandler):
error = log.last_log();
log.error("request_handler_server: [%s]: handle_request_main(..., %s) failed: %d %s" % (self.client_address[0], filename, status.value, status.phrase))
# send_error() ends the headers itself
- self.send_error(status, status_text("%s: request failed. %s" % (filename, error)))
+ self.send_error(status, status_text("%srequest failed. %s" % (about(filename), error)))
return
self.send_response(HTTPStatus.OK)
self.end_headers()
except Exception as e:
- self.send_error(HTTPStatus.INTERNAL_SERVER_ERROR, status_text("%s: %s" % (filename, e)))
+ self.send_error(HTTPStatus.INTERNAL_SERVER_ERROR, status_text("%s%s" % (about(filename), e)))
log.error("request_handler_server: [%s]: exception: %s\n%s" % (self.client_address[0], e, traceback.format_exc()))
raise
pass
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/ce9feb3c796ed049b6dd260a50d94d80feb1656d
More information about the pld-cvs-commit
mailing list