Fixed multiple port support and improved it

This commit is contained in:
2022-06-28 07:57:15 -05:00
parent 47cf044858
commit d843ffab93
8 changed files with 119 additions and 23 deletions

View File

@@ -11,15 +11,35 @@ sitefiles also allow comments with #
# Part 2: Commands
* ```set [variable] [value]``` - sets some local variable for the following pages
* ```set [variable] [value]``` - sets some local variable for the following
pages
* ```define [variable] [value]``` - sets some global variable
* ```read [http path] [file path]``` - if the requested path matches ```[http path]```, return the contents of ```[file path]```. If [file path] is a directory, then the http path is appended to [file path] and that is read instead.
* ```linked``` - Run getResponse() from the library loaded from the library global variable
* ```throw [http path] [error code]``` - If the requested path matches ```[http path]```, send back the http error code ```[error code]```. For standardization purposes, these error codes are just the number.
* ```declare [transport] [port]``` - Declares that port ```[port]``` will be used with transport ```[transport]``` where ```[transport]``` is one of ```TCP```, ```TLS```
* ```key [key file] [port]``` - Sets the key file for port ```[port]``` to ```[key file]```
* ```cert [cert file] [port]``` - Sets the certificate file for port ```[port]``` to ```[cert file]```
* ```timeout [timeout] [port]``` - Sets the connection timeout for port ```[port]``` to ```[timeout]``` milliseconds
* ```read [http path] [file path]``` - if the requested path matches
```[http path]```, return the contents of ```[file path]```. If [file path] is
a directory, then the http path is appended to [file path] and that is read
instead.
* ```linked``` - Run getResponse() from the library loaded from the library
global variable
* ```throw [http path] [error code]``` - If the requested path matches
```[http path]```, send back the http error code ```[error code]```. For
standardization purposes, these error codes are just the number.
* ```declare [transport] [port]``` - Declares that port ```[port]``` will be
used with transport ```[transport]``` where ```[transport]``` is one of
```TCP```, ```TLS```.
* ```key [key file] [port]``` - Sets the key file for port ```[port]``` to
```[key file]```
* ```cert [cert file] [port]``` - Sets the certificate file for port
```[port]``` to ```[cert file]```
* ```timeout [timeout] [port]``` - Sets the connection timeout for port
```[port]``` to ```[timeout]``` milliseconds
##### Other than set, commands should take in a regex as argument 1 and operate on a file specified in argument 2.
@@ -29,7 +49,7 @@ sitefiles also allow comments with #
* GET (defualt)
* POST
* ```host``` - The hostname to respond to. Case insensitive regex, default: .*
* ```port``` - The port to respond to, default: 80
* ```port``` - The ports to respond to in a comma separated list. Default: 80
# Part 4: Global variables