Skip to content

ranjodhsingh1729/ToyHttpServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A TOY HTTP SERVER

This is my toy implementation of an extremely basic http server. Any and all suggestions are welcome.

High Level Design Targets

  1. Core Server Layer

    • Main Listener: Accepts TCP connections.
    • Concurrency: Start with a simple thread-per-connection or thread pool; upgrade to async/event-driven I/O (later).
    • SSL/TLS: Add support for HTTPS (later).
  2. Request Processing Pipeline

    • Parser: Parse incoming HTTP requests into struct, upgrade to a hash map. (later)
    • Router: Simple URL mapping to resolve static file paths.
    • File I/O: Read files from disk with MIME type detection.
    • Encoder: Build and encode HTTP responses.
  3. Cross-Cutting Concerns (Low-Hanging Fruit)

    • Logging & Monitoring: Log requests, errors, and performance metrics.
    • Error Handling: Return proper 404/500 responses.
    • Security: Prevent path traversal and implement basic access control.
    • Compression: Support gzip/Brotli to reduce payload sizes.
    • Caching: In-memory LRU cache for frequently accessed files.
    • Directory Indexing: Support for index files or autoindex as needed.
  4. Future Enhancements

    • Rate Limiting: Mitigate abuse and DoS attacks.
    • CDN Integration: Offload and globally cache static assets.

References

About

This is my toy implementation of an extremely basic http server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published