Hi, I just released a new version (5.0) of the Web-server-light. The most important changes are:
1) Dictionaries are now used for GET requests, tags and svg parts.
2) Added an HttpRequest parser for GET requests. This saved me a lot of searches and error checking.
Here is how the parser for HttpRequests work: A web page gets the following button:
<button type="submit" NAME=0 VALUE="Switch" style="background-color:#BFBFBF; color:#000000" ; class="btn">Switch</button>
When the button is activated the web-server gets in the req-buf a string containing:
GET /home?1=Switch HTTP/1.1
Then handle-request ( recv-pkt$ cnt -- ) locates that line and does the following:
The characters ? = & are replaced by a space.
So the string to evaluate becomes:
GET /home 1 Switch HTTP/1.1
Then only words in the TCP/IP dictionary are used to evaluate the string.
The word /home is executed after the word HTTP/1.1 is executed.
Errors are catched and shown when possible.
The source for the HttpRequest parser is in Web-server-light.f at:
https://github.com/Jos-Ven/A-smart-home-in-Forth
It runs in Gforth and Win32Forth.
There is also a version for Cforth in webcontrols.fth at
https://github.com/Jos-Ven/cforth/tree/WIP/src/app/esp
Jos
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)