@@ -0,0 +1,98 @@
1++++
2+title = "HTTP Server IO Driver"
3+date = "2022-11-28"
4+
5+[taxonomies]
6+grant_type = [ "Bounty" ]
7+grant_category = [ "Core Dev", "Runtime" ]
8+
9+[extra]
10+image =""
11+description = "Rewrite the HTTP server driver in Rust"
12+reward = "2 stars"
13+mentor = "~fanfun-mocbud"
14+assignee = ""
15+grant_id = ""
16+completed = false
17+work_request_link = ""
18++++
19+
20+# HTTP Server IO Driver
21+
22+## Context
23+
24+All IO drivers in the Urbit runtime currently run in the same process, which is
25+called the "urth" or "king" process. As part of an effort to both increase
26+security and scalability in the runtime, we are splitting each IO driver into
27+its own process, which is capable of communicating over local (i.e. pipes) or
28+remote (i.e. TCP sockets) communication channels.
29+
30+## Description
31+
32+In the [IO drivers repo](https://github.com/urbit/io_drivers), we use the
33+following abstract model of a driver:
34+
35+```
36+ INPUT SOURCE
37+ |
38+ | serialized request (length-encoded, jammed noun)
39+ |
40++---------------+
41+| INPUT TASK |
42++---------------+
43+ |
44+ | deserialized request (noun)
45+ |
46++---------------+
47+| HANDLING TASK |
48++---------------+
49+ |
50+ | deserialized response (noun)
51+ |
52++---------------+
53+| OUTPUT TASK |
54++---------------+
55+ |
56+ | serialized response (length-encoded, jammed noun)
57+ |
58+ OUTPUT SINK
59+```
60+
61+For this bounty, you must rewrite the HTTP server IO driver in
62+[`pkg/urbit/vere/io/http.c`](https://github.com/urbit/urbit/blob/master/pkg/urbit/vere/io/http.c)
63+in the [Urbit repo](https://github.com/urbit/urbit) to fit the driver model
64+described above in a new module [`src/http/server.rs`] in the
65+[IO drivers repo](https://github.com/urbit/io_drivers) with `stdin` and `stdout`
66+as the input source and output sink, respectively. The [HTTP client
67+driver](https://github.com/urbit/io_drivers/blob/master/src/http/client.rs) and
68+[file system driver](https://github.com/urbit/io_drivers/blob/master/src/fs.rs)
69+will serve as useful references.
70+
71+## Requirements
72+
73+- Knowledge of C and Rust.
74+- Experience with asynchronous, task-based programming.
75+- Familiarity with HTTP.
76+
77+## Resources
78+
79+- [Scalable
80+ IO](https://gist.github.com/mcevoypeter/a682dcd2d7c037c3b96de7268a7c2617)
81+- [Scaling Urbit's
82+ Runtime](https://gist.github.com/mcevoypeter/fe0270c9a4a72a9350c0f8944612bbf6)
83+
84+
85+## Deliverables
86+
87+- A thoroughly-documented HTTP server driver implementation in
88+ `src/http/server.rs` using `stdin` and `stdout` as the input source and output
89+ sink, respectively.
90+- A complete suite of unit tests structured as a `tests` module in
91+ `src/http/server.rs` that exercises the conversions from request nouns into
92+ driver-specific data structures and from driver-specific data structures into
93+ response nouns.
94+- A complete suite of integration tests in `tests/http_server_tests.rs` that run
95+ the spawn the HTTP server driver in a separate process and feed it requests as
96+ jammed nouns.
97+
98+Upon completion of all deliverables, you will receive two (2) stars.