File tree 2 files changed +34
-1
lines changed
2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ where
257
257
if !T :: should_read_first ( ) {
258
258
self . try_keep_alive ( cx) ;
259
259
}
260
- } else if msg. expect_continue {
260
+ } else if msg. expect_continue && msg . head . version . gt ( & Version :: HTTP_10 ) {
261
261
self . state . reading = Reading :: Continue ( Decoder :: new ( msg. decode ) ) ;
262
262
wants = wants. add ( Wants :: EXPECT ) ;
263
263
} else {
Original file line number Diff line number Diff line change @@ -916,6 +916,39 @@ fn expect_continue_accepts_upper_cased_expectation() {
916
916
assert_eq ! ( body, msg) ;
917
917
}
918
918
919
+ #[ test]
920
+ fn expect_continue_but_http_10_is_ignored ( ) {
921
+ let server = serve ( ) ;
922
+ let mut req = connect ( server. addr ( ) ) ;
923
+ server. reply ( ) ;
924
+
925
+ req. write_all (
926
+ b"\
927
+ POST /foo HTTP/1.0\r \n \
928
+ Host: example.domain\r \n \
929
+ Expect: 100-Continue\r \n \
930
+ Content-Length: 5\r \n \
931
+ Connection: Close\r \n \
932
+ \r \n \
933
+ ",
934
+ )
935
+ . expect ( "write 1" ) ;
936
+
937
+ let msg = b"hello" ;
938
+ req. write_all ( msg) . expect ( "write 2" ) ;
939
+
940
+ let s_line = b"HTTP/1.0 200 OK\r \n " ;
941
+ let mut buf = vec ! [ 0 ; s_line. len( ) ] ;
942
+ req. read_exact ( & mut buf) . expect ( "read 1" ) ;
943
+ assert_eq ! ( buf, s_line) ;
944
+
945
+ let mut body = String :: new ( ) ;
946
+ req. read_to_string ( & mut body) . expect ( "read 2" ) ;
947
+
948
+ let body = server. body ( ) ;
949
+ assert_eq ! ( body, msg) ;
950
+ }
951
+
919
952
#[ test]
920
953
fn expect_continue_but_no_body_is_ignored ( ) {
921
954
let server = serve ( ) ;
You can’t perform that action at this time.
0 commit comments