@@ -680,6 +680,56 @@ const struct message requests[] =
680
680
,.body = ""
681
681
}
682
682
683
+ /* see https://github.com/ry/http-parser/issues/47 */
684
+ #define EAT_TRAILING_CRLF_NO_CONNECTION_CLOSE 28
685
+ , {.name = "eat CRLF between requests, no \"Connection: close\" header"
686
+ ,.raw = "POST / HTTP/1.1\r\n"
687
+ "Host: www.example.com\r\n"
688
+ "Content-Type: application/x-www-form-urlencoded\r\n"
689
+ "Content-Length: 4\r\n"
690
+ "\r\n"
691
+ "q=42\r\n" /* note the trailing CRLF */
692
+ ,.should_keep_alive = TRUE
693
+ ,.message_complete_on_eof = FALSE
694
+ ,.http_major = 1
695
+ ,.http_minor = 1
696
+ ,.method = HTTP_POST
697
+ ,.request_url = "/"
698
+ ,.num_headers = 3
699
+ ,.upgrade = 0
700
+ ,.headers = { { "Host" , "www.example.com" }
701
+ , { "Content-Type" , "application/x-www-form-urlencoded" }
702
+ , { "Content-Length" , "4" }
703
+ }
704
+ ,.body = "q=42"
705
+ }
706
+
707
+ /* see https://github.com/ry/http-parser/issues/47 */
708
+ #define EAT_TRAILING_CRLF_WITH_CONNECTION_CLOSE 29
709
+ , {.name = "eat CRLF between requests even if \"Connection: close\" is set"
710
+ ,.raw = "POST / HTTP/1.1\r\n"
711
+ "Host: www.example.com\r\n"
712
+ "Content-Type: application/x-www-form-urlencoded\r\n"
713
+ "Content-Length: 4\r\n"
714
+ "Connection: close\r\n"
715
+ "\r\n"
716
+ "q=42\r\n" /* note the trailing CRLF */
717
+ ,.should_keep_alive = FALSE
718
+ ,.message_complete_on_eof = FALSE /* input buffer isn't empty when on_message_complete is called */
719
+ ,.http_major = 1
720
+ ,.http_minor = 1
721
+ ,.method = HTTP_POST
722
+ ,.request_url = "/"
723
+ ,.num_headers = 4
724
+ ,.upgrade = 0
725
+ ,.headers = { { "Host" , "www.example.com" }
726
+ , { "Content-Type" , "application/x-www-form-urlencoded" }
727
+ , { "Content-Length" , "4" }
728
+ , { "Connection" , "close" }
729
+ }
730
+ ,.body = "q=42"
731
+ }
732
+
683
733
, {.name = NULL } /* sentinel */
684
734
};
685
735
0 commit comments