Skip to content

Instantly share code, notes, and snippets.

@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"
@masakielastic
masakielastic / README.md
Created February 27, 2026 01:05
tiny_http で TLS

tiny_http で TLS

Cargo.toml

[package]
name = "tiny-http-tls-example"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Last active February 27, 2026 00:48
ext-php-rs で PHP スクリプトを実行する CLI を作成する

ext-php-rs で PHP スクリプトを実行する CLI を作成する

ソースコード

Cargo.toml

[package]
@masakielastic
masakielastic / README.md
Last active February 26, 2026 21:41
ext-php-rs と embed PHP で実行したスクリプトの結果を取得する

ext-php-rs と embed PHP で実行したスクリプトの結果を取得する

src/main.rs

use ext_php_rs::builders::SapiBuilder;
use ext_php_rs::embed::{ext_php_rs_sapi_shutdown, ext_php_rs_sapi_startup, Embed};
use ext_php_rs::ffi::{
@masakielastic
masakielastic / README.md
Last active February 26, 2026 21:17
ext-php-rs と Embed PHP を利用して PHP スクリプトを実行する

ext-php-rs で Embed PHP を利用する

sudo apt install libphp-embed

Cargo.toml

[package]