Skip to content

Commit 44c1e8a

Browse files
committed
Save reason phrase in Protocol::HTTP1::Response
Save away the raw reason phrase provided by the server. This is of limited niche value, as the reason phrase seems to be _mostly_ unused/ignored. One example of where it's needed: The [Proxmox VE API](https://pve.proxmox.com/wiki/Proxmox_VE_API) ships error reason strings back using the HTTP reason phrase. Without this side-channel, error status is 100% opaque/unavailable.
1 parent 26a52f0 commit 44c1e8a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/async/http/protocol/http1/response.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ def self.read(connection, request)
1818

1919
UPGRADE = 'upgrade'
2020

21-
# @param reason [String] HTTP response line reason, ignored.
21+
# @param reason [String] HTTP response line reason phrase
2222
def initialize(connection, version, status, reason, headers, body)
2323
@connection = connection
24+
@reason = reason
2425

2526
protocol = headers.delete(UPGRADE)
2627

@@ -30,6 +31,10 @@ def initialize(connection, version, status, reason, headers, body)
3031
def connection
3132
@connection
3233
end
34+
35+
def reason
36+
@reason
37+
end
3338

3439
def hijack?
3540
@body.nil?

0 commit comments

Comments
 (0)