Issue #3916 - Fix whitespace between boundary and part headers

+ Updating existing testcase

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2020-07-30 09:26:09 -05:00
parent 36b42ca65d
commit 784fabf2ae
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 22 additions and 6 deletions

View File

@ -150,12 +150,28 @@ public class DefaultServletRangesTest
String boundary = body.substring(0, body.indexOf("\r\n"));
assertResponseContains("206 Partial", response);
assertResponseContains("Content-Type: multipart/byteranges; boundary=", response);
assertResponseContains("Content-Range: bytes 0-9/80", response);
assertResponseContains("Content-Range: bytes 20-29/80", response);
assertResponseContains("Content-Range: bytes 40-49/80", response);
assertResponseContains(DATA.substring(0, 10), response);
assertResponseContains(DATA.substring(20, 30), response);
assertResponseContains(DATA.substring(40, 50), response);
String section1 = boundary + "\r\n" +
"Content-Type: text/plain\r\n" +
"Content-Range: bytes 0-9/80\r\n" +
"\r\n" +
DATA.substring(0, 10) + "\r\n";
assertResponseContains(section1, response);
String section2 = boundary + "\r\n" +
"Content-Type: text/plain\r\n" +
"Content-Range: bytes 20-29/80\r\n" +
"\r\n" +
DATA.substring(20, 30) + "\r\n";
assertResponseContains(section2, response);
String section3 = boundary + "\r\n" +
"Content-Type: text/plain\r\n" +
"Content-Range: bytes 40-49/80\r\n" +
"\r\n" +
DATA.substring(40, 50) + "\r\n";
assertResponseContains(section3, response);
assertTrue(body.endsWith(boundary + "--\r\n"));
}