jetty-9 some post merge fixes

This commit is contained in:
Greg Wilkins 2012-08-18 10:37:09 +10:00
parent 6ffaa478c4
commit 2900b4df02
4 changed files with 36 additions and 16 deletions

View File

@ -139,6 +139,7 @@ public class FormAuthenticator extends LoginAuthenticator
}
/* ------------------------------------------------------------ */
@Override
public String getAuthMethod()
{
return Constraint.__FORM_AUTH;
@ -182,6 +183,7 @@ public class FormAuthenticator extends LoginAuthenticator
}
/* ------------------------------------------------------------ */
@Override
public Authentication validateRequest(ServletRequest req, ServletResponse res, boolean mandatory) throws ServerAuthException
{
HttpServletRequest request = (HttpServletRequest)req;
@ -366,6 +368,7 @@ public class FormAuthenticator extends LoginAuthenticator
}
/* ------------------------------------------------------------ */
@Override
public boolean secureResponse(ServletRequest req, ServletResponse res, boolean mandatory, User validatedUser) throws ServerAuthException
{
return true;

View File

@ -433,7 +433,23 @@ public abstract class HttpChannel
else
_uri.parse(uri);
_request.setUri(_uri);
_request.setPathInfo(_uri.getDecodedPath());
String path = null;
try
{
path = _uri.getDecodedPath();
}
catch (Exception e)
{
LOG.warn("Failed UTF-8 decode for request path, trying ISO-8859-1");
LOG.ignore(e);
path = _uri.getDecodedPath(StringUtil.__ISO_8859_1);
}
String info=URIUtil.canonicalPath(path);
if (info==null)
info="/";
_request.setPathInfo(info);
_version=version==null?HttpVersion.HTTP_0_9:version;
_request.setHttpVersion(_version);

View File

@ -132,6 +132,7 @@ public class HttpConnectionTest
{
String response=connector.getResponses("GET http://localhost:80 HTTP/1.1\n"+
"Host: localhost:80\n"+
"Connection: close\n"+
"\n");
int offset=0;
@ -198,18 +199,18 @@ public class HttpConnectionTest
"Connection: close\n"+
"\015\012");
checkContains(response,0,"HTTP/1.1 400");
response=connector.getResponses("GET % HTTP/1.1\n"+
response=connector.getResponses("GET /foo/bar%c0%00 HTTP/1.1\n"+
"Host: localhost\n"+
"Connection: close\n"+
"\015\012");
checkContains(response,0,"HTTP/1.1 200"); //now fallback to iso-8859-1
response=connector.getResponses("GET /bad/utf8%c1 HTTP/1.1\n"+
"Host: localhost\n"+
"Connection: close\n"+
checkContains(response,0,"HTTP/1.1 200"); //now fallback to iso-8859-1
response=connector.getResponses("GET /bad/utf8%c1 HTTP/1.1\n"+
"Host: localhost\n"+
"Connection: close\n"+
"\015\012");
checkContains(response,0,"HTTP/1.1 200"); //now fallback to iso-8859-1
checkContains(response,0,"HTTP/1.1 200"); //now fallback to iso-8859-1
}
@Test

View File

@ -93,17 +93,17 @@ public class StdErrLogTest
before.debug("testing {} {}","test","debug-before-false");
log.debug("testing {} {}","test","debug-deprecated-false");
after.debug("testing {} {}","test","debug-after-false");
output.assertContains("DBUG:xxx:tname: testing test debug");
output.assertContains("INFO:xxx:tname: testing test info");
output.assertContains("WARN:xxx:tname: testing test warn");
output.assertNotContains("YOU SHOULD NOT SEE THIS!");
output.assertContains("DBUG:x.before:tname:testing test debug-before");
output.assertNotContains("DBUG:xxx:tname: testing test debug-depdeprecated-false");
output.assertContains("DBUG:x.after:testing test debug-after");
output.assertNotContains("DBUG:x.before:tname:testing test debug-before-false");
output.assertNotContains("DBUG:xxx:tname:testing test debug-deprecated-false");
output.assertNotContains("DBUG:x.after:tname:testing test debug-after-false");
output.assertContains("DBUG:x.before:tname: testing test debug-before");
output.assertContains("DBUG:xxx:tname: testing test debug-deprecated");
output.assertContains("DBUG:x.after:tname: testing test debug-after");
output.assertNotContains("DBUG:x.before:tname: testing test debug-before-false");
output.assertNotContains("DBUG:xxx:tname: testing test debug-deprecated-false");
output.assertNotContains("DBUG:x.after:tname: testing test debug-after-false");
}
@Test