Expand description
§shiguredo_http11
依存なしの HTTP/1.1 スタイル テキストプロトコルライブラリ (Sans I/O)
§特徴
- 依存なし: 標準ライブラリのみ使用
- Sans I/O: I/O を完全に分離した設計
- 柔軟性: HTTP/1.1, RTSP/1.0, RTSP/2.0 等に対応
§使い方
§クライアント (リクエスト送信、レスポンス受信)
use shiguredo_http11::{Request, ResponseDecoder};
// リクエストを作成してエンコード
let request = Request::new("GET", "/")
.header("Host", "example.com")
.header("Connection", "close");
let bytes = request.encode();
// bytes を送信...
// レスポンスをデコード
let mut decoder = ResponseDecoder::new();
// 受信データを feed...
// decoder.feed(&received_data)?;
// if let Some(response) = decoder.decode()? { ... }§サーバー (リクエスト受信、レスポンス送信)
use shiguredo_http11::{RequestDecoder, Response};
// リクエストをデコード
let mut decoder = RequestDecoder::new();
// 受信データを feed...
// decoder.feed(&received_data)?;
// if let Some(request) = decoder.decode()? { ... }
// レスポンスを作成してエンコード
let response = Response::new(200, "OK")
.header("Content-Type", "text/plain")
.body(b"Hello, World!".to_vec());
let bytes = response.encode();
// bytes を送信...Modules§
- accept
- Accept 系ヘッダーパース (RFC 9110 Section 12.5)
- auth
- HTTP 認証 (Basic / Digest / Bearer)
- cache
- HTTP キャッシュヘッダー (RFC 9111)
- compression
- 圧縮/展開トレイト (Sans I/O)
- conditional
- 条件付きリクエストヘッダー (RFC 9110)
- content_
disposition - Content-Disposition ヘッダーパース (RFC 6266)
- content_
encoding - Content-Encoding ヘッダーパース (RFC 9110 Section 8.4)
- content_
language - Content-Language ヘッダーパース (RFC 9110 Section 8.5)
- content_
location - Content-Location ヘッダーパース (RFC 9110 Section 8.6)
- content_
type - Content-Type ヘッダーパース (RFC 9110 Section 8.3)
- cookie
- Cookie ヘッダーパース (RFC 6265)
- date
- HTTP-date パース (RFC 9110 Section 5.6.7)
- digest_
fields - Digest Fields (RFC 9530)
- etag
- ETag ヘッダーパース (RFC 9110)
- expect
- Expect ヘッダーパース (RFC 9110 Section 10.1.1)
- host
- Host ヘッダーパース (RFC 9110 Section 7.2)
- multipart
- multipart/form-data パース (RFC 7578)
- range
- Range リクエストヘッダー (RFC 9110)
- trailer
- Trailer フィールドパース (RFC 9112 Section 7.1.2)
- upgrade
- Upgrade ヘッダーパース (RFC 9110 Section 7.8)
- uri
- URI パースとパーセントエンコーディング (RFC 3986)
- vary
- Vary ヘッダーパース (RFC 9110 Section 12.5.5)
Structs§
- Decoder
Limits - デコーダーの制限設定
- Request
- HTTP リクエスト
- Request
Decoder - HTTP リクエストデコーダー (Sans I/O)
- Request
Encoder - リクエストエンコーダー (圧縮対応)
- Request
Head - リクエストヘッダー(ボディなし)
- Response
- HTTP レスポンス
- Response
Decoder - HTTP レスポンスデコーダー (Sans I/O)
- Response
Encoder - レスポンスエンコーダー (圧縮対応)
- Response
Head - レスポンスヘッダー(ボディなし)
Enums§
- Body
Kind - ボディの種類
- Body
Progress - ボディデコードの進捗
- Error
- HTTP パースエラー
Traits§
- Http
Head - HTTP ヘッダー操作のための共通トレイト
Functions§
- encode_
chunk - Chunked Transfer Encoding 用のチャンクをエンコード
- encode_
chunks - 複数のデータを chunked 形式でエンコード
- encode_
request - リクエストをエンコード
- encode_
request_ headers - リクエストヘッダーのみをエンコード (ボディなし)
- encode_
response - レスポンスをエンコード
- encode_
response_ headers - レスポンスヘッダーのみをエンコード (ボディなし)