HTTP_server answer function. :param pkt: a HTTPRequest packet :returns: a HTTPResponse packet
(self, pkt)
| 1273 | # DEV: overwrite this function |
| 1274 | |
| 1275 | def answer(self, pkt): |
| 1276 | """ |
| 1277 | HTTP_server answer function. |
| 1278 | |
| 1279 | :param pkt: a HTTPRequest packet |
| 1280 | :returns: a HTTPResponse packet |
| 1281 | """ |
| 1282 | if pkt.Path == b"/": |
| 1283 | return HTTPResponse() / ( |
| 1284 | "<!doctype html><html><body><h1>OK</h1></body></html>" |
| 1285 | ) |
| 1286 | else: |
| 1287 | return HTTPResponse( |
| 1288 | Status_Code=b"404", |
| 1289 | Reason_Phrase=b"Not Found", |
| 1290 | ) / ("<!doctype html><html><body><h1>404 - Not Found</h1></body></html>") |
| 1291 | |
| 1292 | |
| 1293 | class HTTPS_Server(HTTP_Server): |