JETTY-1112 Response fails if header exceeds buffer size

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@907 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Jan Bartel 2009-09-16 01:37:26 +00:00
parent b01763dc9a
commit 96c4c1ee7f
3 changed files with 61 additions and 2 deletions

View File

@ -6,8 +6,9 @@ jetty-7.0.1-SNAPSHOT
+ 289027 deobfuscate HttpClient SSL passwords
jetty-7.0.0.RC6-SNAPSHOT
+ JETTY-936 274251 Improved servlet matching and optimized'
+ JETTY-719 Document state machine of jetty http client
+ JETTY-780 CNFE during startup of webapp with spring-context >= 2.5.1
+ JETTY-936 274251 Improved servlet matching and optimized'
+ JETTY-1080 modify previous fix to work on windows
+ JETTY-1084 HEAD command not setting content-type in response under certain circumstances
+ JETTY-1086 Use UncheckedPrintWriter
@ -18,6 +19,7 @@ jetty-7.0.0.RC6-SNAPSHOT
+ JETTY-1101 Updated servlet3 continuation constructor
+ JETTY-1105 Custom error pages aren't working
+ JETTY-1108 SSL EOF detection
+ JETTY-1112 Response fails if header exceeds buffer size
+ 280723 Add non blocking statistics handler
+ 282543 HttpClient SSL buffer size fix
+ 283357 org.eclipse.jetty.server.HttpConnectionTest exceptions
@ -29,7 +31,6 @@ jetty-7.0.0.RC6-SNAPSHOT
+ 289146 formalize reload policy functionality
+ 289156 jetty-client: no longer throw runtime exception for bad authn details
+ 288182 PUT request fails during retry
+ JETTY-719 Document state machine of jetty http client
+ 289221 HttpExchange does not timeout when using blocking connector
jetty-6.1.20 27 August 2009

View File

@ -668,6 +668,7 @@ public class HttpConnection implements Connection
_generator.reset(true);
_generator.setResponse(HttpStatus.INTERNAL_SERVER_ERROR_500,null);
_generator.completeHeader(_responseFields,HttpGenerator.LAST);
_generator.complete();
throw new HttpException(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@ -699,6 +700,7 @@ public class HttpConnection implements Connection
_generator.reset(true);
_generator.setResponse(HttpStatus.INTERNAL_SERVER_ERROR_500,null);
_generator.completeHeader(_responseFields,HttpGenerator.LAST);
_generator.complete();
throw new HttpException(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
}

View File

@ -19,6 +19,16 @@
*/
package org.eclipse.jetty.server;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpHeaders;
import org.eclipse.jetty.http.MimeTypes;
import junit.framework.TestCase;
/**
@ -288,6 +298,52 @@ public class HttpConnectionTest extends TestCase
}
}
public void testOversizedResponse ()
throws Exception
{
String str = "thisisastringthatshouldreachover1kbytes";
for (int i=0;i<400;i++)
str+="xxxxxxxxxxxx";
final String longstr = str;
String response = null;
server.stop();
server.setHandler(new DumpHandler()
{
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
baseRequest.setHandled(true);
response.setHeader(HttpHeaders.CONTENT_TYPE,MimeTypes.TEXT_HTML);
response.setHeader("LongStr", longstr);
PrintWriter writer = response.getWriter();
writer.write("<html><h1>FOO</h1></html>");
writer.flush();
writer.close();
}
});
server.start();
try
{
int offset = 0;
response = connector.getResponses("GET / HTTP/1.1\n"+
"Host: localhost\n" +
"\015\012"
);
offset = checkContains(response, offset, "HTTP/1.1 500");
}
catch(Exception e)
{
e.printStackTrace();
if(response != null)
System.err.println(response);
fail("Exception");
}
}
public void testAsterisk()
{