socktools.http_mixin - toy HTTP implementation¶
Overview¶
This is a simple implementation of HTTP for demonstration purposes, if you need a webserver for production use, see webwrap.py.
Python API¶
This module provides a mixin that gets HTTP requests from sockets, the basis of every webserver. No client implementation is provided - urllib or python-requests serves that purpose just fine.
Although it’d be cool, this does not currently support HTTP over UDP. Use it with a TCP socket. The HTTP support is also very basic at present.
Warning
Avoid using send_msg() on HTTP server sockets, this may cause various subtle and tricky to debug issues. Instead use the request object to reply.
-
class
socktools.http_mixin.HTTPMixin[source]¶ Bases:
objectA mixin for implementing HTTP
Use this to get HTTP requests from the socket