@@ -610,6 +610,10 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
610
610
}
611
611
612
612
public void testMalformedRequestDispatchedNoAuthn () throws Exception {
613
+ assumeTrue (
614
+ "This test doesn't work correctly under turkish-like locale, because it uses String#toUpper() for asserted error messages" ,
615
+ isTurkishLocale () == false
616
+ );
613
617
final AtomicReference <Throwable > dispatchThrowableReference = new AtomicReference <>();
614
618
final AtomicInteger authnInvocationCount = new AtomicInteger ();
615
619
final AtomicInteger badDispatchInvocationCount = new AtomicInteger ();
@@ -660,8 +664,8 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
660
664
EmbeddedChannel ch = new EmbeddedChannel (handler );
661
665
ByteBuf buf = ch .alloc ().buffer ();
662
666
ByteBufUtil .copy (AsciiString .of ("This is not a valid HTTP line" ), buf );
663
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
664
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
667
+ buf . writeByte ( HttpConstants .LF );
668
+ buf . writeByte ( HttpConstants .LF );
665
669
testThreadPool .generic ().submit (() -> {
666
670
ch .writeInbound (buf );
667
671
ch .flushInbound ();
@@ -675,8 +679,8 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
675
679
EmbeddedChannel ch = new EmbeddedChannel (handler );
676
680
ByteBuf buf = ch .alloc ().buffer ();
677
681
ByteBufUtil .copy (AsciiString .of ("GET /this/is/a/valid/but/too/long/initial/line HTTP/1.1" ), buf );
678
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
679
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
682
+ buf . writeByte ( HttpConstants .LF );
683
+ buf . writeByte ( HttpConstants .LF );
680
684
testThreadPool .generic ().submit (() -> {
681
685
ch .writeInbound (buf );
682
686
ch .flushInbound ();
@@ -690,10 +694,10 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
690
694
EmbeddedChannel ch = new EmbeddedChannel (handler );
691
695
ByteBuf buf = ch .alloc ().buffer ();
692
696
ByteBufUtil .copy (AsciiString .of ("GET /url HTTP/1.1" ), buf );
693
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
697
+ buf . writeByte ( HttpConstants .LF );
694
698
ByteBufUtil .copy (AsciiString .of ("Host" ), buf );
695
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
696
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
699
+ buf . writeByte ( HttpConstants .LF );
700
+ buf . writeByte ( HttpConstants .LF );
697
701
testThreadPool .generic ().submit (() -> {
698
702
ch .writeInbound (buf );
699
703
ch .flushInbound ();
@@ -707,10 +711,10 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
707
711
EmbeddedChannel ch = new EmbeddedChannel (handler );
708
712
ByteBuf buf = ch .alloc ().buffer ();
709
713
ByteBufUtil .copy (AsciiString .of ("GET /url HTTP/1.1" ), buf );
710
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
714
+ buf . writeByte ( HttpConstants .LF );
711
715
ByteBufUtil .copy (AsciiString .of ("Host: this.looks.like.a.good.url.but.is.longer.than.permitted" ), buf );
712
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
713
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
716
+ buf . writeByte ( HttpConstants .LF );
717
+ buf . writeByte ( HttpConstants .LF );
714
718
testThreadPool .generic ().submit (() -> {
715
719
ch .writeInbound (buf );
716
720
ch .flushInbound ();
@@ -724,10 +728,11 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
724
728
EmbeddedChannel ch = new EmbeddedChannel (handler );
725
729
ByteBuf buf = ch .alloc ().buffer ();
726
730
ByteBufUtil .copy (AsciiString .of ("GET /url HTTP/1.1" ), buf );
727
- ByteBufUtil .writeShortBE (buf , HttpConstants .LF );
728
- ByteBufUtil .copy (AsciiString .of ("Host: invalid host value" ), buf );
729
- ByteBufUtil .writeShortBE (buf , HttpConstants .LF );
730
- ByteBufUtil .writeShortBE (buf , HttpConstants .LF );
731
+ buf .writeByte (HttpConstants .LF );
732
+ ByteBufUtil .copy (AsciiString .of ("Host: invalid header value" ), buf );
733
+ buf .writeByte (0x01 );
734
+ buf .writeByte (HttpConstants .LF );
735
+ buf .writeByte (HttpConstants .LF );
731
736
testThreadPool .generic ().submit (() -> {
732
737
ch .writeInbound (buf );
733
738
ch .flushInbound ();
@@ -741,9 +746,9 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
741
746
EmbeddedChannel ch = new EmbeddedChannel (handler );
742
747
ByteBuf buf = ch .alloc ().buffer ();
743
748
ByteBufUtil .copy (AsciiString .of ("GET /url HTTP/1.1" ), buf );
744
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
749
+ buf . writeByte ( HttpConstants .LF );
745
750
ByteBufUtil .copy (AsciiString .of ("Host: localhost" ), buf );
746
- ByteBufUtil . writeShortBE ( buf , HttpConstants .LF );
751
+ buf . writeByte ( HttpConstants .LF );
747
752
testThreadPool .generic ().submit (() -> {
748
753
ch .writeInbound (buf );
749
754
ch .flushInbound ();
0 commit comments