This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
24
unikernel/duniverse/httpun/lib/response_state.ml
Normal file
24
unikernel/duniverse/httpun/lib/response_state.ml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
type t =
|
||||
| Waiting
|
||||
| Fixed of Response.t
|
||||
| Streaming of Response.t * Body.Writer.t
|
||||
| Upgrade of Response.t * (unit -> unit)
|
||||
|
||||
let output_state t ~writer : Output_state.t =
|
||||
match t with
|
||||
| Fixed _ -> Complete
|
||||
| Waiting ->
|
||||
if Serialize.Writer.is_closed writer then Complete
|
||||
else Waiting
|
||||
| Streaming(_, response_body) ->
|
||||
if Serialize.Writer.is_closed writer then Complete
|
||||
else if Body.Writer.requires_output response_body
|
||||
then Ready
|
||||
else Complete
|
||||
| Upgrade _ -> Ready
|
||||
|
||||
let flush_response_body t =
|
||||
match t with
|
||||
| Streaming (_, response_body) ->
|
||||
Body.Writer.transfer_to_writer response_body
|
||||
| _ -> ()
|
||||
Loading…
Add table
Add a link
Reference in a new issue