@@ -129,7 +129,7 @@ module Html_base = struct
129129 let send ?options :_ ?charset ?code ?content_type ?headers c =
130130 let status = Eliom_lib.Option. map Cohttp.Code. status_of_code code
131131 and content_type = content_type_html content_type
132- and body = Cohttp_lwt .Body. of_string (Format. asprintf " %a" out c) in
132+ and body = Ocsigen_response .Body. of_string (Format. asprintf " %a" out c) in
133133 result_of_content ?charset ?headers ?status ~content_type body
134134end
135135
@@ -148,9 +148,8 @@ module Flow5_base = struct
148148 Eliom_content.Html.Printer. pp_elt ~encode ()
149149
150150 let body l =
151- Lwt_stream. of_list l
152- |> Lwt_stream. map (Format. asprintf " %a" out)
153- |> Cohttp_lwt.Body. of_stream
151+ Ocsigen_response.Body. make Cohttp.Transfer. Unknown (fun write ->
152+ Lwt_list. iter_s (fun x -> write (Format. asprintf " %a" out x)) l)
154153
155154 let send ?options :_ ?charset ?code ?content_type ?headers c =
156155 let status = Eliom_lib.Option. map Cohttp.Code. status_of_code code
@@ -183,7 +182,7 @@ module String_base = struct
183182
184183 let send ?options ?charset ?code ?content_type :_ ?headers (c, content_type) =
185184 let status = Eliom_lib.Option. map Cohttp.Code. status_of_code code
186- and body = Cohttp_lwt .Body. of_string c
185+ and body = Ocsigen_response .Body. of_string c
187186 and headers = add_cache_header options (Ocsigen_header. of_option headers) in
188187 result_of_content ?charset ?status ~content_type ~headers body
189188end
@@ -258,7 +257,7 @@ module Action_base = struct
258257 | _ -> headers
259258 and status = Cohttp.Code. status_of_code code in
260259 result_of_content ?charset ?content_type ~headers ~status
261- Cohttp_lwt .Body. empty
260+ Ocsigen_response .Body. empty
262261 | `Reload -> (
263262 (* It is an action, we reload the page. To do that, we retry
264263 without POST params.
@@ -358,7 +357,7 @@ module Unit_base = struct
358357 let send ?options :_ ?charset ?(code = 204 ) ?content_type ?headers _content =
359358 let status = Cohttp.Code. status_of_code code in
360359 result_of_content ?charset ?content_type ?headers ~status
361- Cohttp_lwt .Body. empty
360+ Ocsigen_response .Body. empty
362361end
363362
364363module Unit = Eliom_mkreg. Make (Unit_base )
@@ -382,7 +381,7 @@ module Any_base = struct
382381 (result : 'a kind )
383382 =
384383 let result = Result_types. cast_kind result in
385- let cohttp_response = fst ( Ocsigen_response. to_cohttp result) in
384+ let cohttp_response = Ocsigen_response. response result in
386385 let headers =
387386 headers_with_content_type ?charset ?content_type
388387 (Cohttp.Response. headers cohttp_response)
@@ -442,15 +441,15 @@ module File_base = struct
442441 raise Eliom_common. Eliom_404
443442 with
444443 | Ocsigen_local_files. RFile fname ->
445- let * response, body =
444+ let * res =
446445 let headers =
447446 Ocsigen_header. of_option headers
448447 |> add_cache_header options
449448 |> headers_with_content_type ?charset ?content_type
450449 in
451450 Cohttp_lwt_unix.Server. respond_file ~headers ~fname ()
452451 in
453- Lwt. return (Ocsigen_response. make ~body response )
452+ Lwt. return (Ocsigen_response. of_cohttp res )
454453 | Ocsigen_local_files. RDir _ ->
455454 (* FIXME COHTTP TRANSITION: implement directories *)
456455 raise Ocsigen_local_files. Failed_404
@@ -1154,7 +1153,8 @@ module App_base (App_param : Eliom_registration_sigs.APP_PARAM) = struct
11541153 (match sp.Eliom_common. sp_client_appl_name, options.do_not_launch with
11551154 | None , true -> remove_eliom_scripts content
11561155 | _ -> add_eliom_scripts ~sp content)
1157- > |= fun body -> Cohttp_lwt.Body. of_string (Format. asprintf " %a" out body)
1156+ > |= fun body ->
1157+ Ocsigen_response.Body. of_string (Format. asprintf " %a" out body)
11581158 in
11591159 let headers =
11601160 let h = Ocsigen_header. of_option headers in
@@ -1303,7 +1303,7 @@ module String_redirection_base = struct
13031303 in
13041304 let headers = Cohttp.Header. replace headers header_id uri in
13051305 result_of_content ?charset ?content_type ~status ~headers
1306- ( Cohttp .Body. empty :> Cohttp_lwt.Body.t )
1306+ Ocsigen_response .Body. empty
13071307end
13081308
13091309module String_redirection = Eliom_mkreg. Make (String_redirection_base )
@@ -1369,7 +1369,7 @@ module Redirection_base = struct
13691369 uri
13701370 in
13711371 result_of_content ?charset ?content_type ~status ~headers
1372- ( Cohttp .Body. empty :> Cohttp_lwt.Body.t )
1372+ Ocsigen_response .Body. empty
13731373 | true , Some anr ->
13741374 let headers =
13751375 Cohttp.Header. replace headers Eliom_common_base. appl_name_header_name
@@ -1394,7 +1394,7 @@ module Redirection_base = struct
13941394 uri
13951395 in
13961396 result_of_content ?charset ?content_type ~status: `No_content ~headers
1397- ( Cohttp .Body. empty :> Cohttp_lwt.Body.t )
1397+ Ocsigen_response .Body. empty
13981398end
13991399
14001400module Redirection = struct
0 commit comments