The program server
A simple HTTP/1.1 server of this system (RFC 9110, RFC 9112): TCP in the program (support/tcp), one thread, one table of connections, and records of fixed size for all its state. It allocates nothing.
What it can reach comes from its grants only (property 20):
a segment endpoint with a listen grant: the TCP port 80, and the
remotes that send a SYN to it;
a private store in the storage service (property 9): the pages that it
serves, by name;
a service ring: the console calls its exports server.put,
server.pages, server.remove and server.served (property 19).
No shared folder: a person puts a page with server.put from the console. PUT and DELETE over HTTP are refused (405): the network is not authenticated.
main.odin: the TCP side and the loop. http.odin: the requests and the answers. pages.odin: the pages of the store, and the exports. draw.odin: the window.
| Fact | Value |
|---|---|
| Source | programs/server |
| Boot image | in the boot image; the image is not built, so its size is not known |
| Imports | none |
| Imported by | none |
Exports
| Export | What it does |
|---|---|
| entry() | |
| put(name: Text, text: Text) -> Integer | writes a page in the private store of the server, and serves it at /name from now on |
| remove(name: Text) -> Integer | takes a page out of the private store of the server: /name gives 404 from now on |
| pages() -> Table(Page_Row) | gives one row for each page that the server serves: its name, its bytes, the answers of it since the start, its content type |
| served() -> Served | gives the counts of the server: the requests that it answered, by class of status, its connections, its bytes and its pages |
Read from the source of the module, as the build reads it to describe the exports (tools/kerneltool/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | {.Network, .Serve, .Store} | A listen grant, its exports for the console, and its pages in its private store. |
| Budget: pages, programs, threads | {pages = 4096, programs = 1, threads = 1} | A table of 32 connections with their buffers, and a large window. |
Read from grants_of and things_of in programs/root/main.odin; budget_of in the same file adds the limits of processor time and of log records.
