{"id":20077422,"url":"https://github.com/drogue-iot/reqwless","last_synced_at":"2025-05-15T17:05:53.755Z","repository":{"id":41111172,"uuid":"508269275","full_name":"drogue-iot/reqwless","owner":"drogue-iot","description":"Rust async HTTP client for embedded/no_std","archived":false,"fork":false,"pushed_at":"2025-03-25T10:30:41.000Z","size":276,"stargazers_count":170,"open_issues_count":19,"forks_count":24,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-15T17:05:47.471Z","etag":null,"topics":["embedded","http","iot","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drogue-iot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"publiccode":null,"codemeta":null}},"created_at":"2022-06-28T11:23:13.000Z","updated_at":"2025-05-09T01:45:50.000Z","dependencies_parsed_at":"2023-02-14T18:01:40.298Z","dependency_job_id":"c792ffc1-c3f8-4f9f-8bfd-e5d04a993162","html_url":"https://github.com/drogue-iot/reqwless","commit_stats":{"total_commits":70,"total_committers":4,"mean_commits":17.5,"dds":0.3285714285714286,"last_synced_commit":"57700008e9ea34988f715e89da8497785b8d2685"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drogue-iot%2Freqwless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drogue-iot%2Freqwless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drogue-iot%2Freqwless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drogue-iot%2Freqwless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drogue-iot","download_url":"https://codeload.github.com/drogue-iot/reqwless/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384988,"owners_count":22062422,"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":["embedded","http","iot","rust"],"created_at":"2024-11-13T15:08:10.748Z","updated_at":"2025-05-15T17:05:48.735Z","avatar_url":"https://github.com/drogue-iot.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTP client for embedded devices\n\n[![CI](https://github.com/drogue-iot/reqwless/actions/workflows/ci.yaml/badge.svg)](https://github.com/drogue-iot/reqwless/actions/workflows/ci.yaml)\n[![crates.io](https://img.shields.io/crates/v/reqwless.svg)](https://crates.io/crates/reqwless)\n[![docs.rs](https://docs.rs/reqwless/badge.svg)](https://docs.rs/reqwless)\n[![Matrix](https://img.shields.io/matrix/drogue-iot:matrix.org)](https://matrix.to/#/#drogue-iot:matrix.org)\n\nThe `reqwless` crate implements an HTTP client that can be used in `no_std` environment, with any transport that implements the \ntraits from the `embedded-io` crate. No alloc or std lib required!\n\nIt offers two sets of APIs:\n\n* A low-level `request` API which allows you to construct HTTP requests and write them to a `embedded-io` transport.\n* A higher level `client` API which uses the `embedded-nal-async` (+ optional `embedded-tls` / `esp-mbedtls`) crates to establish TCP + TLS connections.\n\n## example\n\n```rust,ignore\nlet url = format!(\"http://localhost\", addr.port());\nlet mut client = HttpClient::new(TokioTcp, StaticDns); // Types implementing embedded-nal-async\nlet mut rx_buf = [0; 4096];\nlet response = client\n    .request(Method::POST, \u0026url)\n    .await\n    .unwrap()\n    .body(b\"PING\")\n    .content_type(ContentType::TextPlain)\n    .send(\u0026mut rx_buf)\n    .await\n    .unwrap();\n```\n\nThe client is still lacking many features, but can perform basic HTTP GET/PUT/POST/DELETE requests with payloads. However, not all content types and status codes are implemented, and are added on a need basis.  For TLS, it uses either `embedded-tls` or `esp-mbedtls` as the transport.\n\nNOTE: TLS verification is not supported in no_std environments for `embedded-tls`.\n\nIf you are missing a feature or would like an improvement, please raise an issue or a PR.\n\n## TLS 1.2*, 1.3 and Supported Cipher Suites\n`reqwless` uses `embedded-tls` or `esp-mbedtls` to establish secure TLS connections for `https://..` urls.\n\n*TLS 1.2 is only supported with `esp-mbedtls`\n\n:warning: Note that both features cannot be used together and will cause a compilation error.\n\n:warning: The released version of `reqwless` does not support `esp-mbedtls`. The reason for this is that `esp-mbedtls` is not yet published to crates.io. One should specify `reqwless` as a git dependency to use `esp-mbedtls`.\n\n### esp-mbedtls\n**Can only be used on esp32 boards**\n`esp-mbedtls` supports TLS 1.2 and 1.3. It uses espressif's Rust wrapper over mbedtls, alongside optimizations such as hardware acceleration.\n\nTo use, you need to enable the transitive dependency of `esp-mbedtls` for your SoC.\nCurrently, the supported SoCs are:\n\n - `esp32`\n - `esp32c3`\n - `esp32s2`\n - `esp32s3`\n\nCargo.toml: \n\n```toml\nreqwless = { version = \"0.12.0\", default-features = false, features = [\"esp-mbedtls\", \"log\"] }\nesp-mbedtls = { git = \"https://github.com/esp-rs/esp-mbedtls.git\",  features = [\"esp32s3\"] }\n```\n\u003c!-- TODO: Update this when esp-mbedtls switches to the unified hal --\u003e\n\n#### Example\n```rust,ignore\n/// ... [initialization code. See esp-wifi]\nlet state = TcpClientState::\u003c1, 4096, 4096\u003e::new();\nlet mut tcp_client = TcpClient::new(stack, \u0026state);\nlet dns_socket = DnsSocket::new(\u0026stack);\nlet mut rsa = Rsa::new(peripherals.RSA);\nlet config = TlsConfig::new(\n    reqwless::TlsVersion::Tls1_3,\n    reqwless::Certificates {\n        ca_chain: reqwless::X509::pem(CERT.as_bytes()).ok(),\n        ..Default::default()\n    },\n    Some(\u0026mut rsa), // Will use hardware acceleration\n);\nlet mut client = HttpClient::new_with_tls(\u0026tcp_client, \u0026dns_socket, config);\n\nlet mut request = client\n    .request(reqwless::request::Method::GET, \"https://www.google.com\")\n    .await\n    .unwrap()\n    .content_type(reqwless::headers::ContentType::TextPlain)\n    .headers(\u0026[(\"Host\", \"google.com\")])\n    .send(\u0026mut buffer)\n    .await\n    .unwrap();\n```\n\n### embedded-tls\n`embedded-tls` only supports TLS 1.3, so to establish a connection the server must have this ssl protocol enabled.\n\nAn addition to the tls version requirement, there is also a negotiation of supported algorithms during the establishing phase of the secure communication between the client and server.\nBy default, the set of supported algorithms in `embedded-tls` is limited to algorithms that can run entirely on the stack.\nTo test whether the server supports this limited set of algorithm, try and test the server using the following `openssl` command:\n\n```bash\nopenssl s_client -tls1_3 -ciphersuites TLS_AES_128_GCM_SHA256 -sigalgs \"ECDSA+SHA256:ECDSA+SHA384:ed25519\" -connect hostname:443\n```\n\nIf the server successfully replies to the client hello then the enabled tls version and algorithms on the server should be ok.\nIf the command fails, then try and run without the limited set of signature algorithms\n\n```bash\nopenssl s_client -tls1_3 -ciphersuites TLS_AES_128_GCM_SHA256 -connect hostname:443\n```\n\nIf this works, then there are two options. Either enable the signature algorithms on the server by changing the private key from RSA to ECDSA or ed25519, or enable RSA keys on the client by specifying the `alloc` feature.\nThis enables `alloc` on `embedded-tls` which in turn enables RSA signature algorithms.\n\n\n# Minimum supported Rust version (MSRV)\n\n`reqwless` can compile on stable Rust 1.77 and up.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrogue-iot%2Freqwless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrogue-iot%2Freqwless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrogue-iot%2Freqwless/lists"}