yuk1ty / learning-systems-programming-in-rust

「Rustでもわかるシステムプログラミング」
430 stars 23 forks source link

2.8 Q3: MultiWriter を使って stdout & TcpStream(gzip) へ書き込むHTTPサーバーを実装 #45

Closed laysakura closed 3 years ago

laysakura commented 3 years ago

Fixes: #6

https://github.com/yuk1ty/learning-systems-programming-in-rust/pull/38 と合わせ、gzip圧縮には flate2 crate を使用。

動作確認

サーバ側:

% cargo run --bin 2_8_3
   Compiling chapter2 v0.1.0 (/Users/sho.nakatani/.ghq/src/github.com/yuk1ty/learning-systems-programming-in-rust/chapter2)
    Finished dev [unoptimized + debuginfo] target(s) in 0.73s
     Running `target/debug/2_8_3`
{ "Hello": "World" }  <- ログ出力

クライアント側:

% curl -s --compressed 'http://localhost:8080' -H 'Accept-Encoding: gzip'
{ "Hello": "World" }
laysakura commented 3 years ago

@yuk1ty コンフリクト解消しました :v:

laysakura commented 3 years ago

@yuk1ty マージしてもokですか?

yuk1ty commented 3 years ago

マージします!