-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP2: Allow frame of type RstStreamFrame when in state HalfClosedLocalWaitingForPeerStream #614
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
HttpResponse
with status 429, and with an failed source withPeerClosedStreamException
as 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