Skip to content

Commit 8976514

Browse files
authored
Temp fix: wait until the client ends HTTP2 stream (#689)
1 parent 4cdd998 commit 8976514

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Sources/HummingbirdHTTP2/HTTP2Channel.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ internal struct HTTP2Channel: ServerChildChannel {
112112
}
113113
}
114114
} catch {
115-
logger.error("Error handling inbound connection for HTTP2 handler: \(error)")
115+
logger.debug("Error handling inbound connection for HTTP2 handler: \(error)")
116116
}
117117
}
118118
}

Sources/HummingbirdHTTP2/HTTP2StreamChannel.swift

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ struct HTTP2StreamChannel: ServerChildChannel {
7777
)
7878
let responseWriter = ResponseWriter(outbound: outbound)
7979
try await self.responder(request, responseWriter, asyncChannel.channel)
80+
// Wait until inbound stream is finished. NIO will end the stream once
81+
// it receives the HTTP part `.end`. This shouldnt be necessary as calling
82+
// write should guarantee data is written
83+
while try await iterator.next() != nil {}
8084
}
8185
} onCancel: {
8286
asyncChannel.channel.close(mode: .input, promise: nil)

0 commit comments

Comments
 (0)