Giter Site home page Giter Site logo

torxed / slimhttp Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 3.0 1.58 MB

A minimalistic no-dependencies HTTP server written in Python. Supports: vhosts, REST, WebSocket¹, reverse proxy and static file delivery.

License: GNU General Public License v3.0

Python 100.00%
http server web https webserver vhost minimal tiny not-secure rest

slimhttp's People

Contributors

didr avatar torxed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

slimhttp's Issues

Expected input checks

Would be nice if we checked input against specific lengths etc.
For instance:

Traceback (most recent call last):
  File "test.py", line 85, in <module>
    resposne = client.parse()
  File "/home/torxed/github/slimHTTP/slimhttpd.py", line 97, in parse
    return http_request(self).parse()
  File "/home/torxed/github/slimHTTP/slimhttpd.py", line 243, in parse
    method, header = header.split(b'\r\n',1)
ValueError: not enough values to unpack (expected 2, got 1)

Should probably have a sanity check before-hand. Even tho this is never meant to be in a production environment unless it's behind a proper HTTP reverse proxy.

check_config should identify loops in proxy mode

If a vhost is set to proxy mode, and where the proxy target/endpoint is 127.0.0.1:443, slimHTTP will hang indefinitely due to the lack of threads. Since slimHTTP will connect to the proxy (self), and wait for data as it's not part of the main event loop (yet).
Which means that slimHTTP can't process the incoming client request from itself - and thus hang.

the HTTP_PROXY_REQUEST should be part of the main event poller, although I'm not sure how to wrap it in there just yet.
So for now, let check_config find and warn/raise an issue when the proxy config points to a listening address/session of itself.

Lack of error handling

A general lack of error handling, the event pipeline should easily be able to pick issues up and act accordingly.

Paralell tasks support for epoll() style

A good example is f76354d which introduced Transfer-Encoding: chunked, which allows the server to deliver partial content at a certain interval. If paralell epoll() events are introduced, that would mean the server doesn't need to "hang" while a large file is being transfered, the individual chunks could be delivered to each user individually, freeing up resources.

We'll have to be careful with RAM management here, as the main reason for slimHTTP is to use as little resources as possible while not sacrificing speed or the flexibility to be deviant in the HTTP world. But would be nice to have paralell tasks so multiple users can browse the resources while still delivering large payloads.

Reverse proxy support

Simplest possible way of creating a proxy pipe some how.
No idea how that would fit in there, but it should definitely override HTTP_REQUEST or something similar into a PROXY_PIPE or something. That would be the final feature for v1.0 I recon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.