Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.
This commit is contained in:
commit
605aadba59
|
@ -112,7 +112,7 @@ public abstract class HttpConnection implements Connection
|
|||
}
|
||||
|
||||
// If we are HTTP 1.1, add the Host header
|
||||
if (version.getVersion() == 11)
|
||||
if (version.getVersion() <= 11)
|
||||
{
|
||||
if (!headers.containsKey(HttpHeader.HOST.asString()))
|
||||
headers.put(getHttpDestination().getHostField());
|
||||
|
|
|
@ -1582,8 +1582,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCopyRequest()
|
||||
throws Exception
|
||||
public void testCopyRequest() throws Exception
|
||||
{
|
||||
startClient();
|
||||
|
||||
|
@ -1630,6 +1629,28 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
.header("X-Custom-Header-2", "value"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHostWithHTTP10() throws Exception
|
||||
{
|
||||
start(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
Assert.assertThat(request.getHeader("Host"), Matchers.notNullValue());
|
||||
}
|
||||
});
|
||||
|
||||
ContentResponse response = client.newRequest("localhost", connector.getLocalPort())
|
||||
.scheme(scheme)
|
||||
.version(HttpVersion.HTTP_1_0)
|
||||
.timeout(5, TimeUnit.SECONDS)
|
||||
.send();
|
||||
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
}
|
||||
|
||||
private void assertCopyRequest(Request original)
|
||||
{
|
||||
Request copy = client.copyRequest((HttpRequest) original, original.getURI());
|
||||
|
|
Loading…
Reference in New Issue