Skip to content

DrkWithT/Tippy_Http_Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Project: "Tippy" HTTP/1.1 Server

Brief

Lately I've been on an HTTP (1.1) server writing frenzy, and I decided to try Python 3.x for implementing a toy web server. This is a toy project made only for learning purposes and to show off my skills. Finally, I credit the "HTTP Made Really Easy" guide and RFC 9112 as my references. Feel free to fork, etc.

Supported HTTP Features:

  • Basic message reading:
    • Basic syntax checks are done.
    • Headers such as Host, Content-Length and Content-Type are checked.
  • Persistent or closing connection handling.
  • HEAD and GET methods.
  • Basic cache control headers are supported.

Other Features:

  • Producer-Worker thread pooling for handling multiple connections (WIP)
  • Graceful shutdown (WIP)

Bugs:

  1. On multiple tabs from Firefox, only one worker is providing service although another is also awake. This could be dependent on varying browser behavior on refresh. Edge / Chrome usually restarts a new connection on a random port, but Firefox seems more conservative with starting new connections?

Old Sample Run:

Some cURL Test Commands:

  • curl --verbose -I http://localhost:8080/index.html (HEAD of static resource)
  • curl --verbose -X GET http://localhost:8080/index.html (GET page)
  • curl --verbose -X GET http://localhost:8080/info.html (GET page)
  • curl --verbose -X GET http://localhost:8080/index.html -H "Connection: Close" -H "If-Modified-Since: Mon, 12 Jun 2023 23:59:59 GMT" (GET page with update date check... modify public/index.html to test this.)

Things To Do??

  1. Refactor server code to be cleaner: modular, well-named, etc. (WIP)
  2. Add URL parsing for relative and absolute URLs.
  3. Add threading. (WIP)
  4. Support 100 Continue. (To do...)

Usage:

1a. On a Mac or UNIX system, run ifconfig -a in the terminal and find your IPv4 address under inet. 1b. On Windows, run ipconfig in the shell and find your IPv4 address. 2. Create a config.json file in the project root folder. It should follow this format:

{
   "serveaddr": "localhost",
   "port": 8080,
   "backlog": 4
}
  1. Run python3 src/main.py for Mac, or python src/main.py for Windows within the project root folder.
  2. Make requests with cURL or your browser!

About

Yet another toy HTTP 1.1 server from a weekend.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy