Fixes: gh-5190
This commit is contained in:
parent
6095340e93
commit
afdefe7b13
|
@ -314,7 +314,7 @@ public class StrictHttpFirewall implements HttpFirewall {
|
|||
int length = uri.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = uri.charAt(i);
|
||||
if (c < '\u0021' || '\u007e' < c) {
|
||||
if (c < '\u0020' || c > '\u007e') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,6 +297,30 @@ public class StrictHttpFirewallTests {
|
|||
this.firewall.getFirewalledRequest(this.request);
|
||||
}
|
||||
|
||||
@Test(expected = RequestRejectedException.class)
|
||||
public void getFirewalledRequestWhenExceedsLowerboundAsciiThenException() {
|
||||
this.request.setRequestURI("/\u0019");
|
||||
this.firewall.getFirewalledRequest(this.request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFirewalledRequestWhenContainsLowerboundAsciiThenNoException() {
|
||||
this.request.setRequestURI("/ ");
|
||||
this.firewall.getFirewalledRequest(this.request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFirewalledRequestWhenContainsUpperboundAsciiThenNoException() {
|
||||
this.request.setRequestURI("/~");
|
||||
this.firewall.getFirewalledRequest(this.request);
|
||||
}
|
||||
|
||||
@Test(expected = RequestRejectedException.class)
|
||||
public void getFirewalledRequestWhenExceedsUpperboundAsciiThenException() {
|
||||
this.request.setRequestURI("/\u007f");
|
||||
this.firewall.getFirewalledRequest(this.request);
|
||||
}
|
||||
|
||||
// --- from DefaultHttpFirewallTests ---
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue