Skip to content

Instantly share code, notes, and snippets.

@masakielastic
masakielastic / README.md
Created February 27, 2026 20:24
独自ビルドの curl を導入する

独自ビルドの curl を導入する

関数の定義

curl-local() {
  LD_LIBRARY_PATH="$HOME/.local/lib64:$HOME/.local/lib" \
    "$HOME/.local/bin/curl" "$@"
}
@masakielastic
masakielastic / 01-README.md
Last active February 27, 2026 22:25
 ngtcp2 と nghttp3 で HTTP/3 サーバー (OpenSSL)

ngtcp2 と nghttp3 で HTTP/3 サーバー (OpenSSL)

export PKG_CONFIG_PATH="$PREFIX/lib64/pkgconfig:$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$PREFIX/lib64:$PREFIX/lib:$LD_LIBRARY_PATH"
pkg-config --modversion libngtcp2 libngtcp2_crypto_ossl libnghttp3 openssl
@masakielastic
masakielastic / 01-README.md
Last active February 27, 2026 20:26
ngtcp2 と nghttp3 で HTTP/3 クライアント (OpenSSL)

ngtcp2 と nghttp3 で HTTP/3 クライアント (OpenSSL)

OpenSSL、nghttp3、ngtcp2 のインストール

Debian 12 (bookworm)

export PREFIX=$HOME/.local
export PATH="$PREFIX/bin:$PATH"
export PKG_CONFIG_PATH="$PREFIX/lib64/pkgconfig:$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
@masakielastic
masakielastic / 01-README.md
Last active February 27, 2026 19:12
ngtcp2 と nghttp3 で HTTP/3 クライアント (GnuTLS)

ngtcp2 と nghttp3 で HTTP/3 クライアント (GnuTLS)

cc -Wall -Wextra -O2 minimal_h3_client.c -o minimal_h3_client     $(pkg-config --cflags --libs libngtcp2 libngtcp2_crypto_gnutls libnghttp3 gnutls)
@masakielastic
masakielastic / Hpack.c
Last active February 28, 2026 02:39
nghttp3 で QPACK
// qpack_roundtrip.c
#include <nghttp3/nghttp3.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
/* rcbuf から (ptr,len) を取り出して表示する */
static void print_qpack_nv(const nghttp3_qpack_nv *nv) {
nghttp3_vec name = nghttp3_rcbuf_get_buf(nv->name);
@masakielastic
masakielastic / README.md
Last active February 27, 2026 13:25
Rust で HTTP/1 の TCP サーバーとクライアントの例

Rust で HTTP/1 の TCP サーバーとクライアントの例

サーバー

src/main.rs

use std::io::{Read, Write};
use std::net::{TcpListener, TcpStream};
@masakielastic
masakielastic / README.md
Last active February 27, 2026 13:27
ripht_php_sapi と tiny_httpで embed PHP の HTTP サーバー CLI を作成する

ripht_php_sapi と tiny_http で embed PHP の HTTP サーバー CLI を作成する

コード

[package]
name = "mini_php_http"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Last active February 27, 2026 04:52
ripht-php-sapi で PHP スクリプトを実行する CLI ツールを開発する

ripht-php-sapi で PHP スクリプトを実行する CLI ツールを開発する

コード

Cargo.toml

[package]
@masakielastic
masakielastic / README.md
Last active February 27, 2026 03:10
tiny_http と ext-php-rs で embed PHP の HTTP サーバーを作成する

tiny_http と ext-php-rs で embed PHP の HTTP サーバー CLI を作成する

ソースコード

Cargo.toml

[package]
name = "php-embed-tinyhttp"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Last active February 27, 2026 02:22
tiny_http で HTTP/1 サーバーの PHP 拡張

tiny_http で HTTP/1 サーバーの PHP 拡張

コード

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