fix(web): make Server more consistent
This commit is contained in:
parent
6bb91ddba0
commit
243dfcaed0
@ -18,8 +18,6 @@ public class RequestHandler extends VirtualHostBranch implements HttpRequestHand
|
||||
}
|
||||
if (resp.getHeader("Cache-Control").isEmpty())
|
||||
resp.addHeader("Cache-Control", "no-cache");
|
||||
if (resp.getHeader("Server").isEmpty())
|
||||
resp.addHeader("Server", "LibWeb using BlueMapCore");
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,9 @@ public class HttpConnection implements Runnable {
|
||||
}
|
||||
|
||||
private void sendResponse(HttpResponse response) throws IOException {
|
||||
// Fill in missing headers
|
||||
if (response.getHeader("Server").isEmpty())
|
||||
response.addHeader("Server", "LibWeb using BlueMapCore");
|
||||
response.write(out);
|
||||
out.flush();
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ public class MainHttpHandlerImpl implements MainHttpHandler {
|
||||
try (ByteArrayInputStream is = new ByteArrayInputStream(request);
|
||||
HttpResponse response = JfWeb.getHandler().handle(HttpRequest.read(is))) {
|
||||
if (response.getStatusCode() == HttpStatusCode.NOT_FOUND) return null;
|
||||
// Fill in missing headers
|
||||
if (response.getHeader("Server").isEmpty())
|
||||
response.addHeader("Server", "LibWeb using MainHTTP");
|
||||
// Write and send response
|
||||
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
|
||||
response.write(os);
|
||||
|
Loading…
Reference in New Issue
Block a user