File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
lib/async/http/protocol/http1 Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 33# Released under the MIT License.
44# Copyright, 2018-2023, by Samuel Williams.
55# Copyright, 2020, by Igor Sidorov.
6+ # Copyright, 2023, by Thomas Morgan.
67
78require_relative 'connection'
89
@@ -14,6 +15,9 @@ class Server < Connection
1415 def fail_request ( status )
1516 @persistent = false
1617 write_response ( @version , status , { } , nil )
18+ write_body ( @version , nil )
19+ rescue Errno ::ECONNRESET , Errno ::EPIPE
20+ # Handle when connection is already closed
1721 end
1822
1923 def next_request
Original file line number Diff line number Diff line change 33# Released under the MIT License.
44# Copyright, 2017-2023, by Samuel Williams.
55# Copyright, 2018, by Janko Marohnić.
6+ # Copyright, 2023, by Thomas Morgan.
67
78require 'async/http/protocol/http11'
89require_relative 'shared_examples'
910
1011RSpec . describe Async ::HTTP ::Protocol ::HTTP11 do
1112 it_behaves_like Async ::HTTP ::Protocol
1213
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+
1324 context 'head request' do
1425 include_context Async ::HTTP ::Server
1526
You can’t perform that action at this time.
0 commit comments