{"id":23648267,"url":"https://github.com/tobysolutions/http-server-rust","last_synced_at":"2025-04-10T10:24:00.197Z","repository":{"id":269611328,"uuid":"907985497","full_name":"tobySolutions/http-server-rust","owner":"tobySolutions","description":"A lightweight, concurrent HTTP server built from scratch in Rust, supporting GET and POST methods, file operations, and request header parsing. Features include path-based routing, file handling, and concurrent connection management.","archived":false,"fork":false,"pushed_at":"2024-12-24T19:33:09.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T08:53:31.239Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobySolutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-12-24T19:31:03.000Z","updated_at":"2024-12-26T13:19:47.000Z","dependencies_parsed_at":"2024-12-24T20:24:43.486Z","dependency_job_id":"b64d616d-0f54-4a17-b011-7909c0afa1d5","html_url":"https://github.com/tobySolutions/http-server-rust","commit_stats":null,"previous_names":["tobysolutions/http-server-rust"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fhttp-server-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fhttp-server-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fhttp-server-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fhttp-server-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobySolutions","download_url":"https://codeload.github.com/tobySolutions/http-server-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199087,"owners_count":21063641,"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-12-28T14:53:12.298Z","updated_at":"2025-04-10T10:24:00.169Z","avatar_url":"https://github.com/tobySolutions.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTP Server in Rust\n\nA ground-up implementation of an HTTP/1.1 server in Rust, demonstrating low-level networking, concurrent programming, and file system operations.\n\n## Features\n\n- **HTTP/1.1 Protocol Support**: Implements core HTTP/1.1 specifications\n- **Concurrent Connections**: Handles multiple client connections simultaneously using Rust's threading\n- **Request Routing**: Supports multiple endpoints including:\n  - `/` - Basic server health check\n  - `/echo/{string}` - Echoes back the provided string\n  - `/user-agent` - Returns the client's User-Agent\n  - `/files/{filename}` - File operations (GET and POST)\n- **File Operations**: \n  - GET: Retrieve file contents\n  - POST: Create new files with provided content\n- **Header Processing**: Handles standard HTTP headers including Content-Type and Content-Length\n\n## Technical Details\n\n- Built using Rust's standard library\n- Uses `TcpListener` for network communication\n- Implements thread-based concurrency\n- Handles both static and dynamic responses\n- Supports binary file content via `application/octet-stream`\n\n## Usage\n\n### Building the Server\n\n```bash\ncargo build --release\n```\n\n### Running the Server\n\nBasic server start:\n```bash\n./target/release/http-server\n```\n\nWith file directory support:\n```bash\n./target/release/http-server --directory /path/to/files\n```\n\n### Example Requests\n\nGET request:\n```bash\ncurl -v http://localhost:4221/\n```\n\nEcho endpoint:\n```bash\ncurl -v http://localhost:4221/echo/hello-world\n```\n\nFile upload:\n```bash\ncurl -v --data \"content\" -H \"Content-Type: application/octet-stream\" http://localhost:4221/files/example.txt\n```\n\n## Implementation Details\n\n- **TCP Connection Handling**: Uses Rust's `TcpListener` for accepting connections\n- **Request Parsing**: Custom implementation of HTTP request parsing\n- **Response Formation**: Properly formatted HTTP responses with headers\n- **Concurrency**: Thread-per-connection model for handling multiple clients\n- **Error Handling**: Robust error handling for file operations and network issues\n\n## Learning Outcomes\n\nThis project demonstrates:\n- Low-level networking in Rust\n- HTTP protocol implementation\n- Concurrent programming patterns\n- File system operations\n- Error handling in network applications\n- Request/Response parsing and formatting\n\n## Contributing\n\nFeel free to submit issues and enhancement requests!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobysolutions%2Fhttp-server-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobysolutions%2Fhttp-server-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobysolutions%2Fhttp-server-rust/lists"}