My agentic slop goes here. Not intended for anyone else!

more

Changed files
+9 -84
stack
+1 -80
stack/requests/CLAUDE.md
···
successfully abstracts TLS configuration and CA certificate complexity while
providing a clean Eio-style API.
-
### Key Implementation Details
-
1. **Module Organization**:
-
- Auth module must be defined before Config in both .mli and .ml files (Config references Auth.t)
-
- ConnectionPool uses a GADT to hide the network type parameter
-
- Session and PoolManager use internal type aliases to avoid naming conflicts
-
-
2. **Buffer Size Limitations**:
-
- Cannot use `Int.max_int` for Eio buffer sizes (causes Bigarray creation errors)
-
- Use reasonable sizes like `16 * 1024 * 1024` (16MB) for buffer creation
-
- When converting Cohttp_eio body to Buf_read, always specify max_size
-
-
3. **Type Constraints**:
-
- Network types use polymorphic variants: `[> \`Generic] Net.t`
-
- Cannot use wildcard `_` in type declarations
-
- Use GADTs or existential types when hiding type parameters in module signatures
-
-
4. **Build Commands**:
-
- Development build: `opam exec -- dune build @check`
-
- Release build (ignores warnings): `opam exec -- dune build @check --profile=release`
-
- Documentation: `opam exec -- dune build @doc`
-
-
### Implemented Features
-
-
#### Core (urllib3-inspired):
-
- ✅ Per-host connection pooling with configurable limits
-
- ✅ Automatic retries with exponential backoff (default 10 retries)
-
- ✅ Advanced timeout handling (connect, read, total)
-
- ✅ HTTP caching with Cache-Control support
-
- ✅ Progress tracking via OCaml Logs
-
- ✅ Cookie handling in sessions
-
-
#### Authentication (requests-inspired):
-
- ✅ Basic authentication
-
- ✅ Digest authentication (RFC 2617)
-
- ✅ Bearer token (OAuth 2.0)
-
- ✅ OAuth 1.0a support
-
- ✅ OAuth 2.0 support
-
- ✅ Custom authentication handlers
-
-
#### Streaming:
-
- ✅ Upload streaming with Eio Flow sources
-
- ✅ Download streaming with Eio Flow sinks
-
- ✅ Response iteration (chunked/line-based)
-
-
### TODO - Future Work
-
-
1. **High Priority** (Core functionality):
-
- [ ] Fix remaining build issues in lib/ruminant.ml (Github.Api.Https module)
-
- [ ] Fix bin/main.ml (data.issues field issue)
-
- [ ] Complete OAuth implementation (currently stubbed)
-
- [ ] Implement actual HTTP caching storage (memory/file backends partially done)
-
- [ ] Add proper connection pool lifecycle management
-
-
2. **Medium Priority** (Enhanced features from DESIGN.md):
-
- [ ] Implement hooks system for request/response middleware
-
- [ ] Add SOCKS proxy support (design in DESIGN.md)
-
- [ ] Implement character encoding detection and conversion
-
- [ ] Add compression support (gzip, deflate, brotli when available)
-
- [ ] Implement proper multipart form data encoding
-
-
3. **Low Priority** (Advanced features):
-
- [ ] WebSocket support
-
- [ ] HTTP/2 support (when cohttp-eio adds it)
-
- [ ] HTTP/3 support (future)
-
- [ ] Connection persistence and keep-alive optimization
-
- [ ] Advanced certificate pinning
-
-
4. **Testing & Documentation**:
-
- [ ] Add comprehensive test suite for requests library
-
- [ ] Create examples directory with common use cases
-
- [ ] Write API documentation and usage guide
-
- [ ] Add benchmarks comparing with Python requests
-
-
### Known Issues
-
-
2. **Type Shadowing**: Module-level type `t` can cause shadowing issues in nested modules. Use unique type names or GADTs to avoid conflicts.
-
-
3. **Module Dependencies**: Auth module must come before Config in the interface due to Config's create function taking an Auth.t parameter.
-
-
4. **Warnings**: Many unused variables in stub implementations need cleanup once features are fully implemented.
···
successfully abstracts TLS configuration and CA certificate complexity while
providing a clean Eio-style API.
+
As a matter of good hygeine, dont import Requests at the top of the test files but use it when needed or do a local open
+1 -1
stack/requests/lib/dune
···
(library
(public_name requests)
(name requests)
-
(modules :standard \ digest_auth requests_cache requests_types)
(libraries
eio
eio.unix
···
(library
(public_name requests)
(name requests)
+
(modules :standard \ digest_auth)
(libraries
eio
eio.unix
+1
stack/requests/lib/requests.ml
···
module Status = Status
module Error = Error
module Retry = Retry
(* Main API - Session functionality with concurrent fiber spawning *)
···
module Status = Status
module Error = Error
module Retry = Retry
+
module Cache = Requests_cache
(* Main API - Session functionality with concurrent fiber spawning *)
+3
stack/requests/lib/requests.mli
···
(** Timeout configuration for requests *)
module Timeout = Timeout
(** {2 Logging} *)
(** Log source for the requests library.
···
(** Timeout configuration for requests *)
module Timeout = Timeout
+
(** HTTP caching with cache control and range request support *)
+
module Cache = Requests_cache
+
(** {2 Logging} *)
(** Log source for the requests library.
+3 -3
stack/requests/lib/requests_cache.ml
···
(* Store metadata *)
let metadata_key = key ^ ".meta" in
let metadata = serialize_metadata ~status ~headers in
-
let metadata_source = Flow.string_source metadata in
Cacheio.put cache ~key:metadata_key ~source:metadata_source ~ttl ();
(* Store body directly from source *)
···
let rec read_chunks () =
let chunk = Cstruct.create 8192 in
try
-
let n = Flow.single_read source chunk in
if n > 0 then begin
on_chunk (Cstruct.to_string ~off:0 ~len:n chunk);
read_chunks ()
···
let rec read_chunk () =
let chunk = Cstruct.create 8192 in
try
-
let n = Flow.single_read source chunk in
if n > 0 then begin
on_chunk (Cstruct.to_string ~off:0 ~len:n chunk);
read_chunk ()
···
(* Store metadata *)
let metadata_key = key ^ ".meta" in
let metadata = serialize_metadata ~status ~headers in
+
let metadata_source = Eio.Flow.string_source metadata in
Cacheio.put cache ~key:metadata_key ~source:metadata_source ~ttl ();
(* Store body directly from source *)
···
let rec read_chunks () =
let chunk = Cstruct.create 8192 in
try
+
let n = Eio.Flow.single_read source chunk in
if n > 0 then begin
on_chunk (Cstruct.to_string ~off:0 ~len:n chunk);
read_chunks ()
···
let rec read_chunk () =
let chunk = Cstruct.create 8192 in
try
+
let n = Eio.Flow.single_read source chunk in
if n > 0 then begin
on_chunk (Cstruct.to_string ~off:0 ~len:n chunk);
read_chunk ()