File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1047,6 +1047,7 @@ def connect
1047
1047
write_timeout : @write_timeout ,
1048
1048
continue_timeout : @continue_timeout ,
1049
1049
debug_output : @debug_output )
1050
+ @last_communicated = nil
1050
1051
on_connect
1051
1052
rescue => exception
1052
1053
if s
Original file line number Diff line number Diff line change @@ -1168,6 +1168,30 @@ def test_keep_alive_get_auto_retry
1168
1168
}
1169
1169
end
1170
1170
1171
+ def test_keep_alive_reset_on_new_connection
1172
+ # Using WEBrick's debug log output on accepting connection:
1173
+ #
1174
+ # "[2021-04-29 20:36:46] DEBUG accept: 127.0.0.1:50674\n"
1175
+ @log_tester = nil
1176
+ @server . logger . level = WEBrick ::BasicLog ::DEBUG
1177
+
1178
+ start { |http |
1179
+ res = http . get ( '/' )
1180
+ http . keep_alive_timeout = 1
1181
+ assert_kind_of Net ::HTTPResponse , res
1182
+ assert_kind_of String , res . body
1183
+ http . finish
1184
+ assert_equal 1 , @log . grep ( /accept/i ) . size
1185
+
1186
+ sleep 1.5
1187
+ http . start
1188
+ res = http . get ( '/' )
1189
+ assert_kind_of Net ::HTTPResponse , res
1190
+ assert_kind_of String , res . body
1191
+ assert_equal 2 , @log . grep ( /accept/i ) . size
1192
+ }
1193
+ end
1194
+
1171
1195
class MockSocket
1172
1196
attr_reader :count
1173
1197
def initialize ( success_after : nil )
You can’t perform that action at this time.
0 commit comments