JETTY-1527 handle requests with URIs like http://host (ie no / )
This commit is contained in:
parent
4d889de159
commit
c998abc8bc
|
@ -439,7 +439,12 @@ public abstract class AbstractHttpConnection extends AbstractConnection
|
|||
_uri.getPort();
|
||||
info=URIUtil.canonicalPath(_uri.getDecodedPath());
|
||||
if (info==null && !_request.getMethod().equals(HttpMethods.CONNECT))
|
||||
throw new HttpException(400);
|
||||
{
|
||||
if (_uri.getScheme()!=null && _uri.getHost()!=null)
|
||||
info="/";
|
||||
else
|
||||
throw new HttpException(400);
|
||||
}
|
||||
_request.setPathInfo(info);
|
||||
|
||||
if (_out!=null)
|
||||
|
|
|
@ -110,6 +110,19 @@ public class HttpConnectionTest
|
|||
System.err.println(response);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoPath() throws Exception
|
||||
{
|
||||
String response=connector.getResponses("GET http://localhost:80 HTTP/1.1\n"+
|
||||
"Host: localhost:80\n"+
|
||||
"\n");
|
||||
|
||||
int offset=0;
|
||||
offset = checkContains(response,offset,"HTTP/1.1 200");
|
||||
checkContains(response,offset,"pathInfo=/");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEmpty() throws Exception
|
||||
|
|
Loading…
Reference in New Issue