@@ -77,48 +77,6 @@ public void testServlet() throws Exception {
7777 }
7878
7979
80- @ Test
81- public void testLargeDocumentLastModifiedHeader () throws Exception {
82- // A document larger than the response buffer commits the unbuffered
83- // response while the output is being generated. The Last-Modified
84- // header must be set before that happens.
85- Tomcat tomcat = getTomcatInstance ();
86-
87- File appDir = new File (getTemporaryDirectory (), "ssi-large" );
88- Assert .assertTrue (appDir .mkdirs () || appDir .isDirectory ());
89- addDeleteOnTearDown (appDir );
90- File doc = new File (appDir , "large.shtml" );
91- try (Writer writer = new OutputStreamWriter (new FileOutputStream (doc ), StandardCharsets .ISO_8859_1 )) {
92- writer .write ("X" .repeat (20000 ));
93- writer .write ("<!--#flastmod file=\" large.shtml\" -->TAIL" );
94- }
95-
96- Context ctxt = tomcat .addContext ("" , appDir .getAbsolutePath ());
97- Tomcat .addServlet (ctxt , "ssi" , new SSIServlet ());
98- ctxt .addServletMapping ("*.shtml" , "ssi" );
99-
100- tomcat .start ();
101-
102- Map <String ,List <String >> resHeaders = new HashMap <>();
103- String path = "http://localhost:" + getPort () + "/large.shtml" ;
104- ByteChunk out = new ByteChunk ();
105-
106- int rc = getUrl (path , out , resHeaders );
107- Assert .assertEquals (HttpServletResponse .SC_OK , rc );
108- String body = new String (out .getBuffer (), 0 , out .getLength (), StandardCharsets .ISO_8859_1 );
109- Assert .assertTrue (body .endsWith ("TAIL" ));
110- // Headers are case-insensitive. SSIServlet uses the lower-case name.
111- String lastModified = null ;
112- for (Map .Entry <String ,List <String >> header : resHeaders .entrySet ()) {
113- if ("Last-Modified" .equalsIgnoreCase (header .getKey ())) {
114- Assert .assertEquals (1 , header .getValue ().size ());
115- lastModified = header .getValue ().get (0 );
116- }
117- }
118- Assert .assertNotNull (lastModified );
119- }
120-
121-
12280 @ Test
12381 public void testBadConditionalExpressionReportsError () throws Exception {
12482 // A conditional directive with an expression that cannot be parsed
0 commit comments