修复WebSocket中Connection重复的bug
This commit is contained in:
@@ -894,16 +894,18 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
buffer.put(("HTTP/1.1 " + this.status + " " + httpCodes.get(this.status) + "\r\n").getBytes());
|
buffer.put(("HTTP/1.1 " + this.status + " " + httpCodes.get(this.status) + "\r\n").getBytes());
|
||||||
}
|
}
|
||||||
if (this.contentLength >= 0) buffer.put(("Content-Length: " + this.contentLength + "\r\n").getBytes());
|
if (this.contentLength >= 0) buffer.put(("Content-Length: " + this.contentLength + "\r\n").getBytes());
|
||||||
if (this.contentType == this.jsonContentType) {
|
|
||||||
buffer.put(this.jsonContentTypeBytes);
|
|
||||||
} else if (this.contentType == null || this.contentType == this.plainContentType) {
|
|
||||||
buffer.put(this.plainContentTypeBytes);
|
|
||||||
} else {
|
|
||||||
buffer.put(("Content-Type: " + (this.contentType == null ? this.plainContentType : this.contentType) + "\r\n").getBytes());
|
|
||||||
}
|
|
||||||
buffer.put(serverNameBytes);
|
buffer.put(serverNameBytes);
|
||||||
if (dateSupplier != null) buffer.put(dateSupplier.get());
|
if (dateSupplier != null) buffer.put(dateSupplier.get());
|
||||||
buffer.put(this.request.isKeepAlive() ? connectAliveBytes : connectCloseBytes);
|
if (!request.isWebSocket()) {
|
||||||
|
if (this.contentType == this.jsonContentType) {
|
||||||
|
buffer.put(this.jsonContentTypeBytes);
|
||||||
|
} else if (this.contentType == null || this.contentType == this.plainContentType) {
|
||||||
|
buffer.put(this.plainContentTypeBytes);
|
||||||
|
} else {
|
||||||
|
buffer.put(("Content-Type: " + (this.contentType == null ? this.plainContentType : this.contentType) + "\r\n").getBytes());
|
||||||
|
}
|
||||||
|
buffer.put(this.request.isKeepAlive() ? connectAliveBytes : connectCloseBytes);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.defaultAddHeaders != null) {
|
if (this.defaultAddHeaders != null) {
|
||||||
for (String[] headers : this.defaultAddHeaders) {
|
for (String[] headers : this.defaultAddHeaders) {
|
||||||
|
|||||||
Reference in New Issue
Block a user