Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project
This commit is contained in:
commit
7235751873
13
README.txt
13
README.txt
|
@ -3,8 +3,8 @@ This is a source checkout of the Jetty webserver.
|
|||
|
||||
To build, use:
|
||||
|
||||
mvn install
|
||||
|
||||
mvn clean install
|
||||
|
||||
The jetty distribution will be built in
|
||||
|
||||
jetty-distribution/target/distribution
|
||||
|
@ -12,8 +12,11 @@ The jetty distribution will be built in
|
|||
The first build may take a long time as Maven downloads all the
|
||||
dependencies.
|
||||
|
||||
The tests do a lot of stress testing, and on some machines it is
|
||||
The tests do a lot of stress testing, and on some machines it is
|
||||
necessary to set the file descriptor limit to greater than 2048
|
||||
for the tests to all pass successfully.
|
||||
for the tests to all pass successfully.
|
||||
|
||||
Bypass tests by building with -Dmaven.test.skip=true but note
|
||||
that this will not produce some test jars that are leveraged
|
||||
in other places in the build.
|
||||
|
||||
Bypass tests by building with -Dmaven.test.skip=true but note that this will not produce some test jars that are leveraged in other places in the build.
|
||||
|
|
|
@ -223,8 +223,21 @@ public class ConnectHandler extends HandlerWrapper
|
|||
return;
|
||||
}
|
||||
|
||||
SocketChannel channel = connectToServer(request, host, port);
|
||||
SocketChannel channel;
|
||||
|
||||
try
|
||||
{
|
||||
channel = connectToServer(request, host, port);
|
||||
}
|
||||
catch ( IOException ioe )
|
||||
{
|
||||
LOG.info("ConnectHandler: " + ioe.getMessage());
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
baseRequest.setHandled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Transfer unread data from old connection to new connection
|
||||
// We need to copy the data to avoid races:
|
||||
// 1. when this unread data is written and the server replies before the clientToProxy
|
||||
|
@ -304,9 +317,15 @@ public class ConnectHandler extends HandlerWrapper
|
|||
return new ProxyToServerConnection(context, buffer);
|
||||
}
|
||||
|
||||
// may return null
|
||||
private SocketChannel connectToServer(HttpServletRequest request, String host, int port) throws IOException
|
||||
{
|
||||
SocketChannel channel = connect(request, host, port);
|
||||
if ( channel == null )
|
||||
{
|
||||
throw new IOException("unable to connector to " + host + ":" + port);
|
||||
}
|
||||
|
||||
channel.configureBlocking(false);
|
||||
return channel;
|
||||
}
|
||||
|
|
|
@ -104,6 +104,35 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCONNECTBadHostPort() throws Exception
|
||||
{
|
||||
String hostPort = "badlocalhost:" + serverConnector.getLocalPort();
|
||||
String request = "" +
|
||||
"CONNECT " + hostPort + " HTTP/1.1\r\n" +
|
||||
"Host: " + hostPort + "\r\n" +
|
||||
"\r\n";
|
||||
Socket socket = newSocket();
|
||||
socket.setSoTimeout(30000);
|
||||
try
|
||||
{
|
||||
OutputStream output = socket.getOutputStream();
|
||||
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
|
||||
|
||||
output.write(request.getBytes("UTF-8"));
|
||||
output.flush();
|
||||
|
||||
// Expect 500 OK from the CONNECT request
|
||||
Response response = readResponse(input);
|
||||
assertEquals("500", response.getCode());
|
||||
}
|
||||
finally
|
||||
{
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCONNECT10AndGET() throws Exception
|
||||
{
|
||||
|
@ -355,6 +384,14 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
|
|||
@Test
|
||||
public void testCONNECTAndPOSTWithBigBody() throws Exception
|
||||
{
|
||||
// fails under windows and occasionally on mac due to OOME
|
||||
boolean stress = Boolean.getBoolean( "STRESS" );
|
||||
|
||||
if (!stress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Log.getLogger(ConnectHandler.class).setDebugEnabled(true);
|
||||
String hostPort = "localhost:" + serverConnector.getLocalPort();
|
||||
String request = "" +
|
||||
|
|
Loading…
Reference in New Issue