HTTP2: Allow frame of type RstStreamFrame when in state HalfClosedLocalWaitingForPeerStream#614
HTTP2: Allow frame of type RstStreamFrame when in state HalfClosedLocalWaitingForPeerStream#614jtjeferreira wants to merge 4 commits intoapache:mainfrom
Conversation
…mFrame for stream 1 in state HalfClosedLocalWaitingForPeerStream"
|
Thanks for looking into this!
That would indeed be nice but could get pretty complex, seems reasonable to postpone that.
Hmm, not having to create a 'fake' HttpResponse would indeed be nice, I wonder if we can avoid that somehow |
Indeed! In the API it's not even easy to support failed requests because the HTTP/2 API is ultimately flow based, so we would have to change the flow type to support failed requests that somehow support the request association. Maybe it's indeed better to create a well-document fake response that works with the existing API types (i.e. HttpResponse). In some way, the server misses the opportunity to offer a better response code by rejecting a request with a |
I guess that would mean changing the HTTP/2 flow API to be similar to the HTTP/1 flow api: Meanwhile feel free to review the PR |
| case rst: RstStreamFrame => | ||
| val headers = ParsedHeadersFrame(rst.streamId, endStream = false, Seq((":status", "429")), None) | ||
| dispatchSubstream(headers, Right(Source.failed(new PeerClosedStreamException(rst.streamId, rst.errorCode))), | ||
| correlationAttributes) | ||
| Closed |
There was a problem hiding this comment.
should I handle rst: RstStreamFrame is other states? should I change other places that handle RstStreamFrame to return the fake response?
As described in apache/pekko-connectors#830, I got an
"Received unexpected frame of type RstStreamFrame for stream 1 in state HalfClosedLocalWaitingForPeerStream"which I think is a bug in the http2 client side support.In this PR I took the approach of returning an
HttpResponsewith status 429, and with an failed source withPeerClosedStreamExceptionas entity. I though of several alternatives but I could not implement them:REFUSED_STREAM, since the spec clearly says the request can be retried.PeerClosedStreamException, without having to "wrap" it in aHttpResponse