Sending headers to GET, HEAD handling fixed
This commit is contained in:
parent
0f7b7e7096
commit
c33aee426a
2 changed files with 2 additions and 1 deletions
|
@ -32,7 +32,7 @@ public class IOHelper {
|
|||
|
||||
public static void SendResponse(int code, String content, HttpExchange exchange) throws IOException {
|
||||
if (exchange.getRequestMethod().equalsIgnoreCase("HEAD")) {
|
||||
exchange.sendResponseHeaders(code, 0);
|
||||
exchange.sendResponseHeaders(code, -1); // -1 indicates no data
|
||||
exchange.getResponseBody().close();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ public class BridgePage extends Page {
|
|||
s = getSocket(exchange);
|
||||
if (s == null)
|
||||
return new Response(400, "No connection", exchange);
|
||||
exchange.sendResponseHeaders(200, 0); // Chunked transfer, any amount of data
|
||||
IOUtils.copy(s.getInputStream(), exchange.getResponseBody());
|
||||
exchange.getResponseBody().close(); // TODO: Keep open?
|
||||
return null; // Response already sen
|
||||
|
|
Loading…
Reference in a new issue