Skip to content

Commit 0ab309a

Browse files
committed
feat: update web server
1 parent 2b50dac commit 0ab309a

File tree

192 files changed

+88
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+88
-50
lines changed

adder/target/.rustc_info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"rustc_fingerprint":3299840891311980700,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.67.0 (fc594f156 2023-01-24)\nbinary: rustc\ncommit-hash: fc594f15669680fa70d255faec3ca3fb507c3405\ncommit-date: 2023-01-24\nhost: x86_64-apple-darwin\nrelease: 1.67.0\nLLVM version: 15.0.6\n","stderr":""},"15697416045686424142":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/mac/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}}
1+
{"rustc_fingerprint":3299840891311980700,"outputs":{"15697416045686424142":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.67.0 (fc594f156 2023-01-24)\nbinary: rustc\ncommit-hash: fc594f15669680fa70d255faec3ca3fb507c3405\ncommit-date: 2023-01-24\nhost: x86_64-apple-darwin\nrelease: 1.67.0\nLLVM version: 15.0.6\n","stderr":""},"9145534597574502034":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"1008668923510693610":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/mac/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/mac/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}}

guessing_game/target/.rustc_info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"rustc_fingerprint":3299840891311980700,"outputs":{"15697416045686424142":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/mac/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.67.0 (fc594f156 2023-01-24)\nbinary: rustc\ncommit-hash: fc594f15669680fa70d255faec3ca3fb507c3405\ncommit-date: 2023-01-24\nhost: x86_64-apple-darwin\nrelease: 1.67.0\nLLVM version: 15.0.6\n","stderr":""}},"successes":{}}
1+
{"rustc_fingerprint":3299840891311980700,"outputs":{"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/mac/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.67.0 (fc594f156 2023-01-24)\nbinary: rustc\ncommit-hash: fc594f15669680fa70d255faec3ca3fb507c3405\ncommit-date: 2023-01-24\nhost: x86_64-apple-darwin\nrelease: 1.67.0\nLLVM version: 15.0.6\n","stderr":""},"15697416045686424142":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"1008668923510693610":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/mac/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"9145534597574502034":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""}},"successes":{}}

hello/404.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Hello!</title>
6+
</head>
7+
<body>
8+
<h1>Oops!</h1>
9+
<p>Sorry, I don't know what you're asking for.</p>
10+
</body>
11+
</html>

hello_cargo/Cargo.lock renamed to hello/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hello_cargo/Cargo.toml renamed to hello/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "hello_cargo"
2+
name = "hello"
33
version = "0.1.0"
44
edition = "2021"
55

hello/hello.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Hello!</title>
6+
</head>
7+
<body>
8+
<h1>Hello!</h1>
9+
<p>Hi from Rust</p>
10+
</body>
11+
</html>

hello/src/main.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use std::fs;
2+
use std::io::prelude::*;
3+
use std::net::TcpStream;
4+
use std::net::TcpListener;
5+
6+
fn main() {
7+
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
8+
9+
for stream in listener.incoming() {
10+
let stream = stream.unwrap();
11+
12+
println!("Connection established!");
13+
handle_connection(stream);
14+
}
15+
}
16+
17+
fn handle_connection(mut stream: TcpStream) {
18+
let mut buffer = [0; 1024];
19+
stream.read(&mut buffer).unwrap();
20+
21+
let get = b"GET / HTTP/1.1\r\n";
22+
23+
let (status_line, filename) = if buffer.starts_with(get) {
24+
("HTTP/1.1 200 OK\r\n\r\n", "hello.html")
25+
} else {
26+
("HTTP/1.1 404 NOT FOUND\r\n\r\n", "404.html")
27+
};
28+
29+
let contents = fs::read_to_string(filename).unwrap();
30+
31+
let response = format!("{}{}", status_line, contents);
32+
33+
stream.write(response.as_bytes()).unwrap();
34+
stream.flush().unwrap();
35+
}

hello/target/.rustc_info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc_fingerprint":3299840891311980700,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.67.0 (fc594f156 2023-01-24)\nbinary: rustc\ncommit-hash: fc594f15669680fa70d255faec3ca3fb507c3405\ncommit-date: 2023-01-24\nhost: x86_64-apple-darwin\nrelease: 1.67.0\nLLVM version: 15.0.6\n","stderr":""},"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/mac/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"9145534597574502034":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"15697416045686424142":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"1008668923510693610":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/mac/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}}
File renamed without changes.
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
053065036bc30b58
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":2209823359022848052,"features":"[]","target":8206159660137867950,"profile":11736316127369858332,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/hello-1095e215a54bb59e/dep-bin-hello"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a4c6bfb838bddf9e
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":2209823359022848052,"features":"[]","target":8206159660137867950,"profile":17483045194147818835,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/hello-2e06ae3ac2461c17/dep-bin-hello"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3bdc7672e2c2f5ec
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":2209823359022848052,"features":"[]","target":8206159660137867950,"profile":11506243869495082934,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/hello-c109d4457b513994/dep-test-bin-hello"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
559 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/Users/mac/Developer/project/demos-of-rust/hello/target/debug/deps/hello-1095e215a54bb59e: src/main.rs
2+
3+
/Users/mac/Developer/project/demos-of-rust/hello/target/debug/deps/hello-1095e215a54bb59e.d: src/main.rs
4+
5+
src/main.rs:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/Users/mac/Developer/project/demos-of-rust/hello/target/debug/deps/hello-2e06ae3ac2461c17.rmeta: src/main.rs
2+
3+
/Users/mac/Developer/project/demos-of-rust/hello/target/debug/deps/hello-2e06ae3ac2461c17.d: src/main.rs
4+
5+
src/main.rs:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/Users/mac/Developer/project/demos-of-rust/hello/target/debug/deps/hello-c109d4457b513994.rmeta: src/main.rs
2+
3+
/Users/mac/Developer/project/demos-of-rust/hello/target/debug/deps/hello-c109d4457b513994.d: src/main.rs
4+
5+
src/main.rs:

hello/target/debug/hello

559 KB
Binary file not shown.

hello/target/debug/hello.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Users/mac/Developer/project/demos-of-rust/hello/target/debug/hello: /Users/mac/Developer/project/demos-of-rust/hello/src/main.rs

hello_cargo/src/main.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

hello_cargo/target/.rustc_info.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/debug/.fingerprint/hello_cargo-46e85efef9e67096/bin-hello_cargo

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/debug/.fingerprint/hello_cargo-46e85efef9e67096/bin-hello_cargo.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/debug/.fingerprint/hello_cargo-abcbab39fe622d32/bin-hello_cargo

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/debug/.fingerprint/hello_cargo-abcbab39fe622d32/bin-hello_cargo.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/debug/.fingerprint/hello_cargo-c9f90269dd61388a/test-bin-hello_cargo

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/debug/.fingerprint/hello_cargo-c9f90269dd61388a/test-bin-hello_cargo.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/debug/deps/hello_cargo-46e85efef9e67096.d

Lines changed: 0 additions & 5 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

hello_cargo/target/debug/deps/hello_cargo-abcbab39fe622d32.d

Lines changed: 0 additions & 5 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

hello_cargo/target/debug/deps/hello_cargo-c9f90269dd61388a.d

Lines changed: 0 additions & 5 deletions
This file was deleted.

hello_cargo/target/debug/hello_cargo

-470 KB
Binary file not shown.

hello_cargo/target/debug/hello_cargo.d

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/release/.fingerprint/hello_cargo-c71352d8e5599334/bin-hello_cargo

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/release/.fingerprint/hello_cargo-c71352d8e5599334/bin-hello_cargo.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_cargo/target/release/.fingerprint/hello_cargo-c71352d8e5599334/invoked.timestamp

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.

hello_cargo/target/release/deps/hello_cargo-c71352d8e5599334.d

Lines changed: 0 additions & 5 deletions
This file was deleted.
-467 KB
Binary file not shown.

hello_cargo/target/release/hello_cargo.d

Lines changed: 0 additions & 1 deletion
This file was deleted.

hello_world/hello_world

-467 KB
Binary file not shown.

hello_world/hello_world.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)