diff --git a/src/org/redkale/net/http/HttpResponse.java b/src/org/redkale/net/http/HttpResponse.java index bbc78b839..1f85089af 100644 --- a/src/org/redkale/net/http/HttpResponse.java +++ b/src/org/redkale/net/http/HttpResponse.java @@ -50,6 +50,10 @@ public class HttpResponse extends Response { protected static final byte[] connectAliveBytes = "Connection: keep-alive\r\n".getBytes(); + private static final byte[] fillContentLengthBytes = ("Content-Length: \r\n").getBytes(); + + private static final ZoneId ZONE_GMT = ZoneId.of("GMT"); + private static final Set options = new HashSet<>(); private static final Map httpCodes = new HashMap<>(); @@ -103,10 +107,6 @@ public class HttpResponse extends Response { httpCodes.put(505, "HTTP Version Not Supported"); } - private static final ZoneId ZONE_GMT = ZoneId.of("GMT"); - - private static final byte[] LENG_BYTES = ("Content-Length: \r\n").getBytes(); - private int status = 200; private String contentType = ""; @@ -930,7 +930,7 @@ public class HttpResponse extends Response { if (this.contentLength >= 0) { buffer.put(("Content-Length: " + this.contentLength + "\r\n").getBytes()); } else if (this.contentLength == -2) { - buffer.put(LENG_BYTES); + buffer.put(fillContentLengthBytes); this.headLenPos = buffer.position() - 2; //去掉\r\n } if (!this.request.isWebSocket()) {