Skip to content

Commit a02afbb

Browse files
committed
This test fails repeatedly on Windows (gets 400 BAD Request). (#2791)
Fix it by sending CRLF (as mandated by the spec). Latest Netty version applies a strict policy regarding line endings for security reasons. Signed-off-by: Thomas Segismont <[email protected]>
1 parent b2bb62d commit a02afbb

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

vertx-web/src/test/java/io/vertx/ext/web/RouterTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3284,12 +3284,12 @@ public void testPauseResumeOnPipeline() {
32843284
Function<List<String>, String> test = reqs -> {
32853285
try (Socket socket = new Socket("localhost", 8080)) {
32863286
OutputStream output = socket.getOutputStream();
3287-
PrintWriter writer = new PrintWriter(output, true);
3287+
PrintWriter writer = new PrintWriter(output, false);
32883288

32893289
for (String req : reqs) {
32903290
writer.print(req);
32913291
}
3292-
writer.println();
3292+
writer.flush();
32933293

32943294
InputStream input = socket.getInputStream();
32953295
StringBuilder buffer = new StringBuilder();
@@ -3327,8 +3327,8 @@ public void testPauseResumeOnPipeline() {
33273327
"\n" +
33283328
"/parse/ok\n",
33293329
test.apply(Arrays.asList(
3330-
"POST / HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nABC",
3331-
"POST /parse/ok HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nDEF"
3330+
"POST / HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nABC\r\n",
3331+
"POST /parse/ok HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nDEF\r\n"
33323332
)));
33333333

33343334
// Test:
@@ -3351,8 +3351,8 @@ public void testPauseResumeOnPipeline() {
33513351
"\n" +
33523352
"/\n",
33533353
test.apply(Arrays.asList(
3354-
"POST /parse/ok HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nDEF",
3355-
"POST / HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nABC"
3354+
"POST /parse/ok HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nDEF\r\n",
3355+
"POST / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nABC\r\n"
33563356
)));
33573357

33583358
// Test:
@@ -3375,8 +3375,8 @@ public void testPauseResumeOnPipeline() {
33753375
"\n" +
33763376
"/expect/end\n",
33773377
test.apply(Arrays.asList(
3378-
"POST /parse/ok HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nDEF",
3379-
"POST /expect/end HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nABC"
3378+
"POST /parse/ok HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nDEF\r\n",
3379+
"POST /expect/end HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nABC\r\n"
33803380
)));
33813381

33823382
// Test:
@@ -3399,8 +3399,8 @@ public void testPauseResumeOnPipeline() {
33993399
"\n" +
34003400
"/parse/ok\n",
34013401
test.apply(Arrays.asList(
3402-
"POST /expect/end HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nABC",
3403-
"POST /parse/ok HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nDEF"
3402+
"POST /expect/end HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nABC\r\n",
3403+
"POST /parse/ok HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nDEF\r\n"
34043404
)));
34053405

34063406
// Test:
@@ -3423,8 +3423,8 @@ public void testPauseResumeOnPipeline() {
34233423
"\n" +
34243424
"/expect/end\n",
34253425
test.apply(Arrays.asList(
3426-
"POST / HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nDEF",
3427-
"POST /expect/end HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nABC"
3426+
"POST / HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nDEF\r\n",
3427+
"POST /expect/end HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nABC\r\n"
34283428
)));
34293429

34303430
// Test:
@@ -3447,8 +3447,8 @@ public void testPauseResumeOnPipeline() {
34473447
"\n" +
34483448
"/\n",
34493449
test.apply(Arrays.asList(
3450-
"POST /expect/end HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nABC",
3451-
"POST / HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nDEF"
3450+
"POST /expect/end HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nABC\r\n",
3451+
"POST / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nDEF\r\n"
34523452
)));
34533453

34543454
// Test:
@@ -3469,8 +3469,8 @@ public void testPauseResumeOnPipeline() {
34693469
"\n" +
34703470
"/expect/end\n",
34713471
test.apply(Arrays.asList(
3472-
"POST /not/found HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nDEF",
3473-
"POST /expect/end HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nABC"
3472+
"POST /not/found HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nDEF\r\n",
3473+
"POST /expect/end HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nABC\r\n"
34743474
)));
34753475

34763476
// Test:
@@ -3492,8 +3492,8 @@ public void testPauseResumeOnPipeline() {
34923492
"\n" +
34933493
"/\n",
34943494
test.apply(Arrays.asList(
3495-
"POST /not/found HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nABC",
3496-
"POST / HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nDEF"
3495+
"POST /not/found HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nABC\r\n",
3496+
"POST / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nDEF\r\n"
34973497
)));
34983498

34993499
// Test:
@@ -3515,8 +3515,8 @@ public void testPauseResumeOnPipeline() {
35153515
"\n" +
35163516
"/parse/ok\n",
35173517
test.apply(Arrays.asList(
3518-
"POST /not/found HTTP/1.1\nHost: localhost\nConnection: keep-alive\nContent-Length: 3\n\nABC",
3519-
"POST /parse/ok HTTP/1.1\nHost: localhost\nConnection: close\nContent-Length: 3\n\nDEF"
3518+
"POST /not/found HTTP/1.1\r\nHost: localhost\r\nConnection: keep-alive\r\nContent-Length: 3\r\n\r\nABC\r\n",
3519+
"POST /parse/ok HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\nContent-Length: 3\r\n\r\nDEF\r\n"
35203520
)));
35213521
}
35223522

0 commit comments

Comments
 (0)