@@ -155,7 +155,13 @@ public boolean handle(Request request, Response response, Callback callback)
155
155
out .append ("Attribute " ).append (name ).append (" = " ).append (session .getAttribute (name )).append ('\n' );
156
156
out .append ("URI [" )
157
157
.append (session .encodeURI (request , "/some/path" , request .getHeaders ().contains (HttpHeader .COOKIE )))
158
- .append ("]" );
158
+ .append ("]\n " );
159
+ out .append ("RELATIVE URI [" )
160
+ .append (session .encodeURI (request , "../" , request .getHeaders ().contains (HttpHeader .COOKIE )))
161
+ .append ("]\n " );
162
+ out .append ("ABSOLUTE URI [" )
163
+ .append (session .encodeURI (request , "http://localhost:80/foo/bar/" , request .getHeaders ().contains (HttpHeader .COOKIE )))
164
+ .append ("]\n " );
159
165
}
160
166
else
161
167
{
@@ -488,6 +494,8 @@ public void testCookieAndURI() throws Exception
488
494
String content = response .getContent ();
489
495
assertThat (content , startsWith ("Session=" ));
490
496
assertThat (content , containsString ("URI [/some/path;session_id=%s]" .formatted (id ))); // Cookies not known to be in use
497
+ assertThat (content , containsString ("RELATIVE URI [../;session_id=%s]" .formatted (id ))); // Cookies not known to be in use
498
+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/;session_id=%s]" .formatted (id ))); // Cookies not known to be in use
491
499
492
500
// Get with cookie
493
501
endPoint .addInput ("""
@@ -503,6 +511,8 @@ public void testCookieAndURI() throws Exception
503
511
content = response .getContent ();
504
512
assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
505
513
assertThat (content , containsString ("URI [/some/path]" )); // Cookies known to be in use
514
+ assertThat (content , containsString ("RELATIVE URI [../]" ));
515
+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/" ));
506
516
507
517
// Get with parameter
508
518
endPoint .addInput ("""
@@ -517,6 +527,8 @@ public void testCookieAndURI() throws Exception
517
527
content = response .getContent ();
518
528
assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
519
529
assertThat (content , containsString ("URI [/some/path;session_id=%s]" .formatted (id ))); // Cookies not in use
530
+ assertThat (content , containsString ("RELATIVE URI [../;session_id=%s]" .formatted (id )));
531
+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/;session_id=%s]" .formatted (id )));
520
532
521
533
// Get with both, but param wrong
522
534
endPoint .addInput ("""
@@ -532,6 +544,8 @@ public void testCookieAndURI() throws Exception
532
544
content = response .getContent ();
533
545
assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
534
546
assertThat (content , containsString ("URI [/some/path]" )); // Cookies known to be in use
547
+ assertThat (content , containsString ("RELATIVE URI [../]" ));
548
+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/]" ));
535
549
536
550
// Get with both, but cookie wrong
537
551
endPoint .addInput ("""
@@ -547,6 +561,8 @@ public void testCookieAndURI() throws Exception
547
561
content = response .getContent ();
548
562
assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
549
563
assertThat (content , containsString ("URI [/some/path]" )); // Cookies known to be in use
564
+ assertThat (content , containsString ("RELATIVE URI [../]" ));
565
+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/]" ));
550
566
}
551
567
}
552
568
@@ -789,5 +805,4 @@ public void testFlushOnResponseCommit() throws Exception
789
805
assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
790
806
assertThat (content , containsString ("attribute = value" ));
791
807
}
792
-
793
808
}
0 commit comments