Skip to content

Instantly share code, notes, and snippets.

@masakielastic
masakielastic / README.md
Last active February 23, 2026 19:07
nghttp2 でブロッキングな h2c サーバー (TLS なしの HTTP/2 サーバー)

nghttp2 でブロッキングな h2c サーバー (TLS なしの HTTP/2 サーバー)

gcc -Wall -Wextra -O2 server.c -o server $(pkg-config --cflags --libs libnghttp2)
masakielastic@penguin:~/http-server$ ./server
Listening on 127.0.0.1:8080 (h2c prior-knowledge)
Try: nghttp -v http://127.0.0.1:8080/ --no-tls --pri
@masakielastic
masakielastic / 01-README.md
Last active March 10, 2026 03:30
nghttp2 でブロッキングな HTTP クライアント (イベントループなし)

nghttp2 でブロッキングな HTTP クライアント (イベントループなし)

gcc -Wall -Wextra -O2 client.c -o client $(pkg-config --cflags --libs libnghttp2 openssl)
./client httpbin.org 443 /get
H: :status: 200
@masakielastic
masakielastic / README.md
Created February 23, 2026 16:22
HPACK を利用する (fluke-hpack) | Rust

HPACK を利用する (fluke-hpack) | Rust

Cargo.toml

[dependencies]
fluke-hpack = "0.3"
@masakielastic
masakielastic / README.md
Created February 23, 2026 10:18
tiny_http サーバーでシングルスレッドの HTTP/1 サーバー| PHP 拡張 | Rust

tiny_http サーバーでシングルスレッドの HTTP/1 サーバー| PHP 拡張 | Rust

Cargo.toml

[package]
name = "php_httpd_ext"
version = "0.1.0"
edition = "2021"

reqwest を使った HTTP クライアント (ブロッキングモード) |PHP 拡張モジュール | Rust

Cargo.toml

[package]
name = "php_http_client"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Last active February 23, 2026 08:44
HTTP メッセージを扱う | PHP 拡張、ext-php-rs

HTTP メッセージを扱う | PHP 拡張、ext-php-rs

Cargo.toml

[package]
name = "php_http_message"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Created February 23, 2026 07:19
tiny_http でシングルスレッドの HTTP/1 サーバー | Rust

tiny_http でシングルスレッドの HTTP/1 サーバー | Rust

Cargo.toml

[package]
name = "http-server"
version = "0.1.0"
edition = "2024"
@masakielastic
masakielastic / README.md
Created February 23, 2026 06:24
reqwest で HTTP リクエスト (ブロッキング) | Rust

reqwest で HTTP リクエスト (ブロッキング) | Rust

Cargo.toml

[package]
name = "http-reqwest"
version = "0.1.0"
edition = "2024"
@masakielastic
masakielastic / README.md
Created February 23, 2026 06:19
httparse で HTTP/1 メッセージを解析する | Rust

httparse で HTTP/1 メッセージを解析する | Rust

Cargo.toml

[package]
name = "httpparse-example"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Last active February 23, 2026 06:08
HTTP/1 メッセージのバイト列を表現する | Rust

HTTP/1 メッセージのバイト列を表現する | Rust

Vec 形式

fn build_get_request() -> Vec<u8> {
    let mut buf = Vec::new();