UrbitGrants

HTTP Server IO Driver

In Progress
Bounty
Core Dev
Runtime

ID

B0208

Date

November 28, 2022

Grantee(s)

~soctun-ridsyr

HTTP Server IO Driver

Context

All IO drivers in the Urbit runtime currently run in the same process, which is called the "urth" or "king" process. As part of an effort to both increase security and scalability in the runtime, we are splitting each IO driver into its own process, which is capable of communicating over local (i.e. pipes) or remote (i.e. TCP sockets) communication channels.

Description

In the IO drivers repo, we use the following abstract model of a driver:

INPUT SOURCE
|
| serialized request (length-encoded, jammed noun)
|
+---------------+
| INPUT TASK |
+---------------+
|
| deserialized request (noun)
|
+---------------+
| HANDLING TASK |
+---------------+
|
| deserialized response (noun)
|
+---------------+
| OUTPUT TASK |
+---------------+
|
| serialized response (length-encoded, jammed noun)
|
OUTPUT SINK

For this bounty, you must rewrite the HTTP server IO driver in pkg/urbit/vere/io/http.c in the Urbit repo to fit the driver model described above in a new module [src/http/server.rs] in the IO drivers repo with stdin and stdout as the input source and output sink, respectively. The HTTP client driver and file system driver will serve as useful references.

Requirements

  • Knowledge of C and Rust.
  • Experience with asynchronous, task-based programming.
  • Familiarity with HTTP.

Resources

Deliverables

  • A thoroughly-documented HTTP server driver implementation in src/http/server.rs using stdin and stdout as the input source and output sink, respectively.
  • A complete suite of unit tests structured as a tests module in src/http/server.rs that exercises the conversions from request nouns into driver-specific data structures and from driver-specific data structures into response nouns.
  • A complete suite of integration tests in tests/http_server_tests.rs that run the spawn the HTTP server driver in a separate process and feed it requests as jammed nouns.

Upon completion of all deliverables, you will receive two (2) stars.