File tree 2 files changed +15
-0
lines changed
lib/async/http/protocol/http1
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 3
3
# Released under the MIT License.
4
4
# Copyright, 2018-2023, by Samuel Williams.
5
5
# Copyright, 2020, by Igor Sidorov.
6
+ # Copyright, 2023, by Thomas Morgan.
6
7
7
8
require_relative 'connection'
8
9
@@ -14,6 +15,9 @@ class Server < Connection
14
15
def fail_request ( status )
15
16
@persistent = false
16
17
write_response ( @version , status , { } , nil )
18
+ write_body ( @version , nil )
19
+ rescue Errno ::ECONNRESET , Errno ::EPIPE
20
+ # Handle when connection is already closed
17
21
end
18
22
19
23
def next_request
Original file line number Diff line number Diff line change 3
3
# Released under the MIT License.
4
4
# Copyright, 2017-2023, by Samuel Williams.
5
5
# Copyright, 2018, by Janko Marohnić.
6
+ # Copyright, 2023, by Thomas Morgan.
6
7
7
8
require 'async/http/protocol/http11'
8
9
require_relative 'shared_examples'
9
10
10
11
RSpec . describe Async ::HTTP ::Protocol ::HTTP11 do
11
12
it_behaves_like Async ::HTTP ::Protocol
12
13
14
+ context 'bad requests' do
15
+ include_context Async ::HTTP ::Server
16
+
17
+ it "should fail cleanly when path is empty" do
18
+ response = client . get ( "" )
19
+
20
+ expect ( response . status ) . to be == 400
21
+ end
22
+ end
23
+
13
24
context 'head request' do
14
25
include_context Async ::HTTP ::Server
15
26
You can’t perform that action at this time.
0 commit comments