Skip to content

Commit 30a4fba

Browse files
committed
Updated README and workflow for doc build
1 parent 81824ce commit 30a4fba

3 files changed

Lines changed: 76 additions & 4 deletions

File tree

.github/workflows/rust.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
name: Rust
1+
name: Rust Test and Deplou to GitHub Pages
22

33
on:
44
push:
55
branches: [ "main" ]
66
pull_request:
77
branches: [ "main" ]
88

9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
913
env:
1014
CARGO_TERM_COLOR: always
1115

@@ -20,3 +24,14 @@ jobs:
2024
run: cargo build --verbose
2125
- name: Run tests
2226
run: cargo test --verbose
27+
- name: Generate Documentation
28+
run: cargo doc --no-deps --document-private-items
29+
- name: Setup Pages
30+
uses: actions/configure-pages@v4
31+
- name: Upload Artifact
32+
uses: actions/upload-pages-artifact@v3
33+
with:
34+
# Path to the generated docs
35+
path: target/doc
36+
- name: Deploy to GitHub Pages
37+
uses: actions/deploy-pages@v4

README.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,59 @@
22
A multi-threaded TCP/HTTP server built in Rust, following the implementation patterns from The Rust Programming Language (Chapter 20).
33

44
## Motivation
5-
I am an Aerospace Engineer, and Embedded Software developer.
6-
While I am comfortable with real-time constraints, memory-mapped I/O, and hardware protocols like SPI/I2C, I knew nothing about Computer next works.
5+
I am an Aerospace Engineer, and Embedded Software developer, who aims to pursue a masters in CS.
6+
While I am comfortable with real-time constraints, memory-mapped I/O, and hardware protocols, I knew nothing about Computer networks.
7+
In RED, IST's rocketry team, my focus is the Embedded Software running on our flight computer. The GroundStation, which hosts a web-server for a dashboard to monitor the mission is equally important.
8+
Becoming The Software Team leader, I found necessary to also learn more about Computer networks in order to have a better vision of how to implement the GroudStation backend.
79

8-
This project serves as way to learn a little about computer networks, while also practing my rust Programming skills :).
10+
This project serves as way to learn a little about computer networks, while also practising my rust Programming skills :).
11+
12+
## The concepts explored
13+
14+
1. **TCP/IP Stack**
15+
1. TCP Handshake: Implementing the logic that manages reliable, ordered data delivery.
16+
2. The 5-Tuple: Understanding how the OS identifies unique connections via Source/Dest IP, Ports, and Protocol.
17+
18+
2. **HTTP/1.1 Protocol**
19+
1. I Implemented a manual parser for HTTP requests. This taught me that web communication is essentially just a specific "packet format" (headers vs. body) delimited by `\r\n\r\n`.
20+
2. Header Precision: Learning the hard way that a single typo (like Content-lenght vs Content-Length) can break the entire "telemetry" stream to the browser.
21+
3. Status Codes: Mapping server states to standard HTTP responses (200 OK, 404 Not Found).
22+
23+
3. **Concurrent Architecture (Thread Pooling)**
24+
1. This server, uses a Thread Pool to handle simultaneous requests.
25+
2. The
26+
```Rust
27+
Arc<Mutex<mpsc::Receiver>>
28+
``` Combining Atomic Reference Counting and Mutual Exclusion to safely distribute jobs accros worker threads without data races. I found this to be particular different from C( the lang i usually use at RED), especially the fact that the Mutex is automaticaly "Unlocked", whereas in C, i have to manualy unlock the mutex.
29+
3. Using closures (`FnOnce`) and `Box` to pass tasks efficiently.
30+
31+
## The Project Structure (As of now ...)
32+
33+
1. `main.rs`: The entry point. Handles the TCP Listener and CLI input for pool sizing.
34+
35+
2. `lib.rs`: The "Engine." Contains the ThreadPool and Worker implementations.
36+
37+
3. html/: The payload directory containing the web assets.
38+
39+
## If you want to run this
40+
41+
### Prerequisites
42+
43+
1. Rust (2021 onwards)
44+
2. Git
45+
46+
### Instalation and Execution
47+
48+
1. **Clone the repo** :
49+
```Bash
50+
git clone https://github.com/sofiavldd2005/web_server_made_rusty.git
51+
cd web_server_made_rusty
52+
```
53+
2. **Run**: `cargo run`
54+
55+
3. Configure the thread pool : give a number of threads
56+
57+
4. As of now, go to your browser and navigate to `http://127.0.0.1:7878`
58+
59+
This project is inspired by the final project in "The Rust Programming Language" book, customized to explore the intersection of aerospace logic and web networking.
60+
More is comming to improve starting from this projet.

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! # Web Server Made Rusty
2+
//!
3+
//! This library provides a thread pool implementation designed for
4+
//! handling concurrent TCP connections, specifically tailored for
5+
//! learning the HTTP/1.1 protocol .
16
use std::{
27
sync::{mpsc, Arc, Mutex},
38
thread,

0 commit comments

Comments
 (0)