Skip to content
/ httPY Public

A simple HTTP server implemented in Python that handles basic HTTP requests and responds according to specified endpoints.

Notifications You must be signed in to change notification settings

Ashfinn/httPY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues


httPY

A simple HTTP server implementation in Python.

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

httPY is a solution to the "Build Your Own HTTP Server" Challenge. It is a simple HTTP server implemented in Python that handles basic HTTP requests and responds according to specified endpoints.

Features

  • Handles incoming HTTP GET and POST requests.
  • Supports various endpoints:
    • /: Returns a 200 OK response.
    • /echo/{message}: Echoes back the provided message.
    • /user-agent: Retrieves and returns the User-Agent header from the request.
    • /files/{filename}: Serves a file from the specified directory.
    • POST /files/{filename}: Accepts file uploads and stores them in the specified directory.
  • Logs incoming requests and headers.
  • Serves static files from a specified directory.
  • Accepts file uploads and stores them appropriately.
  • Error handling for common HTTP status codes (200, 400, 404, 500).
  • Implemented using Python's socket module for foundational understanding.

Built With

Python

(back to top)

Getting Started

Follow these instructions to set up httPY locally.

Prerequisites

Ensure you have Python installed on your machine. httPY is compatible with Python 3.6 and above.

Installation

  1. Clone the repository
    git clone https://github.com/Ashfinn/httPY.git
  2. Navigate to the project directory
    cd httPY
  3. (Optional) Create and activate a virtual environment
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  4. Install dependencies
    pip install -r requirements.txt
  5. Run the server
    python server.py
  6. Access the server Open your browser and navigate to http://localhost:8080

(back to top)

Usage

httPY provides several endpoints to interact with. Below are some examples of how to use them:

  • Root Endpoint

    GET /

    Response:

    HTTP/1.1 200 OK
    
  • Echo Message

    GET /echo/HelloWorld

    Response:

    HTTP/1.1 200 OK
    HelloWorld
    
  • User-Agent

    GET /user-agent

    Response:

    HTTP/1.1 200 OK
    [Your User-Agent]
    
  • Serve a File

    GET /files/example.txt

    Response:

    HTTP/1.1 200 OK
    [Contents of example.txt]
    
  • Upload a File

    POST /files/upload.txt
    [File data]

    Response:

    HTTP/1.1 201 Created
    

For more detailed usage examples and advanced configurations, please refer to the Documentation.

(back to top)

Roadmap

This roadmap outlines the planned enhancements and features for the httPY project. The goal is to improve the functionality, security, and usability of the server.

  • Implement basic HTTP GET and POST request handling
  • Support multiple endpoints (/, /echo/{message}, /user-agent, /files/{filename})
  • Serve static files from a specified directory
  • Accept and store file uploads
  • Log incoming requests and headers
  • Handle common HTTP status codes (200, 400, 404, 500)
  • Add HTTPS support for secure communication
  • Implement request routing capabilities
  • Develop middleware functionality
  • Create a web-based interface for monitoring server activity
  • Integrate real-time data processing features
  • Provide examples integrating with modern web frameworks
  • Develop detailed use-case examples and tutorials
  • Enhance documentation with comprehensive guides
  • Showcase real-world applications or projects using httPY
  • Create a series of tutorial videos demonstrating usage and features
  • Improve code comments and documentation
  • Implement extensive error handling and logging
  • Write unit tests to ensure code reliability and maintainability
  • Refactor code for better readability and performance

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
    git clone https://github.com/Ashfinn/httPY.git
  2. Create your Feature Branch
    git checkout -b feature/AmazingFeature
  3. Commit your Changes
    git commit -m 'Add some AmazingFeature'
  4. Push to the Branch
    git push origin feature/AmazingFeature
  5. Open a Pull Request

Feel free to open issues for bug reports or feature requests. Don't forget to give the project a star! Thanks again!

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Obidur Rahman - @linkedIn - [email protected]

Project Link: https://github.com/Ashfinn/httPY

(back to top)

Acknowledgments

(back to top)

About

A simple HTTP server implemented in Python that handles basic HTTP requests and responds according to specified endpoints.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages