You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/async/http/protocol/http1/server.rb
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -82,12 +82,13 @@ def each(task: Task.current)
82
82
# If a response was generated, send it:
83
83
ifresponse
84
84
trailer=response.headers.trailer!
85
+
headers=response.headers.header
85
86
86
87
# Some operations in this method are long running, that is, it's expected that `body.call(stream)` could literally run indefinitely. In order to facilitate garbage collection, we want to nullify as many local variables before calling the streaming body. This ensures that the garbage collection can clean up as much state as possible during the long running operation, so we don't retain objects that are no longer needed.
87
88
88
89
ifbodyandprotocol=response.protocol
89
90
# We force a 101 response if the protocol is upgraded - HTTP/2 CONNECT will return 200 for success, but this won't be understood by HTTP/1 clients:
90
-
write_response(@version,101,response.headers)
91
+
write_response(@version,101,headers)
91
92
92
93
# At this point, the request body is hijacked, so we don't want to call #finish below.
93
94
request=nil
@@ -100,7 +101,7 @@ def each(task: Task.current)
100
101
end
101
102
elsifresponse.status == 101
102
103
# This code path is to support legacy behavior where the response status is set to 101, but the protocol is not upgraded. This may not be a valid use case, but it is supported for compatibility. We expect the response headers to contain the `upgrade` header.
# This function informs the headers object that any subsequent headers are going to be trailer. Therefore, it must be called *before* sending the headers, to avoid any race conditions.
0 commit comments