-
Notifications
You must be signed in to change notification settings - Fork 193
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
Move early hints into responseEarlyHints
field
#524
Conversation
Hmm, I just realized this is not going to actually provide a performance improvement, because This limits the usefulness of this when it comes to implementing performant reverse proxying, but at least it fixes the behavior on #521. It seems like it will require more of an API change in order to first return early hints headers, and then at a later time return the actual status + headers + response. |
I just added the cabal version bump and changelog update. I'm still not sure how the early hint headers can be exposed in a way that the user can access them immediately after they arrive, as when you're trying to e.g. write a reverse proxy. When you look at the key functions of responseOpen :: Request -> Manager -> IO (Response BodyReader) it seems like it would have to change to something like this: -- An extra callback that receives any early hint headers
responseOpen' :: Request -> Manager -> ([Header] -> IO ()) -> IO (Response BodyReader) OR, less invasively, how about being able to specify a |
I think adding a callback to the |
I might as well include it, it looks like I'll have to plumb the callback through most of this. |
Okay, I've added the callback. |
Okay, the callback signature is |
Merged and released, thanks! |
This is a continuation of #523, developing the idea that we can put the early hints into a new field of the
Response
object calledresponseEarlyHints
.AFAICT this is not a breaking change, since the
Response
data constructors are not exposed and theStatusHeaders
type is only exposed in an internal module.