Issue #4033 - Addressing Lenient URIUtil decode behavior change in test

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-08-28 16:32:19 -05:00
parent f47115c585
commit 2fcb311c56
2 changed files with 8 additions and 12 deletions

View File

@ -690,17 +690,12 @@ public class HttpConnectionTest
@Test
public void testBadURIencoding() throws Exception
{
Log.getLogger(HttpParser.class).info("badMessage: bad encoding expected ...");
String response;
try (StacklessLogging stackless = new StacklessLogging(HttpParser.class))
{
response = connector.getResponse("GET /bad/encoding%1 HTTP/1.1\r\n" +
"Host: localhost\r\n" +
"Connection: close\r\n" +
"\r\n");
checkContains(response, 0, "HTTP/1.1 400");
}
// The URI is being leniently decoded, leaving the "%x" alone
String response = connector.getResponse("GET /bad/encoding%x HTTP/1.1\r\n" +
"Host: localhost\r\n" +
"Connection: close\r\n" +
"\r\n");
checkContains(response, 0, "HTTP/1.1 200");
}
@Test

View File

@ -1229,11 +1229,12 @@ public class URIUtil
}
}
// Don't match on encoded slash
if (ca == '/' && oa != ob)
return false;
if (ca != cb)
return URIUtil.decodePath(uriA).equals(URIUtil.decodePath(uriB));
return false;
}
return a == lenA && b == lenB;
}