You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by sd...@apache.org on 2017/07/26 10:43:51 UTC
[2/2] struts git commit: WW-4818 added a couple of simple tests for
MULTIPART_FORM_DATA_REGEX
WW-4818 added a couple of simple tests for MULTIPART_FORM_DATA_REGEX
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/bbbe2a80
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/bbbe2a80
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/bbbe2a80
Branch: refs/heads/master
Commit: bbbe2a80356811ff4dbaa99da2417a067eb614cc
Parents: 68d52db
Author: Stefaan Dutry <st...@gmail.com>
Authored: Tue Jul 25 14:30:07 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Tue Jul 25 14:30:07 2017 +0200
----------------------------------------------------------------------
.../struts2/dispatcher/DispatcherTest.java | 26 ++++++++++++++++++++
1 file changed, 26 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/bbbe2a80/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
index 0f430de..4f043cb 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
@@ -146,6 +146,32 @@ public class DispatcherTest extends StrutsInternalTestCase {
assertTrue(wrapped instanceof MultiPartRequestWrapper);
}
+ public void testPrepareMultipartRequestAllAllowedCharacters() throws Exception {
+ MockHttpServletRequest req = new MockHttpServletRequest();
+ MockHttpServletResponse res = new MockHttpServletResponse();
+
+ req.setMethod("post");
+ req.setContentType("multipart/form-data; boundary=01=23a.bC:D((e)d'z?p+o_r,e-");
+ Dispatcher du = initDispatcher(Collections.<String, String>emptyMap());
+ du.prepare(req, res);
+ HttpServletRequest wrapped = du.wrapRequest(req);
+
+ assertTrue(wrapped instanceof MultiPartRequestWrapper);
+ }
+
+ public void testPrepareMultipartRequestIllegalCharacter() throws Exception {
+ MockHttpServletRequest req = new MockHttpServletRequest();
+ MockHttpServletResponse res = new MockHttpServletResponse();
+
+ req.setMethod("post");
+ req.setContentType("multipart/form-data; boundary=01=2;3a.bC:D((e)d'z?p+o_r,e-");
+ Dispatcher du = initDispatcher(Collections.<String, String>emptyMap());
+ du.prepare(req, res);
+ HttpServletRequest wrapped = du.wrapRequest(req);
+
+ assertFalse(wrapped instanceof MultiPartRequestWrapper);
+ }
+
public void testDispatcherListener() throws Exception {
final DispatcherListenerState state = new DispatcherListenerState();