mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-04 07:28:26 +01:00
HEAD response no longer sends response body
Affects issues: - Fixed #1431
This commit is contained in:
parent
bc7e84677f
commit
788e6dc195
@ -45,13 +45,24 @@ public class ResponseSender {
|
|||||||
|
|
||||||
public void send() throws IOException {
|
public void send() throws IOException {
|
||||||
setResponseHeaders();
|
setResponseHeaders();
|
||||||
if ("bytes".equalsIgnoreCase(response.getHeaders().get("Accept-Ranges"))) {
|
if ("HEAD".equals(exchange.getRequestMethod())) {
|
||||||
|
sendHeadResponse();
|
||||||
|
} else if ("bytes".equalsIgnoreCase(response.getHeaders().get("Accept-Ranges"))) {
|
||||||
sendRawBytes();
|
sendRawBytes();
|
||||||
} else {
|
} else {
|
||||||
sendCompressed();
|
sendCompressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendHeadResponse() throws IOException {
|
||||||
|
try {
|
||||||
|
exchange.getResponseHeaders().remove("Content-Length");
|
||||||
|
beginSend();
|
||||||
|
} finally {
|
||||||
|
exchange.getRequestBody().close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setResponseHeaders() {
|
private void setResponseHeaders() {
|
||||||
Headers headers = exchange.getResponseHeaders();
|
Headers headers = exchange.getResponseHeaders();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user