v0.19: http client #1451

Merged
vyzo merged 23 commits from v0.19-http into v0.19-staging 2026-06-08 22:37:22 +00:00
Owner
No description provided.
vyzo requested review from fare 2026-06-06 16:11:20 +00:00
vyzo changed title from v0.19: http things to v0.19: http client 2026-06-08 11:28:51 +00:00
fare approved these changes 2026-06-08 18:41:32 +00:00
@ -0,0 +90,4 @@
(with-zlib-error (inflateInit zstream) Z_OK)
(__open-inflate zstream reader buffer-size)))
(def (compress (data : :u8vector)
Owner

After reading the docs, it looks like compress and compress-gz are the same algorithm (RFC 1951= LZ77 + Huffman), but but compress-gz outputs things in .gz format, whereas compress outputs things in zlib format, which differ slightly in what headers and checksums they use. That ought to be documented somewhere.

After reading the docs, it looks like compress and compress-gz are the same algorithm (RFC 1951= LZ77 + Huffman), but but compress-gz outputs things in .gz format, whereas compress outputs things in zlib format, which differ slightly in what headers and checksums they use. That ought to be documented somewhere.
Author
Owner

ok, i'll put a comment.

ok, i'll put a comment.
vyzo marked this conversation as resolved
@ -0,0 +27,4 @@
(defrequest-method http-get "GET")
(defrequest-method http-head "HEAD")
(defrequest-method http-post "POST")
(defrequest-method http-put "put")
Owner

Why are these lowercase?

Why are these lowercase?
Author
Owner

brain fart, fixed.

brain fart, fixed.
vyzo marked this conversation as resolved
@ -0,0 +40,4 @@
(def (http-request (url : URL)
method: (method : :string)
headers: (uheaders : :list) ; AList [string . string]; user supplied headers
Owner

Why rename uheaders?
Maybe user-headers or user-supplied-headers
Always prefer longer names.

Why rename uheaders? Maybe user-headers or user-supplied-headers Always prefer longer names.
Author
Owner

user headers, to avoid name shadowing. I guess i could call it user-headers.

user headers, to avoid name shadowing. I guess i could call it user-headers.
vyzo marked this conversation as resolved
@ -0,0 +17,4 @@
(def (http-digest-auth-header . args)
=> :pair
(TODO http-digest-auth-header))
Owner

A job for the LLM?

A job for the LLM?
Author
Owner

yeah, too much tedious work. have you seen the spec?

yeah, too much tedious work. have you seen the spec?
@ -0,0 +1,181 @@
;;; -*- Gerbil -*-
;;; © vyzo
;;; HTTP chunked reader and writer
Owner

VERY NICE!

VERY NICE!
@ -0,0 +7,4 @@
:std/iter
:std/net/url)
(def max-line-length 16384)
Owner

Are these arbitrary, or from a standard? A comment to that effect, please. Also, is that line length for headers specifically? Deserves mention, too.

Grok tells me Apache has a 8190 line limit in practice, Nginx something similar. And that various servers seem to have 4KB to 32KB total size limit for headers, in practice.

You seem to allow a 16MB limit for headers... that seems like a lot in comparison.

Are these arbitrary, or from a standard? A comment to that effect, please. Also, is that line length for headers specifically? Deserves mention, too. Grok tells me Apache has a 8190 line limit in practice, Nginx something similar. And that various servers seem to have 4KB to 32KB total size limit for headers, in practice. You seem to allow a 16MB limit for headers... that seems like a lot in comparison.
Author
Owner

arbitrary, and that;s a lot indeed. I'll see if it is easy to make it aggregate, otherwise i'll lower to 64x2048

arbitrary, and that;s a lot indeed. I'll see if it is easy to make it aggregate, otherwise i'll lower to 64x2048
Author
Owner

64x8192

64x8192
vyzo marked this conversation as resolved
@ -0,0 +1,39 @@
;;; -*- Gerbil -*-
;;; © vyzo
Owner

OK, but why all the renames? I'm in favor of data structures making sense, and then exposing them---when possible.

OK, but why all the renames? I'm in favor of data structures making sense, and then exposing them---when possible.
Author
Owner

i want to make it easy to port existing code, including our tests that use this module a lot. We could remove it before release.

i want to make it easy to port existing code, including our tests that use this module a lot. We could remove it before release.
Author
Owner

marked deprecated.

marked deprecated.
vyzo marked this conversation as resolved
vyzo merged commit 3e2019078e into v0.19-staging 2026-06-08 22:37:22 +00:00
vyzo referenced this pull request from a commit 2026-06-08 22:37:22 +00:00
vyzo deleted branch v0.19-http 2026-06-08 22:37:30 +00:00
Sign in to join this conversation.
No description provided.