Skip to content

Commit cf66af9

Browse files
committed
Fixed bug with large responses not being fully sent by TACO web tool server
1 parent 4cbd58f commit cf66af9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/taco_server.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,19 @@ def do_POST(self):
6969
except:
7070
self.send_response(400)
7171

72+
response = str.encode(json.dumps(response))
73+
lenResponse = len(response)
74+
7275
self.send_header('Access-Control-Allow-Origin', '*')
7376
self.send_header('Content-type', 'application/json')
77+
self.send_header('Content-Length', lenResponse)
7478
self.end_headers()
7579

76-
self.wfile.write(str.encode(json.dumps(response)))
80+
i = 0
81+
while i < lenResponse:
82+
end = min(i + 10000, lenResponse)
83+
self.wfile.write(response[i:end])
84+
i = end
7785

7886
class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
7987
def finish_request(self, request, client_address):

0 commit comments

Comments
 (0)