My agentic slop goes here. Not intended for anyone else!
at main 2.3 kB view raw
1(* 2 * Copyright (c) 2014, OCaml.org project 3 * Copyright (c) 2015 KC Sivaramakrishnan <sk826@cl.cam.ac.uk> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 *) 17 18(** HTTP session management for fetching feeds. *) 19 20type t 21(** An abstract HTTP session for fetching feeds. 22 23 The session manages HTTP connections and is tied to an Eio switch 24 for proper resource cleanup. *) 25 26val init : 27 sw:Eio.Switch.t -> 28 < clock : float Eio.Time.clock_ty Eio.Resource.t; 29 fs : Eio.Fs.dir_ty Eio.Path.t; 30 net : [ `Generic | `Unix ] Eio.Net.ty Eio.Resource.t; .. > -> 31 t 32(** [init ~sw env] creates a new HTTP session. 33 34 The session is configured with appropriate defaults for fetching feeds: 35 - User-Agent: "OCaml-River/1.0" 36 - Automatic redirect following (max 5 redirects) 37 - TLS verification enabled 38 39 @param sw The switch for resource management 40 @param env The Eio environment *) 41 42val with_session : 43 < clock : float Eio.Time.clock_ty Eio.Resource.t; 44 fs : Eio.Fs.dir_ty Eio.Path.t; 45 net : [ `Generic | `Unix ] Eio.Net.ty Eio.Resource.t; .. > -> 46 (t -> 'a) -> 'a 47(** [with_session env f] creates a session and automatically manages its lifecycle. 48 49 This is the recommended way to use River as it ensures proper cleanup. 50 51 @param env The Eio environment 52 @param f The function to run with the session *) 53 54val get_requests_session : t -> 55 (float Eio.Time.clock_ty Eio.Resource.t, 56 [`Generic | `Unix] Eio.Net.ty Eio.Resource.t) Requests.t 57(** [get_requests_session t] returns the underlying Requests session. 58 59 This is used internally by the Feed module. *)