{"id":35797639,"url":"https://github.com/muhammad-fiaz/httpx.zig","last_synced_at":"2026-04-01T18:58:50.698Z","repository":{"id":331333066,"uuid":"1126178952","full_name":"muhammad-fiaz/httpx.zig","owner":"muhammad-fiaz","description":"httpx.zig is a production-ready, high-performance HTTP client and server library for Zig, designed for building modern, robust, and scalable networked applications.","archived":false,"fork":false,"pushed_at":"2026-03-28T18:43:48.000Z","size":3830,"stargazers_count":27,"open_issues_count":1,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-28T19:25:12.228Z","etag":null,"topics":["http","http-api","http-client","http-proxy","http-requests","http-server","http-zig","http2","https","httpx","httpx-zig","zig","zig-lang","zig-library","zig-package"],"latest_commit_sha":null,"homepage":"https://muhammad-fiaz.github.io/httpx.zig/","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muhammad-fiaz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["muhammad-fiaz"],"ko_fi":"muhammadfiaz","custom":["https://pay.muhammadfiaz.com"]}},"created_at":"2026-01-01T10:10:47.000Z","updated_at":"2026-03-28T18:40:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/muhammad-fiaz/httpx.zig","commit_stats":null,"previous_names":["muhammad-fiaz/httpx.zig"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/muhammad-fiaz/httpx.zig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fhttpx.zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fhttpx.zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fhttpx.zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fhttpx.zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhammad-fiaz","download_url":"https://codeload.github.com/muhammad-fiaz/httpx.zig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fhttpx.zig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","http-api","http-client","http-proxy","http-requests","http-server","http-zig","http2","https","httpx","httpx-zig","zig","zig-lang","zig-library","zig-package"],"created_at":"2026-01-07T10:04:43.788Z","updated_at":"2026-04-01T18:58:50.689Z","avatar_url":"https://github.com/muhammad-fiaz.png","language":"Zig","readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/ae3e1cc2-41f8-4326-b757-c9afcf6c8fea\" alt=\"httpx.zig logo\" width=\"400\" /\u003e\n\n\u003ca href=\"https://muhammad-fiaz.github.io/httpx.zig/\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-muhammad--fiaz.github.io-blue\" alt=\"Documentation\"\u003e\u003c/a\u003e\n\u003ca href=\"https://ziglang.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Zig-0.15.2-orange.svg?logo=zig\" alt=\"Zig Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/muhammad-fiaz/httpx.zig\" alt=\"GitHub stars\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/muhammad-fiaz/httpx.zig\" alt=\"GitHub issues\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig/pulls\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-pr/muhammad-fiaz/httpx.zig\" alt=\"GitHub pull requests\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig\"\u003e\u003cimg src=\"https://img.shields.io/github/last-commit/muhammad-fiaz/httpx.zig\" alt=\"GitHub last commit\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig\"\u003e\u003cimg src=\"https://img.shields.io/github/license/muhammad-fiaz/httpx.zig\" alt=\"License\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/muhammad-fiaz/httpx.zig/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/platforms-linux%20%7C%20windows%20%7C%20macos-blue\" alt=\"Supported Platforms\"\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig/actions/workflows/github-code-scanning/codeql\"\u003e\u003cimg src=\"https://github.com/muhammad-fiaz/httpx.zig/actions/workflows/github-code-scanning/codeql/badge.svg\" alt=\"CodeQL\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig/actions/workflows/release.yml\"\u003e\u003cimg src=\"https://github.com/muhammad-fiaz/httpx.zig/actions/workflows/release.yml/badge.svg\" alt=\"Release\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/httpx.zig/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/muhammad-fiaz/httpx.zig?label=Latest%20Release\u0026style=flat-square\" alt=\"Latest Release\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pay.muhammadfiaz.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/Sponsor-pay.muhammadfiaz.com-ff69b4?style=flat\u0026logo=heart\" alt=\"Sponsor\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/sponsors/muhammad-fiaz\"\u003e\u003cimg src=\"https://img.shields.io/badge/Sponsor-GitHub-pink?style=social\u0026logo=github\" alt=\"GitHub Sponsors\"\u003e\u003c/a\u003e\n\u003ca href=\"https://hits.sh/muhammad-fiaz/httpx.zig/\"\u003e\u003cimg src=\"https://hits.sh/muhammad-fiaz/httpx.zig.svg?label=Visitors\u0026extraCount=0\u0026color=green\" alt=\"Repo Visitors\"\u003e\u003c/a\u003e\n\n\u003cp\u003e\u003cem\u003eA production-ready, high-performance HTTP client and server library for Zig.\u003c/em\u003e\u003c/p\u003e\n\n\u003cb\u003e\u003ca href=\"https://muhammad-fiaz.github.io/httpx.zig/\"\u003eDocumentation\u003c/a\u003e |\n\u003ca href=\"https://muhammad-fiaz.github.io/httpx.zig/api/client\"\u003eAPI Reference\u003c/a\u003e |\n\u003ca href=\"https://muhammad-fiaz.github.io/httpx.zig/guide/getting-started\"\u003eQuick Start\u003c/a\u003e |\n\u003ca href=\"CONTRIBUTING.md\"\u003eContributing\u003c/a\u003e\u003c/b\u003e\n\n\u003c/div\u003e\n\n\n`httpx.zig` is a comprehensive, high-performance HTTP library for building robust networked applications in Zig, with modern client and server primitives, support for major HTTP versions, connection pooling, and pattern-based routing. You can build your own APIs and website servers directly on top of these components; see the runnable examples in the repository: [examples/](https://github.com/muhammad-fiaz/httpx.zig/tree/main/examples), [examples/static_files.zig](https://github.com/muhammad-fiaz/httpx.zig/blob/main/examples/static_files.zig), and [examples/multi_page_website.zig](https://github.com/muhammad-fiaz/httpx.zig/blob/main/examples/multi_page_website.zig).\n\n**Related Zig projects:**\n\n- For **API framework** support, check out **[api.zig](https://github.com/muhammad-fiaz/api.zig)**.\n- For **web framework** support, check out **[zix](https://github.com/muhammad-fiaz/zix)**.\n- For **logging** support, check out **[logly.zig](https://github.com/muhammad-fiaz/logly.zig)**.\n- For **data validation and serialization** support, check out **[zigantic](https://github.com/muhammad-fiaz/zigantic)**.\n\n⭐ If you build with httpx.zig, make sure to give it a star. ⭐\n\n\n\u003e [!NOTE]\n\u003e **Project maturity:** This project aims to be production-ready and is actively maintained. It is still a new project and not yet widely adopted. Feel free to use it in your projects.\n\u003e\n\u003e **Custom HTTP/2 \u0026 HTTP/3 implementation:** Zig's standard library does not provide HTTP/2, HTTP/3, or QUIC support.\n\u003e httpx.zig implements these protocols **entirely from scratch**, including:\n\u003e - **HPACK** header compression (RFC 7541) for HTTP/2\n\u003e - **HTTP/2 high-level client and server runtime paths** (preface/settings/headers/data flow)\n\u003e - **HTTP/2** stream multiplexing and flow control (RFC 7540)\n\u003e - **QPACK** header compression (RFC 9204) for HTTP/3\n\u003e - **QUIC** transport framing (RFC 9000) for HTTP/3\n\u003e - **HTTP/3 high-level client and server runtime paths** over UDP + QUIC/HTTP3/QPACK primitives\n\u003e - **Interop note:** strict TLS-in-QUIC server negotiation expectations may vary by endpoint deployment\n\n---\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eFeatures\u003c/strong\u003e (click to expand)\u003c/summary\u003e\n\n| Feature | Description | Documentation |\n|---------|-------------|---------------|\n| **Protocol Support** | Full runtime support for **HTTP/1.0**, **HTTP/1.1**, **HTTP/2**, and **HTTP/3** in high-level client/server APIs, plus low-level protocol primitives. | https://muhammad-fiaz.github.io/httpx.zig/api/protocol |\n| **Header Compression** | HPACK (RFC 7541) for HTTP/2 and QPACK (RFC 9204) for HTTP/3. | https://muhammad-fiaz.github.io/httpx.zig/guide/http2 |\n| **Stream Multiplexing** | HTTP/2 stream state machine with flow control and priority handling. | https://muhammad-fiaz.github.io/httpx.zig/api/protocol |\n| **Connection Pooling** | Automatic reuse of TCP connections with keep-alive and health checking. | https://muhammad-fiaz.github.io/httpx.zig/guide/pooling |\n| **Pool Introspection** | Built-in connection pool stats and per-host connection counts. | https://muhammad-fiaz.github.io/httpx.zig/api/pool |\n| **Pattern-based Routing** | Intuitive server routing with dynamic path parameters and groups. | https://muhammad-fiaz.github.io/httpx.zig/guide/routing |\n| **Middleware Stack** | Built-in middleware for CORS, Logging, Rate Limiting, customized Auth, and more. | https://muhammad-fiaz.github.io/httpx.zig/guide/middleware |\n| **Pre-Route and Global Handlers** | `preRoute(...)` hooks and `global(...)` fallback handlers for complete request lifecycle control. | https://muhammad-fiaz.github.io/httpx.zig/api/server |\n| **Unified Any-Method Routing** | `any(path, handler)` to register all standard HTTP methods on one endpoint. | https://muhammad-fiaz.github.io/httpx.zig/api/server |\n| **Concurrency** | Parallel request patterns (`race`, `all`, `any`) and async task execution. | https://muhammad-fiaz.github.io/httpx.zig/guide/concurrency |\n| **Interceptors** | Global hooks to modify requests and responses (e.g., Auth injection). | https://muhammad-fiaz.github.io/httpx.zig/guide/interceptors |\n| **Smart Retries** | Configurable retry policies with exponential backoff. | https://muhammad-fiaz.github.io/httpx.zig/api/client |\n| **JSON and HTML** | Helpers for easy JSON serialization and HTML response generation. | https://muhammad-fiaz.github.io/httpx.zig/api/core |\n| **Core Convenience APIs** | Request query-param helpers and response constructors for redirect/text/json. | https://muhammad-fiaz.github.io/httpx.zig/api/core |\n| **TLS/SSL** | Secure connections via TLS 1.3 support. | https://muhammad-fiaz.github.io/httpx.zig/api/tls |\n| **Static Files** | Efficient static file serving capabilities. | https://muhammad-fiaz.github.io/httpx.zig/api/server |\n| **Streaming and Realtime** | Chunked transfer responses with optional trailers and SSE response helpers. | https://muhammad-fiaz.github.io/httpx.zig/api/server |\n| **Cookie APIs** | First-class request/response cookie helpers for both client and server contexts. | https://muhammad-fiaz.github.io/httpx.zig/api/server |\n| **Security** | Security headers (Helmet) and safe defaults. | https://muhammad-fiaz.github.io/httpx.zig/api/middleware |\n| **No External Dependencies** | Pure Zig implementation for maximum portability and ease of build. | https://muhammad-fiaz.github.io/httpx.zig/guide/installation |\n| **Shared Common Helpers** | Reusable query and cookie parsing helpers for app and library code. | https://muhammad-fiaz.github.io/httpx.zig/api/utils |\n\n\u003c/details\u003e\n\n----\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003ePrerequisites and Supported Platforms\u003c/strong\u003e (click to expand)\u003c/summary\u003e\n\n\u003cbr\u003e\n\n## Prerequisites\n\nBefore using `httpx.zig`, ensure you have the following:\n\n| Requirement | Version | Notes |\n|-------------|---------|-------|\n| **Zig** | 0.15.0+ | Download from [ziglang.org](https://ziglang.org/download/) |\n| **Operating System** | Windows 10+, Linux, macOS | Cross-platform networking support |\n\n---\n\n## Supported Platforms\n\n`httpx.zig` is validated on these architectures:\n\n| Platform | x86_64 (64-bit) | aarch64 (ARM64) | x86 (32-bit) |\n|----------|-----------------|-----------------|--------------|\n| **Linux** | Yes | Yes | Yes |\n| **Windows** | Yes | Yes | Yes |\n| **macOS** | Yes | Yes (Apple Silicon) | No |\n\n### Cross-Compilation\n\nZig makes cross-compilation easy. Build for any target from any host:\n\n```bash\n# Build for Linux ARM64 from Windows\nzig build -Dtarget=aarch64-linux\n\n# Build for Windows from Linux  \nzig build -Dtarget=x86_64-windows\n\n# Build for macOS Apple Silicon from Linux\nzig build -Dtarget=aarch64-macos\n\n# Build for 32-bit Windows\nzig build -Dtarget=x86-windows\n```\n\n\u003c/details\u003e\n\n---\n\n## Installation\n\n### Method 1: Zig Fetch (Recommended Stable Release)\n\n```bash\nzig fetch --save https://github.com/muhammad-fiaz/httpx.zig/archive/refs/tags/0.0.7.tar.gz\n```\n\n### Method 2: Zig Fetch (Nightly/Main)\n\n```bash\nzig fetch --save git+https://github.com/muhammad-fiaz/httpx.zig.git\n```\n\n### Method 3: Project Starter Template (Quick Start)\n\nGet started quickly with a pre-configured project template:\n\n**[Download Project Starter Example](https://download-directory.github.io/?url=https://github.com/muhammad-fiaz/httpx.zig/tree/main/httpx-project-starter)**\n\n### Method 4: Manual `build.zig.zon` Configuration\n\nAdd this dependency entry to your `build.zig.zon`:\n\n```zig\n.dependencies = .{\n    .httpx = .{\n        .url = \"https://github.com/muhammad-fiaz/httpx.zig/archive/refs/tags/0.0.7.tar.gz\",\n        .hash = \"...\", // Run zig fetch --save \u003curl\u003e to auto-fill this.\n    },\n},\n```\n\n### Method 5: Local Source Checkout\n\n```bash\ngit clone https://github.com/muhammad-fiaz/httpx.zig.git\ncd httpx.zig\nzig build\n```\n\nIf you want to consume a local checkout from another project, use a local path dependency:\n\n```zig\n.dependencies = .{\n    .httpx = .{\n        .path = \"../httpx.zig\",\n    },\n},\n```\n\n### Wire into `build.zig`\n\nAfter adding the dependency, import the module in your `build.zig`:\n\n```zig\nconst httpx_dep = b.dependency(\"httpx\", .{\n    .target = target,\n    .optimize = optimize,\n});\nexe.root_module.addImport(\"httpx\", httpx_dep.module(\"httpx\"));\n```\n\n## Quick Start\n\n### Client Usage\n \n```zig\nconst std = @import(\"std\");\nconst httpx = @import(\"httpx\");\n \npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n    const allocator = gpa.allocator();\n \n    // Create client\n    var client = httpx.Client.init(allocator);\n    defer client.deinit();\n \n    // Simple GET request\n    var response = try client.get(\"https://httpbin.org/get\", .{});\n    defer response.deinit();\n \n    if (response.ok()) {\n        std.debug.print(\"Response: {s}\\n\", .{response.text() orelse \"\"});\n    }\n \n    // POST with JSON\n    var post_response = try client.post(\"https://httpbin.org/post\", .{\n        .json = \"{\\\"name\\\": \\\"John\\\"}\",\n    });\n    defer post_response.deinit();\n\n    // Cookie jar helpers\n    try client.setCookie(\"session\", \"abc123\");\n    _ = client.getCookie(\"session\");\n}\n```\n\n### Simplified API Aliases\n\n```zig\n// Top-level aliases for concise client code.\n// Reuses the same allocator declared above.\nvar response = try httpx.fetch(allocator, \"https://httpbin.org/get\");\ndefer response.deinit();\n\nvar by_method = try httpx.send(allocator, .GET, \"https://httpbin.org/headers\", .{});\ndefer by_method.deinit();\n\n// Additional aliases\nvar del_res = try httpx.delete(allocator, \"https://httpbin.org/delete\", .{});\ndefer del_res.deinit();\n\nvar opts_res = try httpx.opts(allocator, \"https://httpbin.org/get\", .{});\ndefer opts_res.deinit();\n```\n\n### Explicit Network Helpers\n\n```zig\n// Network lifecycle (optional explicit init/deinit)\ntry httpx.netInit();\ndefer httpx.netDeinit();\n\n// Address helpers\nconst one = try httpx.resolveAddress(\"example.com\", 443);\n_ = one;\n\nconst parsed = try httpx.parseHostAndPort(\"localhost:8080\", 80);\n_ = parsed;\n\nconst final_addr = try httpx.parseAndResolveAddress(\"127.0.0.1:9000\", 80);\n_ = final_addr;\n\nconst is_ip = httpx.isIpAddress(\"::1\");\n_ = is_ip;\n```\n\n### Explicit Concurrency Helpers\n\n```zig\nconst specs = [_]httpx.RequestSpec{\n    .{ .method = .GET, .url = \"https://httpbin.org/get\" },\n    .{ .method = .GET, .url = \"https://httpbin.org/headers\" },\n};\n\nvar client_for_concurrency = httpx.Client.init(allocator);\ndefer client_for_concurrency.deinit();\n\nvar all_results = try httpx.all(allocator, \u0026client_for_concurrency, \u0026specs);\ndefer {\n    for (all_results) |*r| r.deinit();\n    allocator.free(all_results);\n}\n\nvar first_ok = try httpx.first(allocator, \u0026client_for_concurrency, \u0026specs);\nif (first_ok) |*resp| resp.deinit();\n```\n \n### Server Usage\n \n```zig\nconst std = @import(\"std\");\nconst httpx = @import(\"httpx\");\n \nfn helloHandler(ctx: *httpx.Context) anyerror!httpx.Response {\n    return ctx.json(.{ .message = \"Hello, World!\" });\n}\n \nfn htmlHandler(ctx: *httpx.Context) anyerror!httpx.Response {\n    return ctx.html(\"\u003ch1\u003eHello from httpx.zig!\u003c/h1\u003e\");\n}\n \npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n    const allocator = gpa.allocator();\n \n    var server = httpx.Server.init(allocator);\n    defer server.deinit();\n \n    // Add middleware\n    try server.use(httpx.logger());\n    try server.use(httpx.cors(.{}));\n \n    // Register routes\n    try server.get(\"/\", helloHandler);\n    try server.get(\"/page\", htmlHandler);\n \n    // Start server\n    try server.listen();\n}\n```\n \n## Examples\n \nThe `examples/` directory contains comprehensive examples for all major features:\n \n- **Basic Client**: `simple_get.zig`, `post_json.zig`\n- **JSON Parse**: `simple_get_deserialize.zig` (GET + typed JSON deserialization)\n- **Advanced Client**: `custom_headers.zig`, `connection_pool.zig`, `interceptors.zig`\n- **Cookies**: `cookies_demo.zig`\n- **Simplified API**: `simplified_api_aliases.zig`\n- **Concurrency**: `concurrent_requests.zig` (Parallel/Race/All patterns)\n- **Streaming**: `streaming.zig`\n- **Server Core**: `simple_server.zig`, `router_example.zig`, `middleware_example.zig`\n- **Static Assets Demo**: `static_files.zig` (file-based static routes + directory-based wildcard mounts for CSS/JS/images)\n- **Website Demo**: `multi_page_website.zig` (full multi-page website serving `index/about/contact` with static assets)\n- **Protocol Demos**: `http2_example.zig`, `http2_client_runtime.zig`, `http2_server_runtime.zig`, `http3_example.zig`, `http3_client_runtime.zig`, `http3_server_runtime.zig`\n- **Networking Utility**: `tcp_local.zig`, `udp_local.zig`\n \nTo run an example:\n```bash\nzig build run-simple_get\n```\n\n## Validation Matrix\n\nValidate host functionality and cross-target compatibility with these commands:\n\n```bash\n# Host runtime validation\nzig build test\nzig build run-all-examples\n\n# Cross-target library compile validation\nzig build build-all-targets\n```\n\nTo validate Linux runtime behavior (not just compilation), run Linux-target artifacts from a Linux shell (or WSL):\n\n```bash\n# Build Linux test/example artifacts\nzig build test -Dtarget=x86_64-linux\nzig build example-tcp_local -Dtarget=x86_64-linux\n\n# Run on Linux/WSL\n./zig-out/bin/test\n./zig-out/bin/tcp_local\n```\n\nIf a remote endpoint appears to stall, set a per-request timeout and print errors explicitly:\n\n```zig\nvar response = client.get(url, .{ .timeout_ms = 10_000 }) catch |err| {\n    std.debug.print(\"request failed: {s}\\n\", .{@errorName(err)});\n    return;\n};\ndefer response.deinit();\n```\n\nFor explicit cross-target test and example compilation, pass `-Dtarget=...`:\n\n```bash\n# Example: compile tests for 32-bit Windows\nzig build test -Dtarget=x86-windows\n\n# Example: compile an example for macOS ARM64\nzig build example-tcp_local -Dtarget=aarch64-macos\n```\n\n\u003e Note: this project exposes `build-all-targets` as a build step. Use `zig build build-all-targets`.\n \n## Performance\n \nRun benchmarks:\n \n```bash\nzig build bench\n```\n\u003e [!NOTE]\n\u003e Benchmark results will vary based on hardware and network conditions.\n\u003e The benchmark suite reports multiple rounds with min/avg/max and throughput to improve result quality.\n\nLatest benchmark snapshot (`x86_64-windows`, `ReleaseFast`):\n\n| Benchmark | Avg (ns/op) | Throughput (ops/sec) |\n|-----------|-------------|----------------------|\n| headers_parse | 34228.26 | 29215 |\n| uri_parse | 53.14 | 18818251 |\n| status_lookup | 2.28 | 439313265 |\n| method_lookup | 9.27 | 107889064 |\n| base64_encode | 4569.04 | 218864 |\n| base64_decode | 4859.87 | 205766 |\n| json_builder | 4687.50 | 213333 |\n| request_build | 26806.72 | 37304 |\n| response_builders | 35379.08 | 28265 |\n| h2_frame_header | 1.82 | 550533466 |\n| h3_varint_encode | 1.22 | 816790601 |\n \n## Contributing\n \nContributions are welcome! Please:\n \n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Ensure all tests pass: `zig build test`\n5. Submit a pull request\n \n## License\n \nMIT License - see [LICENSE](LICENSE) for details.\n","funding_links":["https://github.com/sponsors/muhammad-fiaz","https://ko-fi.com/muhammadfiaz","https://pay.muhammadfiaz.com"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fhttpx.zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhammad-fiaz%2Fhttpx.zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fhttpx.zig/lists"}