diff --git a/VERSION.txt b/VERSION.txt index af823a779fe..8bda2e21826 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,4 @@ -jetty-7.0.1.v20091123 23 November 2009 +jetty-7.0.1.v20091125 25 November 2009 + 274251 DefaultServlet supports exact match mode. + 288401 HttpExchange.cancel() Method Unimplemented + 289027 deobfuscate HttpClient SSL passwords diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java index e12e4096607..560543218da 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java @@ -69,6 +69,8 @@ public abstract class AbstractGenerator implements Generator protected Buffer _buffer; // Buffer for copy of passed _content protected Buffer _content; // Buffer passed to addContent + protected Buffer _date; + private boolean _sendServerVersion; @@ -105,6 +107,7 @@ public abstract class AbstractGenerator implements Generator _close = false; _contentWritten = 0; _contentLength = HttpTokens.UNKNOWN_CONTENT; + _date = null; // always return the buffer if (_buffer!=null) @@ -278,6 +281,15 @@ public abstract class AbstractGenerator implements Generator return _version; } + /* ------------------------------------------------------------ */ + /** + * @see org.eclipse.jetty.http.Generator#setDate(org.eclipse.jetty.io.Buffer) + */ + public void setDate(Buffer timeStampBuffer) + { + _date=timeStampBuffer; + } + /* ------------------------------------------------------------ */ /** */ diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java index 690c30acdbf..a3c6fd8f53d 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java @@ -90,6 +90,8 @@ public interface Generator void setContentLength(long length); void setPersistent(boolean persistent); + + void setDate(Buffer timeStampBuffer); } diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java index 14210297c04..696cc6b65a8 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java @@ -469,6 +469,14 @@ public class HttpGenerator extends AbstractGenerator } // Add headers + if (_status>=200 && _date!=null) + { + _header.put(HttpHeaders.DATE_BUFFER); + _header.put((byte)':'); + _header.put((byte)' '); + _header.put(_date); + _header.put(CRLF); + } // key field values HttpFields.Field content_length = null; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java index 5bde2ff1f40..3baae373c9a 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java @@ -963,7 +963,7 @@ public class HttpConnection implements Connection _generator.setHead(_head); if (_server.getSendDateHeader()) - _responseFields.put(HttpHeaders.DATE_BUFFER, _request.getTimeStampBuffer(),_request.getTimeStamp()); + _generator.setDate(_request.getTimeStampBuffer()); if (!_host) { diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index 6c9fe249795..cc9a52771b7 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -1018,12 +1018,6 @@ public class Response implements HttpServletResponse } } } - - if (_connection.getConnector().getServer().getSendDateHeader()) - { - Request request=_connection.getRequest(); - response_fields.put(HttpHeaders.DATE_BUFFER, request.getTimeStampBuffer(),request.getTimeStamp()); - } } /* ------------------------------------------------------------ */ diff --git a/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java b/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java index c613c2ecc28..eeb1a0b3790 100644 --- a/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java +++ b/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java @@ -39,6 +39,7 @@ public class TestServer System.setProperty("jetty.home",jetty_home); Server server = new Server(); + server.setSendDateHeader(true); // Setup JMX MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer());