Dec 7, 2017 03:25 PM
(This post was last modified: Dec 16, 2017 07:28 PM by Barret.)
Lightweight Webserver
Default screenshots
Spoiler (Click to View)
Xm Script Front-End screenshot
Spoiler (Click to View)
Features:
Mime Support
The server has an internal database with content types (MIME) which you change within the config,
these settings are important since they tell the browser how to handle certain files, ie show text files as plain but send zip files instead.
If a certain extension is not found, the server will fall back to the default octet-stream which the browser receives as a download.
Virtual Hostings aka Prefix
You can define multiple hostnames on the server within each its own VirtualHost elements inside the config file,
Obviously you cannot just put anything in there, however if you change your Hosts file in your OS, for instance
you add '127.0.1.1 my.local.website' in which then the prefix/VirtualHost 'my.local.website' can respond for that hostname with a VirtualHost definition.
If you are not interested in this and just want to host on local and be able to catch all, use the *:80 as prefix, this will do just that.
Directory Listing
The server has the ability to list a folder with no defined or default index pages, each VirtualHost has its own Template.xml where the body of that page is made from.
Also when the directory contains a Readme.md it will display the content of the readme inside the header automatically.
Example of template config:
https://github.com/TheBarret/WebServer.N...mplate.xml
Security
The server has a few basic security checks upon each request, it will always verify the GET variables and path request for illegal characters such
as attempts for breaking out of the root folder using the double dots, ie "..\..\..\file.ext".
Speed and Compression
The server by default uses GZip for each data transfer of anything that is to be send and we utilize a threadpool and queue system so the server can throttle on your settings,
nothing is done in a single thread.
Plugin Support
The server has a plugin support where the plugins can claim a request or modify live the send buffer, there is an example plugin project included that shows how to do this.
Plugins are setup in the config.xml, notice that the plugins require the Webserver.exe for reference, the '../' is required to load the plugins inside the base directory.
Example of a demo plugin
https://github.com/TheBarret/WebServer.N.../Plugin.vb
Example of a plugin script handler
https://github.com/TheBarret/WebServer.N.../Plugin.vb
Remark:
You need to recompile the plugins (regarding the XM plugin and its engine) yourself else you get a security/CAS exception, this is a VS built-in safety feature.
Accessing GET/POST variables
The server stores all the variables, send by the user, in the Client.Data collection.
Per directory access control
You can Allow or Deny who can access certain directories done in the access.xml, this file can be placed in any directory.
This approach is adopted from the Apache server software where it utilizes the .htaccess config files
Example of such access config:
https://github.com/TheBarret/WebServer.N...access.xml
The Configuration file
The base paths are relative to where the server is operating (executes), the default base path in this project is .\html, for each website an individual directory.
You can add or remove custom headers for whatever reason, it will automatically send these each request.
It will hide by default filenames and directories with a name that starts with a dot, this is familiar and normal in the Linux OS as well, this can be disabled.
You can also define file extensions that you absolutely don't want to be shown or send, this can be found under the HiddenFileTypes.
Example of the config file: https://github.com/TheBarret/WebServer.N...config.xml
Alright, have fun!
Github: https://github.com/TheBarret/WebServer.Net
Default screenshots
Spoiler (Click to View)
Xm Script Front-End screenshot
Spoiler (Click to View)
Features:
- Mime Support
- Multiple Vhosts
- Directory Listing
- Basic Security Checks
- Compressed Transfers
- Custom Error Reponse
- Readme.md embedding
- Plugin Support
- GET/POST Handling
- XML Configuration
- Per Directory Access control
Mime Support
The server has an internal database with content types (MIME) which you change within the config,
these settings are important since they tell the browser how to handle certain files, ie show text files as plain but send zip files instead.
If a certain extension is not found, the server will fall back to the default octet-stream which the browser receives as a download.
Virtual Hostings aka Prefix
You can define multiple hostnames on the server within each its own VirtualHost elements inside the config file,
Obviously you cannot just put anything in there, however if you change your Hosts file in your OS, for instance
you add '127.0.1.1 my.local.website' in which then the prefix/VirtualHost 'my.local.website' can respond for that hostname with a VirtualHost definition.
If you are not interested in this and just want to host on local and be able to catch all, use the *:80 as prefix, this will do just that.
Directory Listing
The server has the ability to list a folder with no defined or default index pages, each VirtualHost has its own Template.xml where the body of that page is made from.
Also when the directory contains a Readme.md it will display the content of the readme inside the header automatically.
Example of template config:
https://github.com/TheBarret/WebServer.N...mplate.xml
Security
The server has a few basic security checks upon each request, it will always verify the GET variables and path request for illegal characters such
as attempts for breaking out of the root folder using the double dots, ie "..\..\..\file.ext".
Speed and Compression
The server by default uses GZip for each data transfer of anything that is to be send and we utilize a threadpool and queue system so the server can throttle on your settings,
nothing is done in a single thread.
Plugin Support
The server has a plugin support where the plugins can claim a request or modify live the send buffer, there is an example plugin project included that shows how to do this.
Plugins are setup in the config.xml, notice that the plugins require the Webserver.exe for reference, the '../' is required to load the plugins inside the base directory.
Example of a demo plugin
https://github.com/TheBarret/WebServer.N.../Plugin.vb
Example of a plugin script handler
https://github.com/TheBarret/WebServer.N.../Plugin.vb
Remark:
You need to recompile the plugins (regarding the XM plugin and its engine) yourself else you get a security/CAS exception, this is a VS built-in safety feature.
Accessing GET/POST variables
The server stores all the variables, send by the user, in the Client.Data collection.
Per directory access control
You can Allow or Deny who can access certain directories done in the access.xml, this file can be placed in any directory.
This approach is adopted from the Apache server software where it utilizes the .htaccess config files
Example of such access config:
https://github.com/TheBarret/WebServer.N...access.xml
The Configuration file
The base paths are relative to where the server is operating (executes), the default base path in this project is .\html, for each website an individual directory.
You can add or remove custom headers for whatever reason, it will automatically send these each request.
It will hide by default filenames and directories with a name that starts with a dot, this is familiar and normal in the Linux OS as well, this can be disabled.
You can also define file extensions that you absolutely don't want to be shown or send, this can be found under the HiddenFileTypes.
Example of the config file: https://github.com/TheBarret/WebServer.N...config.xml
Alright, have fun!
Github: https://github.com/TheBarret/WebServer.Net



![[Image: signaturetwo.png]](https://u.cubeupload.com/Vyxn/signaturetwo.png)