@@ -1013,75 +1013,6 @@ public void testUTF8EncodedForm() throws Exception
1013
1013
assertThat (response , containsString (" 200 OK" ));
1014
1014
}
1015
1015
1016
- @ Test
1017
- @ Disabled ("See issue #1175" )
1018
- public void testMultiPartFormDataReadInputThenParams () throws Exception
1019
- {
1020
- final File tmpdir = MavenTestingUtils .getTargetTestingDir ("multipart" );
1021
- FS .ensureEmpty (tmpdir );
1022
-
1023
- Handler handler = new AbstractHandler ()
1024
- {
1025
- @ Override
1026
- public void handle (String target , Request baseRequest , HttpServletRequest request , HttpServletResponse response ) throws IOException
1027
- {
1028
- if (baseRequest .getDispatcherType () != DispatcherType .REQUEST )
1029
- return ;
1030
-
1031
- // Fake a @MultiPartConfig'd servlet endpoint
1032
- MultipartConfigElement multipartConfig = new MultipartConfigElement (tmpdir .getAbsolutePath ());
1033
- request .setAttribute (Request .__MULTIPART_CONFIG_ELEMENT , multipartConfig );
1034
-
1035
- // Normal processing
1036
- baseRequest .setHandled (true );
1037
-
1038
- // Fake the commons-fileupload behavior
1039
- int length = request .getContentLength ();
1040
- InputStream in = request .getInputStream ();
1041
- ByteArrayOutputStream out = new ByteArrayOutputStream ();
1042
- IO .copy (in , out , length ); // KEY STEP (Don't Change!) commons-fileupload does not read to EOF
1043
-
1044
- // Record what happened as servlet response headers
1045
- response .setIntHeader ("x-request-content-length" , request .getContentLength ());
1046
- response .setIntHeader ("x-request-content-read" , out .size ());
1047
- String foo = request .getParameter ("foo" ); // uri query parameter
1048
- String bar = request .getParameter ("bar" ); // form-data content parameter
1049
- response .setHeader ("x-foo" , foo == null ? "null" : foo );
1050
- response .setHeader ("x-bar" , bar == null ? "null" : bar );
1051
- }
1052
- };
1053
-
1054
- _server .stop ();
1055
- _server .setHandler (handler );
1056
- _server .start ();
1057
-
1058
- String multipart = "--AaBbCc\r \n " +
1059
- "content-disposition: form-data; name=\" bar\" \r \n " +
1060
- "\r \n " +
1061
- "BarContent\r \n " +
1062
- "--AaBbCc\r \n " +
1063
- "content-disposition: form-data; name=\" stuff\" \r \n " +
1064
- "Content-Type: text/plain;charset=ISO-8859-1\r \n " +
1065
- "\r \n " +
1066
- "000000000000000000000000000000000000000000000000000\r \n " +
1067
- "--AaBbCc--\r \n " ;
1068
-
1069
- String request = "POST /?foo=FooUri HTTP/1.1\r \n " +
1070
- "Host: whatever\r \n " +
1071
- "Content-Type: multipart/form-data; boundary=\" AaBbCc\" \r \n " +
1072
- "Content-Length: " + multipart .getBytes ().length + "\r \n " +
1073
- "Connection: close\r \n " +
1074
- "\r \n " +
1075
- multipart ;
1076
-
1077
- HttpTester .Response response = HttpTester .parseResponse (_connector .getResponse (request ));
1078
-
1079
- // It should always be possible to read query string
1080
- assertThat ("response.x-foo" , response .get ("x-foo" ), is ("FooUri" ));
1081
- // Not possible to read request content parameters?
1082
- assertThat ("response.x-bar" , response .get ("x-bar" ), is ("null" )); // TODO: should this work?
1083
- }
1084
-
1085
1016
@ Test
1086
1017
public void testPartialRead () throws Exception
1087
1018
{
0 commit comments