2.5 KiB
2.5 KiB
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 calledenv
, 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
:
Key | Description |
---|---|
self | A reference to the thread the script belongs to. |
requestTime | The time when the request was received, as a Unix timestamp. |
header | The header text the client sent to the server, including the HTTP request line. |
protocolHeaderList | Request line digested into a list. |
headerList | Headers digested into a dictionary. |
cmd | Method requested (get , post , etc). |
path | Path extracted from headerList . |
args | Query parameters digested into a dictionary. |
pathFixed | Path, stripped of errors/malice. |
lPath | Local path, relative to index folder (based on pathFixed ). |
fPath | Full path (based on pathFixed ). |
fileExt | File extension (based on pathFixed ). |
fPathDir | The file's folder (based on pathFixed ). |
requestTimeFormatted | Request time formatted for HTML (based on requestTime ). |
handler | The function handling the request. |
htaccessPropagate | Whether to read further htpyaccess files in sub-directories. |