{"id":13440244,"url":"https://github.com/tiny-http/tiny-http","last_synced_at":"2025-05-14T04:07:49.296Z","repository":{"id":18615545,"uuid":"21821080","full_name":"tiny-http/tiny-http","owner":"tiny-http","description":"Low level HTTP server library in Rust","archived":false,"fork":false,"pushed_at":"2024-08-14T21:18:34.000Z","size":5392,"stargazers_count":1068,"open_issues_count":69,"forks_count":132,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-10T17:04:31.629Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crates.io/crates/tiny_http","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/tiny-http.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2014-07-14T13:47:15.000Z","updated_at":"2025-05-09T03:37:18.000Z","dependencies_parsed_at":"2024-10-27T23:46:27.686Z","dependency_job_id":"631f5278-a891-43f6-8d12-89332f343282","html_url":"https://github.com/tiny-http/tiny-http","commit_stats":{"total_commits":436,"total_committers":48,"mean_commits":9.083333333333334,"dds":0.4380733944954128,"last_synced_commit":"33b0f26bb9bc7fd17a0ab2a71cf57f08f1ece74b"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-http%2Ftiny-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-http%2Ftiny-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-http%2Ftiny-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-http%2Ftiny-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiny-http","download_url":"https://codeload.github.com/tiny-http/tiny-http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069449,"owners_count":22009557,"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":[],"created_at":"2024-07-31T03:01:21.016Z","updated_at":"2025-05-14T04:07:49.267Z","avatar_url":"https://github.com/tiny-http.png","language":"Rust","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库"],"sub_categories":["Web programming","网络编程 Web programming","网页编程","web编程 Web programming"],"readme":"# tiny-http\n\n[![Crate][crate_img]][crate]\n[![Documentation][docs_img]][docs]\n![License][license_img]\n[![CI Status][ci_badge]][ci_link]\n\n[**Documentation**](https://docs.rs/tiny_http)\n\nTiny but strong HTTP server in Rust.\nIts main objectives are to be 100% compliant with the HTTP standard and to provide an easy way to create an HTTP server.\n\nWhat does **tiny-http** handle?\n - Accepting and managing connections to the clients\n - Parsing requests\n - Requests pipelining\n - HTTPS (using either OpenSSL, Rustls or native-tls)\n - Transfer-Encoding and Content-Encoding\n - Turning user input (eg. POST input) into a contiguous UTF-8 string (**not implemented yet**)\n - Ranges (**not implemented yet**)\n - `Connection: upgrade` (used by websockets)\n\nTiny-http handles everything that is related to client connections and data transfers and encoding.\n\nEverything else (parsing the values of the headers, multipart data, routing, etags, cache-control, HTML templates, etc.) must be handled by your code.\nIf you want to create a website in Rust, I strongly recommend using a framework instead of this library.\n\n### Installation\n\nAdd this to the `Cargo.toml` file of your project:\n\n```toml\n[dependencies]\ntiny_http = \"0.11\"\n```\n\n### Usage\n\n```rust\nuse tiny_http::{Server, Response};\n\nlet server = Server::http(\"0.0.0.0:8000\").unwrap();\n\nfor request in server.incoming_requests() {\n    println!(\"received request! method: {:?}, url: {:?}, headers: {:?}\",\n        request.method(),\n        request.url(),\n        request.headers()\n    );\n\n    let response = Response::from_string(\"hello world\");\n    request.respond(response);\n}\n```\n\n### Speed\n\nTiny-http was designed with speed in mind:\n - Each client connection will be dispatched to a thread pool. Each thread will handle one client.\n If there is no thread available when a client connects, a new one is created. Threads that are idle\n for a long time (currently 5 seconds) will automatically die.\n - If multiple requests from the same client are being pipelined (ie. multiple requests\n are sent without waiting for the answer), tiny-http will read them all at once and they will\n all be available via `server.recv()`. Tiny-http will automatically rearrange the responses\n so that they are sent in the right order.\n - One exception to the previous statement exists when a request has a large body (currently \u003e 1kB),\n in which case the request handler will read the body directly from the stream and tiny-http\n will wait for it to be read before processing the next request. Tiny-http will never wait for\n a request to be answered to read the next one.\n - When a client connection has sent its last request (by sending `Connection: close` header),\n the thread will immediately stop reading from this client and can be reclaimed, even when the\n request has not yet been answered. The reading part of the socket will also be immediately closed.\n - Decoding the client's request is done lazily. If you don't read the request's body, it will not\n be decoded.\n\n### Examples\n\nExamples of tiny-http in use:\n\n* [heroku-tiny-http-hello-world](https://github.com/frewsxcv/heroku-tiny-http-hello-world) - A simple web application demonstrating how to deploy tiny-http to Heroku\n* [crate-deps](https://github.com/frewsxcv/crate-deps) - A web service that generates images of dependency graphs for crates hosted on crates.io\n* [rouille](https://crates.io/crates/rouille) - Web framework built on tiny-http\n\n### License\n\nThis project is licensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n   http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n   http://opensource.org/licenses/MIT)\n\nat your option.\n\n#### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in tiny-http by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n\u003c!-- Links and Badges --\u003e\n[crate_img]: https://img.shields.io/crates/v/tiny_http.svg?logo=rust \"Crate Page\"\n[crate]: https://crates.io/crates/tiny_http \"Crate Link\"\n[docs]: https://docs.rs/tiny_http \"Documentation\"\n[docs_img]: https://docs.rs/tiny_http/badge.svg \"Documentation\"\n[license_img]: https://img.shields.io/crates/l/tiny_http.svg \"License\"\n[ci_badge]: https://github.com/tiny-http/tiny-http/actions/workflows/ci.yaml/badge.svg \"CI Status\"\n[ci_link]: https://github.com/tiny-http/tiny-http/actions/workflows/ci.yaml \"Workflow Link\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiny-http%2Ftiny-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiny-http%2Ftiny-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiny-http%2Ftiny-http/lists"}