-
Notifications
You must be signed in to change notification settings - Fork 28
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
Second readBuffer
call hangs forever
#48
Comments
Yeah, I recall having thought about this before. It would make sense for |
Just sketching: data HeadersRead
data BodyRead
-- | A middleware transitioning from one `Request` state to another.
type RequestStateTransition m req from to a =
forall res c.
Middleware
m
(Conn (req from) res c)
(Conn (req to) res c)
a
class Request (req :: Type -> Type) m where
getRequestData
:: forall state res c
. Middleware
m
(Conn (req state) res c)
(Conn (req state) res c)
RequestData
class Request req m <= BaseRequest req m
-- | A `ReadableBody` instance reads the complete request body as a
-- | value of type `b`. For streaming the request body, see the
-- | [StreamableBody](#streamablebody) class.
class (Request req m) <= ReadableBody req m b where
readBody
:: RequestStateTransition m req HeadersRead BodyRead b |
Maybe the class (Request req m) <= StreamableBody req m stream | req -> stream where
streamBody :: (stream -> m Unit) -> RequestStateTransition m req HeadersRead BodyRead b So you'd get access to the underlying stream only inside the supplied function. |
I'd like to pick up this issue following the same approach I proposed in #86. I think the Just to clarify, but should there also be a type for reading the status line? |
IIRC (it was some time ago since I worked on this), the status line and headers are always read. The only state transition currently represented is not having read the body ( |
Makes sense. I was thinking of parallels to the request state, so this came to mind. |
It seems that second call to
readBuffer
hangs forever. Minimal example:I'm not sure, but maybe body state also should be tracked in types... What do you think?
The text was updated successfully, but these errors were encountered: