Merge remote-tracking branch 'origin/jetty-9.2.x'
This commit is contained in:
commit
ad4854dafe
|
@ -24,14 +24,19 @@
|
|||
*/
|
||||
package org.eclipse.jetty.server;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -278,16 +283,43 @@ public class HttpConnectionTest
|
|||
"Connection: close\015\012"+
|
||||
"\015\012");
|
||||
|
||||
assertThat(responsePOST,startsWith(responseHEAD.substring(0,responseHEAD.length()-2)));
|
||||
assertThat(responsePOST.length(),greaterThan(responseHEAD.length()));
|
||||
|
||||
responsePOST=connector.getResponses("POST /R1 HTTP/1.1\015\012"+
|
||||
"Host: localhost\015\012"+
|
||||
"Connection: close\015\012"+
|
||||
"\015\012");
|
||||
|
||||
assertThat(responsePOST,startsWith(responseHEAD.substring(0,responseHEAD.length()-2)));
|
||||
assertThat(responsePOST.length(),greaterThan(responseHEAD.length()));
|
||||
String postLine;
|
||||
boolean postDate=false;
|
||||
Set<String> postHeaders = new HashSet<>();
|
||||
try(BufferedReader in = new BufferedReader(new StringReader(responsePOST)))
|
||||
{
|
||||
postLine = in.readLine();
|
||||
String line=in.readLine();
|
||||
while (line!=null && line.length()>0)
|
||||
{
|
||||
if (line.startsWith("Date:"))
|
||||
postDate=true;
|
||||
else
|
||||
postHeaders.add(line);
|
||||
line=in.readLine();
|
||||
}
|
||||
}
|
||||
String headLine;
|
||||
boolean headDate=false;
|
||||
Set<String> headHeaders = new HashSet<>();
|
||||
try(BufferedReader in = new BufferedReader(new StringReader(responseHEAD)))
|
||||
{
|
||||
headLine = in.readLine();
|
||||
String line=in.readLine();
|
||||
while (line!=null && line.length()>0)
|
||||
{
|
||||
if (line.startsWith("Date:"))
|
||||
headDate=true;
|
||||
else
|
||||
headHeaders.add(line);
|
||||
line=in.readLine();
|
||||
}
|
||||
}
|
||||
|
||||
assertThat(postLine,equalTo(headLine));
|
||||
assertThat(postDate,equalTo(headDate));
|
||||
assertTrue(postHeaders.equals(headHeaders));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue