v0.19: http server #1454

Merged
vyzo merged 35 commits from v0.19-http-server into v0.19-staging 2026-06-13 01:37:39 +00:00
Owner
No description provided.
tested in repl, needs unit tests.
removes the need to kludge imports into the user module.
fare approved these changes 2026-06-10 01:01:55 +00:00
@ -11,1 +11,4 @@
(def __DEBUG-COMPILE
(and (string? __DEBUG)
(string-contains __DEBUG "compilation")))
Owner

That doesn't sound very robust.

That doesn't sound very robust.
Author
Owner

its fine, its debugging last resort.

its fine, its debugging last resort.
vyzo marked this conversation as resolved
Owner

OK, but do you have example uses of it?
The old with-id has a sandwich in a pair of syntax-local-introduce.
How does this work with only one? What effect does that achieve and how to counter it?

OK, but do you have example uses of it? The old with-id has a sandwich in a pair of `syntax-local-introduce`. How does this work with only one? What effect does that achieve and how to counter it?
vyzo force-pushed v0.19-http-server from 631a78a5ea to 3b5ae6b543 2026-06-10 05:15:08 +00:00 Compare
vyzo force-pushed v0.19-http-server from 11c6ccb44d to 3bb7ff8826 2026-06-10 19:34:39 +00:00 Compare
vyzo force-pushed v0.19-http-server from 3bb7ff8826 to 6257034320 2026-06-11 01:02:47 +00:00 Compare
Author
Owner

At this point it is done, within current scope.

Once gerbil build and ensembles have been ported, I will circle back to gxhttpd for the tests and I will also change the mux to be endpoint based similar to the new static mux. But as far as the v19 porting progression is concerned, this is done.

At this point it is done, within current scope. Once gerbil build and ensembles have been ported, I will circle back to gxhttpd for the tests and I will also change the mux to be endpoint based similar to the new static mux. But as far as the v19 porting progression is concerned, this is done.
@ -0,0 +8,4 @@
(export open-detachable-reader
open-detachable-writer)
(defstruct detachable-io
Owner

Why a struct rather than a class? This one looks like a typical trait orthogonal to many other traits.

Why a struct rather than a class? This one looks like a typical trait orthogonal to many other traits.
Author
Owner

sure, why not. it's just my default.

sure, why not. it's just my default.
vyzo marked this conversation as resolved
@ -0,0 +15,4 @@
((reader :- Reader)))
(defstruct (detachable-writer detachable-io)
((writer :- Writer)))
Owner

If these were classes, you could be both reader and writer at the same time!

If these were classes, you could be both reader and writer at the same time!
vyzo marked this conversation as resolved
@ -5,3 +5,3 @@
(export #t)
(def (compress-gz (file : :string)) => :string
(def (compress-gzip (file : :string)) => :string
Owner

These days, xz might be a better fit for archival, or ztd when the logs is still likely to be read.

These days, xz might be a better fit for archival, or ztd when the logs is still likely to be read.
Author
Owner

gzip is part of core-utils, it is the saner default. user can always use a different compressor.

gzip is part of core-utils, it is the saner default. user can always use a different compressor.
vyzo marked this conversation as resolved
@ -0,0 +12,4 @@
new-directory-listing-handler)
(defstruct directory-handler
((path :- :string)
Owner

These needs comments to distinguish them, or better variable names.

These needs comments to distinguish them, or better variable names.
Author
Owner

ok, comments it is.

ok, comments it is.
vyzo marked this conversation as resolved
@ -0,0 +29,4 @@
(string-substitute-char (stx-e #'text) #\- #\space)))))
(with-identifier (handler #'status #'status "-handler")
#'(def handler
(empty-request-handler status))))))
Owner

Shouldn't we also output the text as response? Or possibly something custom?

User-facing servers might want to add fancy pages there too, yet all the services shouldn't have to know how fancy or not the server is.

Shouldn't we also output the text as response? Or possibly something custom? User-facing servers might want to add fancy pages there too, yet all the services shouldn't have to know how fancy or not the server is.
Author
Owner

eh, let's keep the core minimal. we'll cross that bridge when we get there, no need to do it now. I will add a TODO note however.

eh, let's keep the core minimal. we'll cross that bridge when we get there, no need to do it now. I will add a TODO note however.
Author
Owner

actually I'll add the body field now, and have it empty.

actually I'll add the body field now, and have it empty.
Author
Owner

done

done
vyzo marked this conversation as resolved
@ -34,0 +14,4 @@
(defclass Config
(;; path to server root
(root : :string)
;; list of handler modules, prefixed by mux rules
Owner

Not precise enough. Give a complete type, even if informal, e.g.
(List (Pair MuxRule (Procedure Foo Bar -> Baz))
where MuxRule is itself defined here or in the other file (but say here in which other file that is).

Not precise enough. Give a complete type, even if informal, e.g. (List (Pair MuxRule (Procedure Foo Bar -> Baz)) where MuxRule is itself defined here or in the other file (but say here in which other file that is).
Author
Owner

this is not finalized yet, i will circle back to gxhttpd later and do a better mux. no need to commit to anything yet, the mux will change.

this is not finalized yet, i will circle back to gxhttpd later and do a better mux. no need to commit to anything yet, the mux will change.
@ -60,3 +69,3 @@
(save-config! cfg (or (hash-get opt 'config) (httpd-config-path)))))
(def (set-ensemble-config! opt cfg)
;; (def (set-ensemble-config! opt cfg)
Owner

Hopefully, the ensemble stuff would go to a separate file.

Hopefully, the ensemble stuff would go to a separate file.
Author
Owner

yeah, it will be revisited.

yeah, it will be revisited.
vyzo marked this conversation as resolved
fare approved these changes 2026-06-12 18:40:51 +00:00
@ -0,0 +8,4 @@
(export #t)
;; TODO add a body field to allow fancy servers to custom the
;; default empty handlers with their oomph.
Owner

Replace this TODO by a comment on the body field

Replace this TODO by a comment on the body field
Author
Owner

ah yes, sorry

ah yes, sorry
vyzo marked this conversation as resolved
vyzo merged commit 9e207a00dd into v0.19-staging 2026-06-13 01:37:39 +00:00
vyzo referenced this pull request from a commit 2026-06-13 01:37:40 +00:00
vyzo deleted branch v0.19-http-server 2026-06-13 01:37:54 +00:00
Sign in to join this conversation.
No description provided.