HTTP server no adhears to the correct carrage return of \r\n

This commit is contained in:
Ziver Koc 2026-04-04 23:50:36 +02:00
parent 7209d677a4
commit 8a7bc3362e
3 changed files with 47 additions and 43 deletions

View file

@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Ziver Koc
* Copyright (c) 2020-2026 Ziver Koc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -39,8 +39,8 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"GET / HTTP/1.0" + System.lineSeparator() +
System.lineSeparator(),
"GET / HTTP/1.0" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -54,8 +54,8 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"POST / HTTP/1.0" + System.lineSeparator() +
System.lineSeparator(),
"POST / HTTP/1.0" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -69,8 +69,8 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"GET /test/path/to/page?param=aa&tt=aa HTTP/1.0" + System.lineSeparator() +
System.lineSeparator(),
"GET /test/path/to/page?param=aa&tt=aa HTTP/1.0" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -84,9 +84,9 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"GET / HTTP/1.0" + System.lineSeparator() +
"Cookie: Test=value;" + System.lineSeparator() +
System.lineSeparator(),
"GET / HTTP/1.0" + HttpPrintStream.LINE_SEPARATOR +
"Cookie: Test=value;" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -101,9 +101,9 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"GET / HTTP/1.0" + System.lineSeparator() +
"Cookie: Test1=value1; Test2=value2;" + System.lineSeparator() +
System.lineSeparator(),
"GET / HTTP/1.0" + HttpPrintStream.LINE_SEPARATOR +
"Cookie: Test1=value1; Test2=value2;" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -116,8 +116,8 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"HTTP/1.0 200 OK" + System.lineSeparator() +
System.lineSeparator(),
"HTTP/1.0 200 OK" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -131,8 +131,8 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"HTTP/1.0 400 Bad Request" + System.lineSeparator() +
System.lineSeparator(),
"HTTP/1.0 400 Bad Request" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -146,9 +146,9 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"HTTP/1.0 200 OK" + System.lineSeparator() +
"Set-Cookie: Test=value;" + System.lineSeparator() +
System.lineSeparator(),
"HTTP/1.0 200 OK" + HttpPrintStream.LINE_SEPARATOR +
"Set-Cookie: Test=value;" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -163,10 +163,10 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"HTTP/1.0 200 OK" + System.lineSeparator() +
"Set-Cookie: Test1=value1;" + System.lineSeparator() +
"Set-Cookie: Test2=value2;" + System.lineSeparator() +
System.lineSeparator(),
"HTTP/1.0 200 OK" + HttpPrintStream.LINE_SEPARATOR +
"Set-Cookie: Test1=value1;" + HttpPrintStream.LINE_SEPARATOR +
"Set-Cookie: Test2=value2;" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}
@ -182,10 +182,10 @@ public class HttpPrintStreamTest {
httpOut.flush();
assertEquals(
"HTTP/1.0 200 OK" + System.lineSeparator() +
"Test1: value1" + System.lineSeparator() +
"Test2: value2" + System.lineSeparator() +
System.lineSeparator(),
"HTTP/1.0 200 OK" + HttpPrintStream.LINE_SEPARATOR +
"Test1: value1" + HttpPrintStream.LINE_SEPARATOR +
"Test2: value2" + HttpPrintStream.LINE_SEPARATOR +
HttpPrintStream.LINE_SEPARATOR,
out.toString()
);
}