annotate packages/net/athttpd/current/doc/athttpd.sgml @ 2485:0e9d1d1df4a0

* src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a buffer overrun. Jumbo patch containing many individual patches from a number of different contributors on different days.
author asl
date Wed, 18 Jun 2008 18:23:25 +0000
parents 4631139fc774
children 74dbf4c3f2e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2449
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
1 <!-- DOCTYPE part PUBLIC "-//OASIS//DTD DocBook V3.1//EN" -->
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
2 <!-- =============================================================== -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
3 <!-- -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
4 <!-- athttpd.sgml -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
5 <!-- -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
6 <!-- Another Tiny HTTPD Server for eCos -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
7 <!-- -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
8 <!-- =============================================================== -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
9 <!-- ####COPYRIGHTBEGIN#### -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
10 <!-- -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
11 <!-- =============================================================== -->
2449
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
12 <!-- Copyright (C) 2003, 2004, 2007 eCosCentric Ltd. -->
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
13 <!-- This material may be distributed only subject to the terms -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
14 <!-- and conditions set forth in the Open Publication License, v1.0 -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
15 <!-- or later (the latest version is presently available at -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
16 <!-- http://www.opencontent.org/openpub/) -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
17 <!-- =============================================================== -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
18 <!-- -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
19 <!-- ####COPYRIGHTEND#### -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
20 <!-- =============================================================== -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
21 <!-- #####DESCRIPTIONBEGIN#### -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
22 <!-- -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
23 <!-- ####DESCRIPTIONEND#### -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
24 <!-- =============================================================== -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
25
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
26 <!-- }}} -->
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
27
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
28
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
29 <part id="athttpd">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
30 <title>Another Tiny HTTP Server for <productname>eCos</productname></title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
31
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
32 <partintro>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
33 <para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
34 This package provides an extensible, small footprint, full featured HTTP
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
35 server for <productname>eCos</productname>. Many of these features can be
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
36 disabled via the configuration tool, thus reducing the footprint of the server.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
37 The server has been written for the FreeBSD network stack.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
38 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
39 </partintro>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
40
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
41 <chapter id="net-athttpd">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
42 <title>The ATHTTP Server</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
43 <sect1 id="athttpd-features">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
44 <title>Features</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
45 <para>This ATHTTP implementation provides the following features:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
46 <itemizedlist>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
47 <listitem><para>GET, POST and HEAD Methods</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
48 <listitem><para>File system Access</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
49 <listitem><para>Callbacks to C functions</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
50 <listitem><para>MIME type support</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
51 <listitem><para>CGI mechanism through the OBJLOADER package or through a
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
52 simple tcl interpreter</para></listitem>
2485
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2449
diff changeset
53 <listitem><para>Basic and Digest (MD5) Authentication</para></listitem>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
54 <listitem><para>Directory Listing</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
55 <listitem><para>Extendable Internal Resources</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
56 </itemizedlist>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
57
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
58 <para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
59 Ecos tables are used extensively throught the server to provide a high degree
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
60 of customization.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
61 </sect1>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
62
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
63 <sect1 id="athttpd-using">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
64 <title>Starting the server</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
65 <para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
66 In order to start the web server, the user needs to call the function:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
67
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
68 <programlisting width=72>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
69 cyg_httpd_start();
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
70 </programlisting>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
71
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
72 <para>in the application code. The server initialization code spawns a new
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
73 thread which calls <command>init_all_network_interfaces()</command> to
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
74 initialize the TCP/IP stack and then starts the deamon. The function is safe
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
75 to call multiple times.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
76 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
77 </sect1>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
78
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
79 <sect1 id="athttpd-mime-types">
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
80 <title>MIME types</title>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
81 <para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
82 The server has an internal table with all the recognized mime types. Each time
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
83 a file or an internal resource is sent out by the server, its extension is
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
84 searched in this table and if a match is found, the associated MIME type is
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
85 then sent out in the header.
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
86
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
87 The server already provides entries for the following standard file extensions:
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
88
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
89 'html', 'htm', 'gif', 'jpg', 'css', 'js', 'png'
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
90
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
91 and the user is responsible for adding any further entry. The syntax for
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
92 adding an entry is the following:</para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
93
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
94 <para><programlisting width=72>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
95 CYG_HTTPD_MIME_TABLE_ENTRY(entry_label, extension_string, mime_tipe_sting);
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
96
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
97 entry table : an identifier unique to this entry
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
98 extension string : a string containing the extension for this entry
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
99 type_string : the mime string. The strings for many more mime types
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
100 is included in a file in the "doc" directory.
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
101 </programlisting></para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
102
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
103 <para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
104 The following is an example of how to add the Adobe Portable Document Format
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
105 <command>pdf</command> MIME type to the table:</para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
106
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
107 <para><programlisting width=72>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
108 CYG_HTTPD_MIME_TABLE_ENTRY(hal_pdf_entry, "pdf", "application/pdf");
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
109 </programlisting></para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
110
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
111 <sect2 id="athttpd-mime-types-chunked">
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
112 <title>MIME Types for Chunked Frames</title>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
113 <para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
114 For chunked frames, which are generally used inside c language callbacks, there
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
115 is no file name to match an extension to, and thus the extension to be used
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
116 must be passed in the <command>cyg_httpd_start_chunked()</command> call. The
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
117 server will then scan the MIME table to find a MIME type to match the extension.
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
118
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
119 For example, to start a chunked transfer of an <command>html</command> file,
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
120 the following call is used:</para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
121
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
122 <para><programlisting width=72>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
123 cyg_httpd_start_chunked("html");
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
124 </programlisting></para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
125
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
126 <para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
127 In any event, it is the responsibility of the user to make sure that a match to
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
128 all used extensions is found in the table search. Failing this,
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
129 the default MIME type specified in the CYGDAT_NET_ATHTTPD_DEFAULT_MIME_TYPE
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
130 string is returned.</para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
131 </sect2>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
132 </sect1>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
133
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
134 <sect1 id="athttpd-callback">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
135 <title>C language callback functions</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
136 <para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
137 The server allows the association of particular URLs to C language callback
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
138 functions. eCos tables are used to define the association between a URL and its
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
139 corresponding callback. The syntax of the macro to add callback entries to
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
140 the table is:
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
141 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
142
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
143 <para><programlisting width=72>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
144 CYG_HTTPD_HANDLER_TABLE_ENTRY(entry_label, url_string, callback);
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
145
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
146 entry table : an identifier unique to this entry.
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
147 url_string : a string with the extension url that will be appended to the
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
148 default directory.
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
149 callback : a function with a prototype:
2446
a72554718436 * doc/athttpd.cdl: Fixed typos in doc. Return value from handler is not
jlarmour
parents: 2326
diff changeset
150 cyg_int32 callback_function(CYG_HTTPD_STATE*);
a72554718436 * doc/athttpd.cdl: Fixed typos in doc. Return value from handler is not
jlarmour
parents: 2326
diff changeset
151 Return value is ignored - just return 0.
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
152 </programlisting></para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
153
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
154 <para>
2446
a72554718436 * doc/athttpd.cdl: Fixed typos in doc. Return value from handler is not
jlarmour
parents: 2326
diff changeset
155 <command>CYG_HTTPD_STATE*</command> is a pointer to a structure that
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
156 contains, among others, a buffer (outbuffer) that can be used to send data
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
157 out. The definitions of the structure is in http.h.</para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
158
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
159 <para>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
160 The following is an example of how to add a callback to a function myForm()
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
161 whenever the URL /myform.cgi is requested:
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
162 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
163
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
164 <programlisting width=72>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
165 CYG_HTTPD_HANDLER_TABLE_ENTRY(hal_cb_entry, "/myform.cgi", myForm);
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
166 </programlisting>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
167
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
168 <para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
169 and somewhere in the source tree there is a function:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
170
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
171 <programlisting>
2446
a72554718436 * doc/athttpd.cdl: Fixed typos in doc. Return value from handler is not
jlarmour
parents: 2326
diff changeset
172 cyg_int32 myForm(CYG_HTTPD_STATE* p)
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
173 {
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
174 cyg_httpd_start_chunked("html");
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
175 strcpy(p->outbuffer, "eCos Web Server");
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
176 cyg_httpd_write_chunked(p->outbuffer, strlen(p->outbuffer))
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
177 cyg_httpd_end_chunked();
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
178 }
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
179 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
180
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
181 <para>This function also shows the correct method of using the chunked frames
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
182 API inside a c language callback and also shows the use of outbuffer to
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
183 collect data to send out.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
184
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
185 <para>Chunked frames are useful when the size of the frame is not known upfront.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
186 In this case it possible to send a response in chunks of various sizes, and
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
187 terminate it with a null chunk (See RFC 2616 for details). To use chunked
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
188 frames, the <command>cyg_httpd_start_chunked()</command> function is used.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
189 The prototype is the following:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
190
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
191 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
192 ssize_t cyg_httpd_start_chunked(char *);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
193 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
194
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
195 <para>The only parameter is the <command>extension</command> to use in the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
196 search for the MIME type. For most files this will be "html" or "htm" and
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
197 it will be searched in the MIME table for an approriate MIME type that will
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
198 be sent along in the header. The function returns the number of bytes sent
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
199 out.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
200
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
201 <para>The chunked frame must be terminated by a call to
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
202 <command>cyg_httpd_end_chunked()</command>:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
203
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
204 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
205 void cyg_httpd_end_chunked()(void);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
206 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
207
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
208 <para>In between these two calls, the user can call the function
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
209 <command>cyg_httpd_write_chunked()</command> to send out data any number of
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
210 times. It is important that <command>cyg_httpd_write_chunked()</command> be
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
211 the only function used to send data out for chunked frames. This
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
212 guarantees that proper formatting of the response is respected.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
213 The prototype for the function is:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
214
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
215 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
216 ssize_t cyg_httpd_write_chunked(char* p, int len);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
217 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
218
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
219 <para>The 'char*' points to the data to send out, the 'int' is the length of the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
220 data to send.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
221
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
222 <para>In the case in which the size of the data is known upfront, the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
223 callback can instead create the header with a call to
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
224 <command>cyg_httpd_create_std_header()</command> with the following
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
225 prototype:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
226
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
227 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
228 void cyg_httpd_create_std_header(char *ext, int len);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
229
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
230 extension : the extension used in the search of the MIME type
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
231 len : length of the data to send out
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
232 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
233
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
234 <para>and use
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
235 <command>cyg_httpd_write()</command> to send data out to the client. The
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
236 prototype of <command>cyg_httpd_write()</command> is the same as
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
237 <command>cyg_httpd_write_chunked()</command></para></sect1>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
238
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
239 <sect1 id="athttpd-cgi">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
240 <title>CGI</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
241 <para>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
242 The web server allows writing of pseudo-CGI programs. This is helpful in order
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
243 to modify the functionality of the server without having to recompile it and
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
244 reflash it.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
245
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
246 <para>One way to implement CGI is, of course, the C language callback mechanism
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
247 described above: This assumes, of course, that all the callbacks are written
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
248 by compile time and cannot be modified later on. Another way to perform the
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
249 same functionality is the use of a library in the form of an object file.
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
250 These object files reside in the file system and are loaded, executed and
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
251 unloaded on demand.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
252
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
253 <para>Yet a third way is the use of a scripting language. Since full fledged
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
254 implementation of the most popular scripting languages such as Python or Perl
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
255 are too large for most embedded systems, a slim down implementation of tcl
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
256 was chosen for this server. Most of the tcl functionality is still there,
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
257 and makes writing cgi a lot easier.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
258
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
259 <para>In order to limit the footprint of the operating system support for both
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
260 the objloader and the tcl script for dealing with cgi files can be
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
261 independently selected out. Tcl support in particular increases the memory
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
262 requirements considerably.
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
263 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
264
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
265 <sect2 id="athttpd-cgi-objloader">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
266 <title>CGI via objloader</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
267 <para>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
268 In order to use the cgi mechanism the CYGPKG_OBJLOADER must be included
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
269 when building the operating system. This will enable the proper option in the
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
270 configuration tool and if selected, the necessary code will be compiled
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
271 in the eCos kernel. The user will then have to compile the necessary libraries
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
272 and place them in the file system under a directory defined by
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
273 CYGDAT_NET_ATHTTPD_SERVEROPT_CGIDIR.
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
274 When a request is made, the web server checks if the root directory of the
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
275 requested URL is inside the CYGDAT_NET_ATHTTPD_SERVEROPT_CGIDIR directory.
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
276 If so, the server assumes that the user requested a cgi file and looks into the
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
277 directory to see if a library by the same name is present, and if so load it
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
278 and tries to execute a function inside the library with the following prototype:
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
279 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
280
2446
a72554718436 * doc/athttpd.cdl: Fixed typos in doc. Return value from handler is not
jlarmour
parents: 2326
diff changeset
281 <programlisting width=72>void exec_cgi(CYG_HTTPD_STATE *)
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
282 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
283
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
284 <para>
2446
a72554718436 * doc/athttpd.cdl: Fixed typos in doc. Return value from handler is not
jlarmour
parents: 2326
diff changeset
285 The pointer <command>CYG_HTTPD_STATE*</command> gives access to the socket
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
286 data: The user will use this pointer to access the 'outbuffer' and use it to
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
287 copy data to send data out.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
288 </para>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
289
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
290 <para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
291 When using the OBJLOADER package within the HTTP server a number of functions
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
292 are automatically added to the externals table of the OBJLOADER package. These
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
293 functions are likely to be used inside the library and the relocator need to
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
294 have a pointer to them. In order to add more functions, see the OBJLOADER
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
295 documentation. The complete list of the functions automatically added is:
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
296 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
297
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
298 <itemizedlist>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
299 <listitem><para>cyg_httpd_start_chunked()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
300 <listitem><para>cyg_httpd_write_chunked()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
301 <listitem><para>cyg_httpd_end_chunked()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
302 <listitem><para>cyg_httpd_write()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
303 <listitem><para>cyg_httpd_find_form_variable()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
304 <listitem><para>cyg_httpd_find_ires()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
305 <listitem><para>cyg_httpd_send_ires()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
306 <listitem><para>diag_printf()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
307 <listitem><para>cyg_httpd_format_header()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
308 <listitem><para>cyg_httpd_find_mime_string()</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
309 </itemizedlist>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
310
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
311 <para>Every time the web client issues a GET or POST request for a file with an
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
312 extension of '.o'in the /cgi-bin directory (or whatever path the user chooses
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
313 to hold the libraries) then the library by that name is loaded, run and
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
314 when the execution is over, it is dumped from memory.
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
315
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
316 The library must be compiled separately, using the same toolchain used to
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
317 compile the server and then added to the file system.</para>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
318
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
319 <para>In order to reduce the footprint of the server, CGI through OBJLOADER
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
320 can be compiled out by unchecking CYGOPT_NET_ATHTTPD_USE_CGIBIN_OBJLOADER
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
321 in the configuration tool.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
322 </sect2>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
323
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
324 <sect2 id="athttpd-cgi-tcl">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
325 <title>CGI via the simple tcl interpreter</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
326 <para>A small tcl interpreter has been added to the web server, and it can
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
327 be used to write simple cgi scripts. The interpreter is admittedly very
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
328 minimal, and it is only useful for very simple applications, but it is an
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
329 excellent starting point for further development.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
330
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
331 <para>In order for the scripting language to be useful, it has to access
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
332 the form variables passed on during the GET or POST request. Because of
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
333 this, all form variables registered with the CYG_HTTPD_FVAR_TABLE_ENTRY()
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
334 macro are accessible via tcl. For example, if we have registered a
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
335 form variable called foo, and during the GET request we are defining foo
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
336 as being "1":</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
337
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
338 <programlisting width=72>GET /myForm.cgi?foo=1</programlisting>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
339
2485
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2449
diff changeset
340 <para>then tcl will be able to access the variable foo as $foo. The data
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2449
diff changeset
341 in the body of a POST request is also accessible through the use of the variable
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2449
diff changeset
342 $post_data. This is useful if the data is not in "multipart/form-data"
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2449
diff changeset
343 and tcl has to perform any type of processing on the data itself.</para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
344
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
345 <para>In order to send back a response to the client a few functions have been
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
346 added to the interpreter. These functions are:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
347
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
348 <sect3 id="athttpd-start-chunked">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
349 <title>start_chunked</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
350 <programlisting width=72>start_chunked "extension";</programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
351 <para>"extension" is a string used to search the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
352 table of the mime types. For example, to send back to the client an HTML file,
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
353 we can use: start_chunked "html";
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
354 </para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
355 </sect3>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
356
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
357 <sect3 id="athttpd-write-chunked">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
358 <title>write_chunked</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
359 <programlisting width=72>write_chunked content;</programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
360 <para>content is a string to send back to the client.
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
361 </para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
362 </sect3>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
363
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
364 <sect3 id="athttpd-end-chunked">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
365 <title>end_chunked</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
366 <programlisting width=72>end_chunked;</programlisting>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
367 <para>No parameters. Send back an end of frame to the client.</para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
368 </sect3>
2449
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
369
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
370 <sect3 id="athttpd-tcl-hello-world">
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
371 <title>tcl hello world example</title>
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
372 <para>
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
373 The following example demonstrates how to send a log file in the file
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
374 <filename>/ram/log</filename> to a web client. It replaces
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
375 newline characters with <literal>&lt;br&gt;</literal> so that it is formatted on the
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
376 browser correctly.
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
377 <programlisting width=72>
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
378 start_chunked "html";
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
379
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
380 set fp [aio.open "/ram/log" r];
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
381 $fp seek 0 end;
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
382 set fsize [$fp tell];
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
383 $fp seek 0 start;
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
384 set data "abcxxx";
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
385 set data [$fp read $fsize];
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
386 $fp close;
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
387 set data [string map {\n &lt;br&gt;} $data];
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
388
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
389 set datax "";
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
390 append datax "&lt;html&gt;&lt;body&gt;" $data "&lt;/body&gt;&lt;/html&gt;";
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
391
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
392 write_chunked $datax;
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
393 end_chunked;
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
394 </programlisting>
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
395 </para>
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
396 <para>
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
397 The above file should exist on a filesystem
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
398 on the embedded target within its <filename class=directory>cgi-bin</filename>
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
399 directory, for example as <filename>/cgi-bin/hello.tcl</filename>. Thereafter
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
400 it may be accessed at the URL
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
401 <literal>http://<replaceable>TARGET_NAME</replaceable>/cgi-bin/hello.tcl</literal>.
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
402 </para>
4631139fc774 * doc/athttpd.sgml: added an example of a tcl script.
jlarmour
parents: 2446
diff changeset
403 </sect3>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
404 </sect2>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
405 </sect1>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
406
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
407 <sect1 id="athttpd-authentication">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
408 <title>Authentication</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
409 <para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
410 The server supports both Basic (base64) and Digest (MD5) authentication,
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
411 although they have not been tested with all clients. In this implementation,
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
412 the contents of certain directories of the file system can be protected, such
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
413 that the user will be required to issue a username/password to access the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
414 content of the directory.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
415
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
416 <para>To protect a directory with a basic authentication, there is a
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
417 specific macro:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
418
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
419 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
420 CYG_HTTPD_AUTH_TABLE_ENTRY(entry, path, domain, un, pw, mode)
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
421
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
422 entry : an identifier unique to this entry.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
423 path : the path to the directory whose content must be
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
424 authenticated before it is sent out
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
425 domain : a domain identifier for this directory.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
426 un : username for authentication
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
427 pw : password for authentication
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
428 mode : CYG_HTTPD_AUTH_BASIC for base64 encoding or
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
429 CYG_HTTPD_AUTH_DIGEST for MD5 encoding
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
430 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
431
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
432 <para>for example, to require basic authentication of the content of directory
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
433 "/ecos/" with a username of "foo" and password "bar", the following is used:
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
434 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
435
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
436 <programlisting>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
437 CYG_HTTPD_AUTH_TABLE_ENTRY(hal_domain1_entry, \
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
438 "/ecos/", "ecos_domain", \
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
439 "foo", "bar", \
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
440 CYG_HTTPD_AUTH_BASIC);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
441 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
442
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
443 <para>Any request for a file in the directory /ecos/ will now trigger a
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
444 credential check. These credentials, once provided, are automatically sent by
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
445 the client for every request within the particular domain.</para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
446
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
447 <para>It must be noticed that the path name set in the macro is relative to the
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
448 HTML document directory, CYGDAT_NET_HTTPD_SERVEROPT_HTMLDIR and it is the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
449 first part of the path provided by the client request (including the leading
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
450 slash).</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
451
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
452 <para>In order to reduce the footprint of the server, authentication
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
453 is not enabled by default, and so the option CYGOPT_NET_ATHTTPD_USE_AUTH must
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
454 be used to enable support for basic and digest authentication.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
455
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
456 <para>The MD5 digest authentication support is implemented using the RSA
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
457 Data Security, Inc. MD5 Message-Digest Algorithm. Derivative works with
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
458 MD5 digest authentication included must be identified as "derived from the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
459 RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
460 mentioning or referencing the derived work. See the file md5.c within this
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
461 package for license details.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
462 </sect1>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
463
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
464 <sect1 id="athttpd-dirlist">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
465 <title>Directory Listing</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
466
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
467 <para>If the user issues a "GET" request with a URL terminating in a slash, the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
468 server will try to locate one of the following index files in the directory,
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
469 choosing one in the following order:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
470
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
471 <itemizedlist>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
472 <listitem><para>index.html</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
473 <listitem><para>index.htm</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
474 <listitem><para>default.html</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
475 <listitem><para>home.html</para></listitem>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
476 </itemizedlist>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
477
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
478 <para>If any of these files is found, its contents are sent back
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
479 to the client. If no such file is found the server uses the user-provided
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
480 index file name (if any is specified with the CYGDAT_NET_ATHTTPD_ALTERNATE_HOME
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
481 setting. Failing all this a directory listing is sent.</para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
482
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
483 <para>Trailing slash redirection for directory names is supported.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
484
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
485 <para>In order to reduce the footprint of the server, directory listing can
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
486 be disabled by unchecking CYGOPT_NET_ATHTTPD_USE_DIRLIST. The savings are
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
487 substantial since directory listing also makes use of a few internal
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
488 resources (gif files) which are also compiled out.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
489 </sect1>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
490
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
491 <sect1 id="athttpd-formvars">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
492 <title>Form Variables</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
493
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
494 <para>The server will automatically try to parse form variables when a form is
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
495 submitted in the following cases:
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
496
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
497 <itemizedlist>
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
498 <listitem><para>In a GET request, when the URL is followed by a question
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
499 mark sign</para></listitem>
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
500 <listitem><para>In a POST request, when the the 'Content-Type' header line
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
501 is set to 'application/x-www-form-urlencoded'</para></listitem>
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
502 </itemizedlist>
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
503
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
504 The variable names to look for during the parsing are held in
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
505 an eCos table. In order to take advantage of this feature, the user first
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
506 adds the variable names to the table, which also requires providing a buffer
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
507 where the parsed value will eventually be stored. The values will then be
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
508 available in the buffers during the processing of the request, presumably in
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
509 the body of a c language callback or CGI script.</para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
510
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
511 <para>For example, if the user wants two form variables, "foo" and "bar", to
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
512 be parsed automatically, those variable names must be added to the table
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
513 with the following macro:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
514
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
515 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
516 CYG_HTTPD_FVAR_TABLE_ENTRY(entry, name, buffp, bufflen)
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
517
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
518 entry : an identifier unique to this entry.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
519 name : name of the form variable
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
520 buffp : a pointer to a buffer of characters where to store the value
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
521 of the form variable.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
522 bufflen : The length of the buffer. Must include a trailing string
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
523 terminator.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
524 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
525
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
526 <para>or, in the specific instance mentioned above:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
527
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
528 <programlisting>
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
529 #define HTML_VAR_LEN 20
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
530 char var_foo[HTML_VAR_LEN];
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
531 char var_bar[HTML_VAR_LEN];
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
532 CYG_HTTPD_FVAR_TABLE_ENTRY(hal_form_entry_foo, "foo", var_foo, HTML_VAR_LEN);
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
533 CYG_HTTPD_FVAR_TABLE_ENTRY(hal_form_entry_bar, "bar", var_bar, HTML_VAR_LEN);
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
534 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
535
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
536 <para>and after the GET or POST submissions, the list will contain the value
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
537 for "foo" and "bar" (if they were found in the form data.) It is the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
538 responsability of the user to make sure that the buffer is large enough
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
539 to hold all the data parsed (including the string terminator). The parser will
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
540 write only up to the length of the buffer minus one (the last being the
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
541 terminator) and discard any additional data.</para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
542
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
543 <para>The values parsed are likely going to be used in c language callback, or
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
544 in CGI files. In a c language callback the user can directly access the pointers
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
545 of individual variables for further processing, keeping in mind that the parsing
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
546 always result in a string of characters to be produced, and any conversion
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
547 (e.g. from strings to integer) must be performed within the callback. In
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
548 a TCL script the user can just access a variable by its name. For example,
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
549 in the case of the variables 'foo' and 'bar' shown above, it is possible
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
550 to do something like 'write_chunked "You wrote $foo". The data that was sent in
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
551 the body of a POST request is accessible in through a variable called
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
552 'post_data'. In CGI functions
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
553 implemented using the objloader the pointers to the
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
554 variables cannot be accessed directly, since the library will likely not
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
555 know their location in memory. The proper way to access them is by using the
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2265
diff changeset
556 cyg_httpd_find_form_variable() function from within the library:</para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
557
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
558 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
559 char* cyg_httpd_find_form_variable(char* name)
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
560
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
561 name : name of the form variable to look up
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
562
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
563 returns a pointer to the buffer, or 0 if the variable was not found.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
564 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
565
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
566 <para>When using the OBJLOADER package within the web server, an entry
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
567 for the cyg_httpd_find_form_variable() function is automatically added to the
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
568 externals table the OBJLOADER for relocation. See the OBLOADER paragraph of
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
569 the ATHTTP user's guide for the full list of the exported functions.</para>
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
570
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
571 <para>In order to avoid stale data, all the buffers in the table are cleared
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
572 before running the parser and thus any variable in the list that was not
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
573 assigned a new value dureing the request will be an empty string.</para>
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
574 </sect1>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
575
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
576 <sect1 id="athttpd-ires">
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
577 <title>Internal Resources</title>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
578
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
579 <para>When the server does not use a file system the user must be responsible
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
580 to provide a C language callback function for each URL that will be
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
581 requested by the client. This means locating the data and sending it out
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
582 using either <command>cyg_httpd_write()</command> or
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
583 <command>cyg_httpd_write_chunked()</command>.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
584
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
585 <para>In order to simplify this process the server allows registering
2265
b5670f3c40f2 * cdl/httpd.cdl:
jlarmour
parents: 2253
diff changeset
586 any number of URLs as internal resources, by providing the URL name, the
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
587 pointer to the resource data and its size. When a URL is requested the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
588 server will look it up among all internal resources, and if found, it
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
589 will send out the resource.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
590
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
591 <para>Internal resource can also be used along with a file system. In this
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
592 case the file system is searched first, and if a file is found, it it
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
593 sent. If a file is not found, the internal resources are searched and
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
594 if a match if found it is sent.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
595
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
596 <para>The drawback of this approach is, of course, that all these
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
597 resources are going to add to the size of the operating system image, and thus
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
598 it should be used only when memory is not a major constraint of the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
599 design.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
600
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
601 <para>As always, to provide this type of customization, ecos tables are used.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
602 The format for adding a new resource to the internal table is the following:
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
603 </para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
604
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
605 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
606 CYG_HTTPD_IRES_TABLE_ENTRY(entry, name, buffp, len)
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
607
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
608 entry : an identifier unique to this entry.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
609 name : name of the URL including leading '/'
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
610 buffp : a pointer to a buffer of characters where to store the value
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
611 of the form variable.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
612 len : size of the array
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
613 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
614
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
615 <para>As an example, if the user wants to provide his own web page by
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
616 hardcoding it in the application code, here is how he would do it:</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
617
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
618 <programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
619 #define MY_OWN_HOME_PAGE "eCos RTOS"
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
620 CYG_HTTPD_IRES_TABLE_ENTRY(cyg_httpd_ires_home, \
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
621 "/index.html", \
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
622 MY_OWN_HOME_PAGE, \
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
623 9);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
624 </programlisting>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
625
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
626 <para>The extension of the file name determines the MIME type to be used for
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
627 internal resources.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
628
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
629 <para>When using directory listing you are implicitly making use of internal
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
630 resources. The small icons that appear to the left of file names and
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
631 directories are internal resources. Unchecking CYGOPT_NET_HTTP_USE_DIRLIST
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
632 will prevent the addition of these files.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
633
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
634 <para>In order to use internal resources, a generic file must first be
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
635 turned into a c language array, which is then compiled in the application
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
636 code. To create this array you can use the tcl script that comes with the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
637 ecos distribution at packages/fs/rom/current/support/file2.tcl.</para>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
638 </sect1>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
639 </chapter>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
640 </part>