{"id":19546472,"url":"https://github.com/steve-xmh/alhc","last_synced_at":"2025-04-26T19:32:39.914Z","repository":{"id":63578601,"uuid":"568006938","full_name":"Steve-xmh/alhc","owner":"Steve-xmh","description":"Async Lightweight HTTP Client using system native library if possible. (Currently under heavy development)","archived":false,"fork":false,"pushed_at":"2024-04-13T07:46:32.000Z","size":165,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-04T17:47:22.492Z","etag":null,"topics":["async","http-client","parallel","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/Steve-xmh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-11-19T06:29:33.000Z","updated_at":"2024-10-23T03:21:17.000Z","dependencies_parsed_at":"2024-04-12T03:33:00.886Z","dependency_job_id":null,"html_url":"https://github.com/Steve-xmh/alhc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Steve-xmh%2Falhc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Steve-xmh%2Falhc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Steve-xmh%2Falhc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Steve-xmh%2Falhc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Steve-xmh","download_url":"https://codeload.github.com/Steve-xmh/alhc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251041622,"owners_count":21527229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["async","http-client","parallel","rust"],"created_at":"2024-11-11T03:45:32.246Z","updated_at":"2025-04-26T19:32:34.907Z","avatar_url":"https://github.com/Steve-xmh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Async Lightweight HTTP Client (aka ALHC)\n\n\u003e **WARNING**\n\u003e\n\u003e This library is still in development and **VERY UNSTABLE**, please don't use it in production environment.\n\n[\u003cimg alt=\"github.com\" src=\"https://img.shields.io/github/stars/Steve-xmh/alhc.svg?label=Github\u0026logo=github\"\u003e](https://github.com/Steve-xmh/alhc)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/alhc.svg?logo=rust\"\u003e](https://crates.io/crates/alhc)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-alhc?logo=docs.rs\"\u003e](https://docs.rs/alhc)\n\nWhat if we need async but also lightweight http client without using such a large library like `reqwest`, `isahc` or `surf`?\n\nALHC is a async http client library that using System library to reduce binary size and provide async request feature.\n\nHTTPS Example:\n\n```rust\nuse alhc::prelude::*;\nuse alhc::*;\n\nuse pollster::FutureExt;\n\nfn main() -\u003e DynResult {\n    let client = get_client_builder().build().unwrap();\n\n    let r = client\n        .post(\"https://httpbin.org/anything\")?\n        .header(\"user-agent\", \"alhc/0.2.0\")\n        .body_string(\"Hello World!\".repeat(20))\n        .block_on()?\n        .recv_string()\n        .block_on()?;\n\n    println!(\"{r}\");\n\n    Ok(())\n}\n```\n\nOur little request example [`https`](./examples/https.rs) with release build can be 182 KB, which is smaller than `tinyget`'s `http` example. If we use rustc nightly feature plus `build-std` and `panic_immediate_abort`, it'll be incredibly 65 KB!\n\nCurrently work in progress and support Windows (Using WinHTTP) and unix-like system (including macOS) (Using System libcurl by wraping [`isahc`](https://github.com/sagebind/isahc) crate (Will be replaced by simplier `curl` crate binding)).\n\n## Platform Status\n\n| Name    | Status  | Note                                                                 |\n| ------- | ------- | -------------------------------------------------------------------- |\n| Windows | Working | Maybe unstable (To be optimized)                                     |\n| macOS   | Working | Simple wrapper of [`isahc`](https://github.com/sagebind/isahc) crate |\n| Linux   | Working | Simple wrapper of [`isahc`](https://github.com/sagebind/isahc) crate |\n\n## Features\n\n- `async_t_boxed`: Use `async-trait` instead of `async-t`, which requires 1.75+ version of rustc but with zero-cost. Default is disabled.\n- `serde`: Can give you the ability of send/receive json data without manually call `serde_json`. Default is disabled.\n- `anyhow`: Use `Result` type from `anyhow` crate instead `Result\u003cT, Box\u003cdyn std::error::Error\u003e\u003e`. Default is disabled.\n\n## Minimum binary size on unix-like platform guideline\n\nFor Unix-like system like linux or macOS which have builtin libcurl on almost all desktop version, you have to install all the development packages that `curl` crate needs to dynamic link these libraries. For an example, on Ubuntu, you need to install `libcurl4-openssl-dev` and `zlib1g-dev` for a dynamic linkage. Else `curl` crate will build from source and static link them and heavily impact binary size.\n\n## Compilation binary size comparison\n\n\u003e Note: the size optimization argument is: `cargo +nightly run --release -Z build-std=core,alloc,std,panic_abort -Z build-std-features=panic_immediate_abort --target [TARGET] --example [EXAMPLE]` and some configuration in [`Cargo.toml`](./Cargo.toml)\n\n| Name                                                | Windows (x86_64) | Windows (i686) | Windows (aarch64) | macOS (x86_64) | macOS (aarch64) | Linux (x86_64) |\n| --------------------------------------------------- | ---------------: | -------------: | ----------------: | -------------: | --------------: | -------------: |\n| example `https`                                     |          468,992 |        402,944 |           296,960 |      4,078,936 |       4,395,400 |     18,051,064 |\n| example `https` release                             |          181,248 |        162,816 |           200,192 |        729,304 |         719,192 |        850,704 |\n| example `https` release with size optimization      |           75,264 |         66,048 |            59,392 |        444,680 |         453,064 |        465,480 |\n| example `parallel`                                  |          571,904 |        486,912 |           393,216 |      4,250,296 |       4,572,120 |     19,612,824 |\n| example `parallel` release                          |          190,464 |        170,496 |           229,888 |        737,536 |         735,752 |        862,992 |\n| example `parallel` release with size optimization   |           80,896 |         71,680 |            66,560 |        452,912 |         453,112 |        469,576 |\n| example `sequential`                                |          472,064 |        405,504 |           302,080 |      4,069,368 |       4,373,352 |     18,048,624 |\n| example `sequential` release                        |          182,784 |        164,864 |           203,264 |        729,296 |         719,176 |        850,704 |\n| example `sequential` release with size optimization |           76,800 |         68,096 |            60,928 |        448,776 |         453,064 |        465,480 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteve-xmh%2Falhc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteve-xmh%2Falhc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteve-xmh%2Falhc/lists"}