]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Another try to fix goddamned dummy http server
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 19 Nov 2022 15:37:06 +0000 (15:37 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 19 Nov 2022 15:37:06 +0000 (15:37 +0000)
test/functional/util/dummy_http.py

index 2ad4dcd402a546d070ed3902b9349f2e2534463e..6ca084403a520455f727b65895e60c437814f394 100755 (executable)
@@ -70,8 +70,9 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
     def do_POST(self):
         """Respond to a POST request."""
         response = b"hello post"
-        content_length = int(self.headers['Content-Length'])
-        body = self.rfile.read(content_length)
+        content_length = int(self.headers.get('Content-Length', "0")) or 0
+        if content_length > 0:
+            _ = self.rfile.read(content_length)
         if self.path == "/empty":
             self.finish()
             return