mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-01 06:33:38 +01:00
Another attempt to make server conform http.
This commit is contained in:
parent
ad33ef79d9
commit
eb276dd59d
@ -186,9 +186,11 @@ public class HttpServerConnection extends Thread {
|
|||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String connection = response.fields.get("Connection");
|
boolean isKeepalive = !"close".equals(request.fields.get(HttpField.Connection)) && !"close".equals(response.fields.get(HttpField.Connection));
|
||||||
|
|
||||||
String contentLength = response.fields.get("Content-Length");
|
String contentLength = response.fields.get("Content-Length");
|
||||||
if (contentLength == null && connection == null) {
|
if (isKeepalive && contentLength == null) {
|
||||||
|
// A handler has been a bad boy, but we're here to fix it.
|
||||||
response.fields.put("Content-Length", "0");
|
response.fields.put("Content-Length", "0");
|
||||||
OutputStream responseBody = response.getBody();
|
OutputStream responseBody = response.getBody();
|
||||||
|
|
||||||
@ -201,7 +203,7 @@ public class HttpServerConnection extends Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection != null && connection.equals("close")) {
|
if (!isKeepalive) {
|
||||||
out.flush();
|
out.flush();
|
||||||
socket.close();
|
socket.close();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user