mirror of
https://github.com/QuantumLeaps/qpcpp.git
synced 2025-01-28 06:02:56 +08:00
99 lines
5.6 KiB
Plaintext
99 lines
5.6 KiB
Plaintext
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="content-type" content="text/html;charset=ISO-8869-1">
|
|
<TITLE>QP/lwIP--SSI Demo</TITLE>
|
|
<LINK href="style.css" type=text/css rel=Stylesheet>
|
|
<LINK rel="icon" href="img/favicon.ico" type="image/x-icon" />
|
|
</HEAD>
|
|
|
|
<BODY>
|
|
<A NAME="Top"></A>
|
|
<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
|
|
<TR>
|
|
<TD id=masthead noWrap align=left><A href="http://www.state-machine.com"><IMG
|
|
src="img/logo_ql.jpg"
|
|
title="Quantum Leaps - innovating embedded systems"
|
|
alt="Quantum Leaps - innovating embedded systems"
|
|
style="padding-bottom:5px;"></A>
|
|
</TD>
|
|
<TD width="100%"></TD>
|
|
<TD nowrap>
|
|
<B>Quantum Leaps, LLC</B><br>
|
|
<A HREF="mailto:info@state-machine.com">info@state-machine.com</A><br>
|
|
<A HREF="http://www.state-machine.com">www.state-machine.com</A>
|
|
</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD id="menu" colspan="3" noWrap align=left bgcolor="#000099" height="25">
|
|
<BIG> <A HREF="index.htm">HOME</A> |
|
|
<B>SSI DEMO</B> |
|
|
<A HREF="cgi_demo.htm">CGI DEMO</A> |
|
|
<A HREF="udp_demo.htm">UDP DEMO</A></BIG>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- BEGIN_CONTENT -->
|
|
<A NAME="About"></A>
|
|
<H1>About SSI Support</H1>
|
|
|
|
<A HREF="http://www.state-machine.com/lwip" TARGET="_blank"><IMG SRC="img/logo_lwip_qp.jpg" ALT="QP-lwIP" align="left" hspace="10" vspace="5"></A>
|
|
|
|
<P>The HTTP server that comes with <strong>lwIP</strong> has been extended to support rudimentary <strong>Server Side Include (SSI)</strong> facility. To enable the SSI support in the lwIP-HTTP server, you need to define the macro <CODE>INCLUDE_HTTPD_SSI</CODE> in the <CODE>lwipopts.h</CODE> header file.
|
|
|
|
<A HREF="http://www.state-machine.com/lwip/AN_QP_and_lwIP.pdf" TARGET="_blank"><IMG SRC="img/AN_QP_and_lwIP.jpg" ALT="Application Note (1.4MB PDF)" align="right" hspace="10" vspace="5"></A>
|
|
|
|
You must also provide your SSI callback function and register it by calling the <CODE>http_set_ssi_handler()</CODE> function. The HTTP server will then scan each file with extension <CODE>.shtml</CODE>, <CODE>.shtm</CODE> or <CODE>.ssi</CODE> for the SSI tags of the form <CODE><!--#tag--></CODE> 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 (<CODE>ssi_demo.shtm</CODE>) and the SSI callback function definition in <CODE>lwipmgr.c</CODE>.
|
|
</P>
|
|
<P>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 <CODE>MAX_TAG_NAME_LEN</CODE> and <CODE>MAX_TAG_INSERT_LEN</CODE>, respectively, in the <CODE>http.h</CODE> header file.
|
|
</P>
|
|
<P>Please refer to the Quantum Leaps Application Note: <A HREF="http://www.state-machine.com/lwip/AN_QP_and_lwIP.pdf" TARGET="_blank">"QP and lwIP TCP/IP Stack"</A> for more information. The Application Note is included in the QP-lwIP example code download.
|
|
</P>
|
|
|
|
<A NAME="Example"></A>
|
|
<H1>SSI Example</H1>
|
|
<P>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 <strong>lwIP</strong> link statistics. Please click the Refresh button on your browser to cause re-loading of this page and updating the statistics:
|
|
</P>
|
|
|
|
<TABLE summary="cgi example" cellspacing=4 cellpadding=1 align="center" valign="middle">
|
|
<TR align="left">
|
|
<TD colspan="2" bgcolor="#ffff66" align="center"><strong>SSI Example</strong>
|
|
</TD>
|
|
</TR>
|
|
<TR bgColor=#eeeeee><TD>Packets sent:</TD>
|
|
<TD align="right" width="100px"><!--#s_xmit--></TD></TR>
|
|
<TR bgColor=#eeeeee><TD>Packets received:</TD>
|
|
<TD align="right"><!--#s_recv--></TD></TR>
|
|
<TR bgColor=#e0e0e0><TD>Packets forwared:</TD>
|
|
<TD align="right"><!--#s_fw--></TD></TR>
|
|
<TR bgColor=#eeeeee><TD>Packets dropped:</TD>
|
|
<TD align="right"><!--#s_drop--></TD></TR>
|
|
<TR bgColor=#e0e0e0><TD>Checksum errors:</TD>
|
|
<TD align="right"><!--#s_chkerr--></TD></TR>
|
|
<TR bgColor=#eeeeee><TD>Packets with invalid length:</TD>
|
|
<TD align="right"><!--#s_lenerr--></TD></TR>
|
|
<TR bgColor=#e0e0e0><TD>Memory errors:</TD>
|
|
<TD align="right"><!--#s_memerr--></TD></TR>
|
|
<TR bgColor=#eeeeee><TD>Routing errors:</TD>
|
|
<TD align="right"><!--#s_rterr--></TD></TR>
|
|
<TR bgColor=#e0e0e0><TD>Protocol errors:</TD>
|
|
<TD align="right"><!--#s_proerr--></TD></TR>
|
|
<TR bgColor=#eeeeee><TD>Option errors:</TD>
|
|
<TD align="right"><!--#s_opterr--></TD></TR>
|
|
<TR bgColor=#e0e0e0><TD>Miscallaneous errors:</TD>
|
|
<TD align="right"><!--#s_err--></TD></TR>
|
|
</TABLE>
|
|
<br />
|
|
<P><strong>NOTE:</strong> 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.
|
|
</P>
|
|
<br />
|
|
|
|
<div id="footer">
|
|
<p>© 2002-2010 Quantum Leaps - All Rights Reserved | 103 Cobble Ridge Drive, Chapel Hill, NC 27516, USA<br />
|
|
Toll-free: 866.450.LEAP | Direct: 919.360.5668 | Fax: 919.869.2998 | <a href="mailto:info@quantum-leaps.com">info@quantum-leaps.com</a></p>
|
|
</div> <!-- id="footer" -->
|
|
|
|
</BODY>
|
|
</HTML>
|