397111 Allow multipart bodies with leading blank lines
Also trim any leading space from FIRST boundary
This commit is contained in:
parent
c9135e34c9
commit
0420365f82
|
@ -151,6 +151,7 @@ public class MultiPartFilter implements Filter
|
||||||
if (line == null || line.length() == 0)
|
if (line == null || line.length() == 0)
|
||||||
throw new IOException("Missing content for multipart request");
|
throw new IOException("Missing content for multipart request");
|
||||||
|
|
||||||
|
line = line.trim();
|
||||||
boolean badFormatLogged = false;
|
boolean badFormatLogged = false;
|
||||||
while (line != null && !line.equals(boundary))
|
while (line != null && !line.equals(boundary))
|
||||||
{
|
{
|
||||||
|
@ -160,6 +161,7 @@ public class MultiPartFilter implements Filter
|
||||||
badFormatLogged = true;
|
badFormatLogged = true;
|
||||||
}
|
}
|
||||||
line=((ReadLineInputStream)in).readLine();
|
line=((ReadLineInputStream)in).readLine();
|
||||||
|
line=(line==null?line:line.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line == null || line.length() == 0)
|
if (line == null || line.length() == 0)
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class MultipartFilterTest
|
||||||
@Override
|
@Override
|
||||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
|
||||||
{
|
{
|
||||||
|
System.err.println(req.getParameter("field1"));
|
||||||
assertNotNull(req.getParameter("fileup"));
|
assertNotNull(req.getParameter("fileup"));
|
||||||
assertNotNull(req.getParameter("fileup"+MultiPartFilter.CONTENT_TYPE_SUFFIX));
|
assertNotNull(req.getParameter("fileup"+MultiPartFilter.CONTENT_TYPE_SUFFIX));
|
||||||
assertEquals(req.getParameter("fileup"+MultiPartFilter.CONTENT_TYPE_SUFFIX), "application/octet-stream");
|
assertEquals(req.getParameter("fileup"+MultiPartFilter.CONTENT_TYPE_SUFFIX), "application/octet-stream");
|
||||||
|
|
Loading…
Reference in New Issue