Update 'README.md'

This commit is contained in:
Fierelier 2022-02-14 22:31:47 +00:00
parent c906766c46
commit 2be4e502cc

View File

@ -1,5 +1,28 @@
# fhttpy
<h1>fhttpy</h1>
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`.
You can find settings for the base-server in <code>modules/settings.py</code>, and http-specific settings in <code>modules/http/settings.py</code>.
<h2>.pyp</h2>
.pyp scripts are quite similar to .php, just that they're Python scripts. Each script gets a variable called <code>env</code>, which contains low-level, as well as high-level information about the request. Open <code>http://127.0.0.1/test/</code> to see what they're set to. You can also add query parameters, like this: <code>http://127.0.0.1/test/?Key1=Value1&Key2=Value2&etc...</code>, these are digested as well. Edit <code>index/test/index.pyp</code> to see how the test page works.
<h4>Description of <code>env</code>:</h4>
<table>
<th>Key</th><th>Description</th>
<tr><td><b><code>self</code></b></td><td>A reference to the thread the script belongs to.</td></tr>
<tr><td><b><code>requestTime</code></b></td><td>The time when the request was received, as a Unix timestamp.</td></tr>
<tr><td><b><code>header</code></b></td><td>The header text the client sent to the server, including the HTTP request line.</td></tr>
<tr><td><b><code>protocolHeaderList</code></b></td><td>Request line digested into a list.</td></tr>
<tr><td><b><code>headerList</code></b></td><td>Headers digested into a dictionary.</td></tr>
<tr><td><b><code>cmd</code></b></td><td>Method requested (<code>get</code>, <code>post</code>, etc).</td></tr>
<tr><td><b><code>path</code></b></td><td>Path extracted from <code>headerList</code>.</td></tr>
<tr><td><b><code>args</code></b></td><td>Query parameters digested into a dictionary.</td></tr>
<tr><td><b><code>pathFixed</code></b></td><td>Path, stripped of errors/malice.</td></tr>
<tr><td><b><code>lPath</code></b></td><td>Local path, relative to index folder (based on <code>pathFixed</code>).</td></tr>
<tr><td><b><code>fPath</code></b></td><td>Full path (based on <code>pathFixed</code>).</td></tr>
<tr><td><b><code>fileExt</code></b></td><td>File extension (based on <code>pathFixed</code>).</td></tr>
<tr><td><b><code>fPathDir</code></b></td><td>The file's folder (based on <code>pathFixed</code>).</td></tr>
<tr><td><b><code>requestTimeFormatted</code></b></td><td>Request time formatted for HTML (based on <code>requestTime</code>).</td></tr>
<tr><td><b><code>handler</code></b></td><td>The function handling the request.</td></tr>
<tr><td><b><code>htaccessPropagate</code></b></td><td>Whether to read further htpyaccess files in sub-directories.</td></tr>
</table>