An expandable Python HTTP server
Go to file
2022-06-08 11:21:12 +02:00
index First commit 2022-02-14 22:43:12 +01:00
modules Add support for Date and Last-Modified headers 2022-06-08 11:21:12 +02:00
fsockets.py First commit 2022-02-14 22:43:12 +01:00
LICENSE Update 'LICENSE' 2022-02-14 21:39:51 +00:00
README.md Update 'README.md' 2022-02-14 22:31:47 +00:00

fhttpy

An expandable Python HTTP server.

You can find settings for the base-server in modules/settings.py, and http-specific settings in modules/http/settings.py.

.pyp

.pyp scripts are quite similar to .php, just that they're Python scripts. Each script gets a variable called env, which contains low-level, as well as high-level information about the request. Open http://127.0.0.1/test/ to see what they're set to. You can also add query parameters, like this: http://127.0.0.1/test/?Key1=Value1&Key2=Value2&etc..., these are digested as well. Edit index/test/index.pyp to see how the test page works.

Description of env:

KeyDescription
selfA reference to the thread the script belongs to.
requestTimeThe time when the request was received, as a Unix timestamp.
headerThe header text the client sent to the server, including the HTTP request line.
protocolHeaderListRequest line digested into a list.
headerListHeaders digested into a dictionary.
cmdMethod requested (get, post, etc).
pathPath extracted from headerList.
argsQuery parameters digested into a dictionary.
pathFixedPath, stripped of errors/malice.
lPathLocal path, relative to index folder (based on pathFixed).
fPathFull path (based on pathFixed).
fileExtFile extension (based on pathFixed).
fPathDirThe file's folder (based on pathFixed).
requestTimeFormattedRequest time formatted for HTML (based on requestTime).
handlerThe function handling the request.
htaccessPropagateWhether to read further htpyaccess files in sub-directories.