Let's try flushing

The bad packet error is gone now, but it times out
This commit is contained in:
Norbi Peti 2018-01-06 01:16:45 +01:00
parent c33aee426a
commit fee4292d3b
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -42,6 +42,7 @@ public class BridgePage extends Page {
if (s == null) if (s == null)
return new Response(400, "No connection", exchange); return new Response(400, "No connection", exchange);
IOUtils.copy(exchange.getRequestBody(), s.getOutputStream()); IOUtils.copy(exchange.getRequestBody(), s.getOutputStream());
s.getOutputStream().flush();
return new Response(200, "OK", exchange); return new Response(200, "OK", exchange);
case "GET": case "GET":
s = getSocket(exchange); s = getSocket(exchange);
@ -49,6 +50,7 @@ public class BridgePage extends Page {
return new Response(400, "No connection", exchange); return new Response(400, "No connection", exchange);
exchange.sendResponseHeaders(200, 0); // Chunked transfer, any amount of data exchange.sendResponseHeaders(200, 0); // Chunked transfer, any amount of data
IOUtils.copy(s.getInputStream(), exchange.getResponseBody()); IOUtils.copy(s.getInputStream(), exchange.getResponseBody());
exchange.getResponseBody().flush();
exchange.getResponseBody().close(); // TODO: Keep open? exchange.getResponseBody().close(); // TODO: Keep open?
return null; // Response already sen return null; // Response already sen
case "DELETE": case "DELETE":