Quantum Leaps, LLC info@state-machine.com www.state-machine.com |
||
HOME | SSI DEMO | CGI DEMO | UDP DEMO |
The HTTP server that comes with lwIP has been extended to support rudimentary Server Side Include (SSI) facility. To enable the SSI support in the lwIP-HTTP server, you need to define the macro INCLUDE_HTTPD_SSI
in the lwipopts.h
header file.
You must also provide your SSI callback function and register it by calling the http_set_ssi_handler()
function. The HTTP server will then scan each file with extension .shtml
, .shtm
or .ssi
for the SSI tags of the form <!--#tag-->
and will replace on-the-fly every recognized SSI tag with the string composed by your SSI callback function. See the HTML source code for this web page (ssi_demo.shtm
) and the SSI callback function definition in lwipmgr.c
.
While designing your own SSI tags, remember that the tag names are limited to 8 characters and the length of the replacement strings cannot exceed 192 characters. You can re-define these limits by changing the macros MAX_TAG_NAME_LEN
and MAX_TAG_INSERT_LEN
, respectively, in the http.h
header file.
Please refer to the Quantum Leaps Application Note: "QP and lwIP TCP/IP Stack" for more information. The Application Note is included in the QP-lwIP example code download.
The following table contains SSI tags embedded in the HTML of this web page. Client browsers never see these tags, as the lwIP-HTTP server replaces them on-the-fly while serving this page. These particular SSI tags cause the target to generate various lwIP link statistics. Please click the Refresh button on your browser to cause re-loading of this page and updating the statistics:
SSI Example | |
Packets sent: | |
Packets received: | |
Packets forwared: | |
Packets dropped: | |
Checksum errors: | |
Packets with invalid length: | |
Memory errors: | |
Routing errors: | |
Protocol errors: | |
Option errors: | |
Miscallaneous errors: |
NOTE: the webpage loads much slower than the others, because it contains 12 SSI tags, and each tag is sent is a separate TCP/IP packet.