{"id":22296450,"url":"https://github.com/mlalic/tokio-solicit","last_synced_at":"2025-07-29T01:32:29.013Z","repository":{"id":66210760,"uuid":"79987515","full_name":"mlalic/tokio-solicit","owner":"mlalic","description":"An async HTTP/2 client, based on Tokio and solicit","archived":false,"fork":false,"pushed_at":"2017-02-21T04:56:24.000Z","size":68,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T05:51:17.738Z","etag":null,"topics":["asynchttp","http2","rust","tokio"],"latest_commit_sha":null,"homepage":null,"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/mlalic.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,"publiccode":null,"codemeta":null}},"created_at":"2017-01-25T05:59:38.000Z","updated_at":"2022-06-23T22:33:27.000Z","dependencies_parsed_at":"2023-02-23T23:15:17.339Z","dependency_job_id":null,"html_url":"https://github.com/mlalic/tokio-solicit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mlalic/tokio-solicit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlalic%2Ftokio-solicit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlalic%2Ftokio-solicit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlalic%2Ftokio-solicit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlalic%2Ftokio-solicit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlalic","download_url":"https://codeload.github.com/mlalic/tokio-solicit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlalic%2Ftokio-solicit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267616579,"owners_count":24116154,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["asynchttp","http2","rust","tokio"],"created_at":"2024-12-03T17:45:36.643Z","updated_at":"2025-07-29T01:32:29.007Z","avatar_url":"https://github.com/mlalic.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tokio_solicit\n\nAn async HTTP/2 client, based on [Tokio](https://tokio.rs/) and [solicit](https://github.com/mlalic/solicit).\n\n# Example\n\n```rust\nextern crate env_logger;\n\nextern crate tokio_core;\nextern crate futures;\nextern crate tokio_solicit;\n\nuse std::str;\nuse std::net::{ToSocketAddrs};\n\nuse futures::{Future};\nuse tokio_core::reactor::{Core};\n\nuse tokio_solicit::client::H2Client;\n\n\nfn main() {\n    env_logger::init().expect(\"logger init is required\");\n\n    // Prepare the Tokio event loop that will run the request to completion.\n    let mut core = Core::new().expect(\"event loop required\");\n    let handle = core.handle();\n\n    // Obtain a `SocketAddr` in any supported way...\n    let addr =\n        \"google.com:443\"\n            .to_socket_addrs()\n            .expect(\"unable to resolve the domain name\")\n            .next()\n            .expect(\"no matching ip addresses\");\n\n    // Prepare the http/2 client, providing it additionally the authority that it\n    // is to communicate to (aka Host name). This returns a future that resolves to\n    // an `H2Client` instance...\n    let future_client = H2Client::connect(\"google.com\", \u0026addr, \u0026handle);\n\n    let future_response = future_client.and_then(|mut client| {\n        // ...once that is resolved, send out the request.\n        println!(\"Connection established.\");\n\n        // (We want the future to resolve only once the full body is ready)\n        client.get(b\"/\").into_full_body_response()\n    });\n\n    // No code up to here actually performed any IO. Now, let's spin up the event loop\n    // and wait for the future we built up to resolve to the response.\n    let response = core.run(future_response).expect(\"unexpected error\");\n\n    // Print both the headers and the response body...\n    println!(\"{:?}\", response.headers);\n    // (Recklessly assume it's utf-8!)\n    let body = str::from_utf8(\u0026response.body).unwrap();\n    println!(\"{}\", body);\n}\n\n```\n\nFor more examples, including how to stream the body of the request and response, check out [`examples/client.rs`](examples/client.rs).\n\n# License\n\nThe project is published under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlalic%2Ftokio-solicit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlalic%2Ftokio-solicit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlalic%2Ftokio-solicit/lists"}