11# libbhttp
22
3- A minimal Binary HTTP (** RFC 9292** ) codec for Kotlin/JVM. Zero dependencies, one file.
4-
5- Standalone — it knows nothing about OHTTP. [ libohttp] ( ../libohttp ) consumes its output as opaque
6- bytes, but ` libbhttp ` is usable on its own anywhere a ` message/bhttp ` encoding is needed.
7-
8- ## Scope
9-
10- Today it covers the ** known-length** subset (framing indicators 0 and 1) in the two directions an
11- OHTTP client needs:
12-
13- - ` encodeRequest(BhttpRequest): ByteArray ` — RFC 9292 §3.3
14- - ` decodeResponse(ByteArray): BhttpResponse ` — RFC 9292 §3.4
15-
16- Out of scope until the chunked-OHTTP draft (` draft-ietf-ohai-chunked-ohttp ` ) finalizes:
17- ** indeterminate-length** framing (§3.6, for streaming) and the gateway directions (decode request /
18- encode response). The code is structured so those are additive.
3+ A minimal Binary HTTP (RFC 9292) codec for Kotlin/JVM, supports only what's needed for OHTTP.
194
205## Usage
216
@@ -38,16 +23,3 @@ val enc = ohttpClient.encapsulateRequest(encodeRequest(myRequest))
3823// POST enc.bytes to the relay, read the message/ohttp-res body ...
3924val response = decodeResponse(enc.decapsulateResponse(ohttpResBody))
4025```
41-
42- ## Status
43-
44- Verified byte-for-byte against the worked examples in RFC 9292 §5 (` BhttpRfcVectorsTest ` : the
45- Figure 8 request encoding and the Figure 13 response decoding).
46-
47- ## Compatibility
48-
49- Compiled to ** Java 8 bytecode** : runs on ** JDK 8+** and on Android (D8) down to old API levels —
50- it only uses ` ByteArrayOutputStream ` and basic string/byte ops, no platform-version-gated APIs.
51- Build with ` gradle build ` (Gradle 8.13, JDK 17 — no wrapper committed).
52-
53- JitPack: ` com.github.osservatorionessuno:libbhttp:0.1.0 ` (add ` maven("https://jitpack.io") ` ). GPLv3.
0 commit comments