annotate packages/net/httpd/current/src/httpd.c @ 1008:4ca8a5f30c03

* src/monitor.c (cyg_monitor_network): Added IPv6 information to the display of network information. * tests/httpd1.c: New file: Simple program to actually run the server so we can test it. * cdl/httpd.cdl: Added the test program. * src/httpd.c: Added support for serving content over IPv6, * doc/httpd.sgml: Added comment about IPv6.
author asl
date Mon, 12 May 2003 10:24:23 +0000
parents ca4f29d41b18
children 657f409c5dfe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
1 /* =================================================================
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
2 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
3 * httpd.c
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
4 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
5 * A simple embedded HTTP server
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
6 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
7 * =================================================================
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
8 * ####ECOSGPLCOPYRIGHTBEGIN####
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
9 * -------------------------------------------
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
10 * This file is part of eCos, the Embedded Configurable Operating
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
11 * System.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
12 * Copyright (C) 2002 Nick Garnett.
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
13 * Copyright (C) 2003 Andrew Lunn.
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
14 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
15 * eCos is free software; you can redistribute it and/or modify it
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
16 * under the terms of the GNU General Public License as published by
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
17 * the Free Software Foundation; either version 2 or (at your option)
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
18 * any later version.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
19 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
20 * eCos is distributed in the hope that it will be useful, but
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
21 * WITHOUT ANY WARRANTY; without even the implied warranty of
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
23 * General Public License for more details.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
24 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
25 * You should have received a copy of the GNU General Public License
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
26 * along with eCos; if not, write to the Free Software Foundation,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
27 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
28 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
29 * As a special exception, if other files instantiate templates or
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
30 * use macros or inline functions from this file, or you compile this
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
31 * file and link it with other works to produce a work based on this
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
32 * file, this file does not by itself cause the resulting work to be
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
33 * covered by the GNU General Public License. However the source code
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
34 * for this file must still be made available in accordance with
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
35 * section (3) of the GNU General Public License.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
36 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
37 * This exception does not invalidate any other reasons why a work
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
38 * based on this file might be covered by the GNU General Public
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
39 * License.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
40 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
41 * -------------------------------------------
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
42 * ####ECOSGPLCOPYRIGHTEND####
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
43 * =================================================================
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
44 * #####DESCRIPTIONBEGIN####
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
45 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
46 * Author(s): nickg@calivar.com
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
47 * Contributors: nickg@calivar.com, Andrew.lunn@ascom.ch
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
48 * Date: 2002-10-14
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
49 * Purpose:
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
50 * Description:
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
51 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
52 * ####DESCRIPTIONEND####
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
53 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
54 * =================================================================
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
55 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
56
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
57 #include <pkgconf/system.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
58 #include <pkgconf/isoinfra.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
59 #include <pkgconf/httpd.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
60
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
61 #include <cyg/infra/cyg_trac.h> /* tracing macros */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
62 #include <cyg/infra/cyg_ass.h> /* assertion macros */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
63
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
64 #include <unistd.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
65 #include <fcntl.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
66 #include <sys/stat.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
67 #include <stdio.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
68 #include <errno.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
69 #include <string.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
70
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
71 #include <network.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
72 #include <arpa/inet.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
73
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
74 #include <cyg/httpd/httpd.h>
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
75
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
76 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
77
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
78 #if 0
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
79 #define HTTPD_DIAG diag_printf
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
80 #else
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
81 #define HTTPD_DIAG(...)
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
82 #endif
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
83
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
84 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
85 /* Server socket address and file descriptor.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
86 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
87
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
88 static struct sockaddr_in server_address;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
89
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
90 static int server_socket = -1;
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
91 #ifdef CYGPKG_NET_INET6
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
92 static int server_socket6 = -1;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
93 static struct sockaddr_in6 server_address6;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
94 #endif
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
95
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
96 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
97 /* Thread stacks, etc.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
98 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
99
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
100 static cyg_uint8 httpd_stacks[CYGNUM_HTTPD_THREAD_COUNT]
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
101 [CYGNUM_HAL_STACK_SIZE_MINIMUM+
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
102 CYGNUM_HTTPD_SERVER_BUFFER_SIZE+
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
103 CYGNUM_HTTPD_THREAD_STACK_SIZE];
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
104
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
105 static cyg_handle_t httpd_thread[CYGNUM_HTTPD_THREAD_COUNT];
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
106
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
107 static cyg_thread httpd_thread_object[CYGNUM_HTTPD_THREAD_COUNT];
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
108
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
109 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
110 /* Filename lookup table
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
111 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
112
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
113 CYG_HAL_TABLE_BEGIN( cyg_httpd_table, httpd_table );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
114 CYG_HAL_TABLE_END( cyg_httpd_table_end, httpd_table );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
115
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
116 __externC cyg_httpd_table_entry cyg_httpd_table[];
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
117 __externC cyg_httpd_table_entry cyg_httpd_table_end[];
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
118
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
119 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
120 /* Page not found message
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
121 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
122
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
123 static char cyg_httpd_not_found[] =
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
124 "<head><title>Page Not found</title></head>\n"
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
125 "<body><h2>The requested URL was not found on this server.</h2></body>\n";
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
126
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
127 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
128 /* Simple pattern matcher for filenames
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
129 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
130 * This performs a simple pattern match between the given name and the
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
131 * pattern. At present the only matching supported is either exact, or
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
132 * if the pattern ends in * then that matches all remaining
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
133 * characters. At some point we might want to implement a more
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
134 * complete regular expression parser here.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
135 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
136
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
137 static cyg_bool match( char *name, char *pattern )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
138 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
139 while( *name != 0 && *pattern != 0 && *name == *pattern )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
140 name++, pattern++;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
141
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
142 if( *name == 0 && *pattern == 0 )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
143 return true;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
144
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
145 if( *pattern == '*' )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
146 return true;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
147
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
148 return false;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
149 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
150
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
151
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
152 /* ================================================================= */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
153 /* Main processing function */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
154 /* */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
155 /* Reads the HTTP header, look it up in the table and calls the */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
156 /* handler. */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
157 static void cyg_httpd_process( int client_socket, struct sockaddr *client_address ) {
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
158
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
159 int calen = sizeof(*client_address);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
160 int nlc = 0;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
161 char request[CYGNUM_HTTPD_SERVER_BUFFER_SIZE];
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
162 FILE *client;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
163 cyg_httpd_table_entry *entry = cyg_httpd_table;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
164 char *filename;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
165 char *formdata = NULL;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
166 char *p;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
167 cyg_bool success = false;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
168 char name[64];
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
169 char port[10];
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
170
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
171 getnameinfo(client_address, calen, name, sizeof(name),
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
172 port, sizeof(port), NI_NUMERICHOST|NI_NUMERICSERV);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
173 HTTPD_DIAG("Connection from %s[%s]\n",name,port);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
174
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
175 /* Convert the file descriptor to a C library FILE object so
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
176 * we can use fprintf() and friends on it.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
177 */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
178 client = fdopen( client_socket, "r+");
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
179
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
180 /* We are really only interested in the first line.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
181 */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
182 fgets( request, sizeof(request), client );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
183
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
184 HTTPD_DIAG("Request >%s<\n", request );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
185
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
186 /* Absorb the rest of the header. We nibble it away a
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
187 * character at a time like this to avoid having to define
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
188 * another buffer to read lines into. If we ever need to take
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
189 * more interest in the header fields, we will need to be a
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
190 * lot more sophisticated than this.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
191 */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
192 do{
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
193 int c = getc( client );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
194 HTTPD_DIAG("%c",c);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
195 if( c == '\n' )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
196 nlc++;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
197 else if( c != '\r' )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
198 nlc = 0;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
199 } while(nlc < 2);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
200
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
201 /* Extract the filename and any form data being returned.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
202 * We know that the "GET " request takes 4 bytes.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
203 * TODO: handle POST type requests as well as GET's.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
204 */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
205
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
206 filename = p = request+4;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
207
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
208 /* Now scan the filename until we hit a space or a '?'. If we
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
209 * end on a '?' then the rest is a form request. Put NULs at
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
210 * the end of each string.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
211 */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
212 while( *p != ' ' && *p != '?' )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
213 p++;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
214 if( *p == '?' )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
215 formdata = p+1;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
216 *p = 0;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
217
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
218 if( formdata != NULL )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
219 {
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
220 while( *p != ' ' )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
221 p++;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
222 *p = 0;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
223 }
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
224
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
225 HTTPD_DIAG("Request filename >%s< formdata >%s<\n",filename,formdata?formdata:"-NULL-");
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
226
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
227 HTTPD_DIAG("table: %08x...%08x\n",cyg_httpd_table, cyg_httpd_table_end);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
228
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
229 /* Now scan the table for a matching entry. If we find one
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
230 * call the handler routine. If that returns true then we
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
231 * terminate the scan, otherwise we keep looking.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
232 */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
233 while( entry != cyg_httpd_table_end )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
234 {
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
235 HTTPD_DIAG("try %08x: %s\n", entry, entry->pattern);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
236
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
237 if( match( filename, entry->pattern ) )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
238 {
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
239 if( (success = entry->handler( client, filename, formdata, entry->arg )) )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
240 break;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
241 }
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
242
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
243 entry++;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
244 }
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
245
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
246 /* If we failed to find a match in the table, send a "not
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
247 * found" response.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
248 * TODO: add an optional fallback to go look for files in
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
249 * some filesystem, somewhere.
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
250 */
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
251 if( !success )
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
252 cyg_httpd_send_html( client, NULL, NULL, cyg_httpd_not_found );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
253
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
254 fclose(client);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
255 }
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
256
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
257 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
258 /* Main HTTP server
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
259 *
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
260 * This just loops, collects client connections, and calls the main
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
261 * process function on the connects*/
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
262
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
263 static void cyg_httpd_server( cyg_addrword_t arg )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
264 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
265 do
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
266 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
267 int err;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
268 int client_socket;
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
269 struct sockaddr client_address;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
270 int calen = sizeof(client_address);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
271 fd_set readfds;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
272 int n;
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
273
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
274 /* Wait for a connection.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
275 */
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
276 FD_ZERO(&readfds);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
277 FD_SET(server_socket, &readfds);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
278 #ifdef CYGPKG_NET_INET6
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
279 FD_SET(server_socket6, &readfds);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
280 n = (server_socket > server_socket6 ? server_socket : server_socket6) + 1;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
281 #else
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
282 n = server_socket + 1;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
283 #endif
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
284 select(n,&readfds,NULL,NULL,NULL);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
285 if (FD_ISSET(server_socket, &readfds)) {
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
286 client_socket = accept( server_socket, &client_address, &calen );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
287 cyg_httpd_process(client_socket, &client_address);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
288 err = close( client_socket );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
289 CYG_ASSERT( err == 0, "fclose() returned error");
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
290 }
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
291 #ifdef CYGPKG_NET_INET6
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
292 if (FD_ISSET(server_socket6, &readfds)) {
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
293 client_socket = accept( server_socket6, &client_address, &calen );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
294 cyg_httpd_process(client_socket, &client_address);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
295 err = close( client_socket );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
296 CYG_ASSERT( err == 0, "fclose(AF_INET6) returned error");
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
297 }
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
298 #endif
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
299 } while(1);
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
300 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
301
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
302 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
303 /* Initialization thread
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
304 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
305 * Optionally delay for a time before getting the network
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
306 * running. Then create and bind the server socket and put it into
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
307 * listen mode. Spawn any further server threads, then enter server
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
308 * mode.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
309 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
310
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
311 static void cyg_httpd_init(cyg_addrword_t arg)
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
312 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
313 int i;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
314 int err = 0;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
315
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
316 /* Delay for a configurable length of time to give the application
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
317 * a chance to get going, or even complete, without interference
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
318 * from the HTTPD.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
319 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
320 if( CYGNUM_HTTPD_SERVER_DELAY > 0 )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
321 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
322 cyg_thread_delay( CYGNUM_HTTPD_SERVER_DELAY );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
323 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
324
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
325 server_address.sin_family = AF_INET;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
326 server_address.sin_len = sizeof(server_address);
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
327 server_address.sin_addr.s_addr = INADDR_ANY;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
328 server_address.sin_port = htons(CYGNUM_HTTPD_SERVER_PORT);
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
329 #ifdef CYGPKG_NET_INET6
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
330 server_address6.sin6_family = AF_INET6;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
331 server_address6.sin6_len = sizeof(server_address6);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
332 server_address6.sin6_addr = in6addr_any;
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
333 server_address6.sin6_port = htons(CYGNUM_HTTPD_SERVER_PORT);
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
334 #endif
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
335 /* Get the network going. This is benign if the application has
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
336 * already done this.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
337 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
338 init_all_network_interfaces();
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
339
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
340 /* Create and bind the server socket.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
341 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
342 server_socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
343 CYG_ASSERT( server_socket > 0, "Socket create failed");
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
344
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
345 err = bind( server_socket, (struct sockaddr *)&server_address,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
346 sizeof(server_address) );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
347 CYG_ASSERT( err == 0, "bind() returned error");
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
348
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
349 err = listen( server_socket, SOMAXCONN );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
350 CYG_ASSERT( err == 0, "listen() returned error" );
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
351 #ifdef CYGPKG_NET_INET6
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
352 server_socket6 = socket( AF_INET6, SOCK_STREAM, IPPROTO_TCP );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
353 CYG_ASSERT( server_socket6 > 0, "Socket AF_INET6 create failed");
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
354
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
355 err = bind( server_socket6, (struct sockaddr *)&server_address6,
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
356 sizeof(server_address6) );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
357 CYG_ASSERT( err == 0, "bind(AF_INET6) returned error");
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
358
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
359 err = listen( server_socket6, SOMAXCONN );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
360 CYG_ASSERT( err == 0, "listen(AF_INET6) returned error" );
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
361 #endif
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
362 /* If we are configured to have more than one server thread,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
363 * create them now.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
364 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
365 for( i = 1; i < CYGNUM_HTTPD_THREAD_COUNT; i++ )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
366 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
367 cyg_thread_create( CYGNUM_HTTPD_THREAD_PRIORITY,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
368 cyg_httpd_server,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
369 0,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
370 "HTTPD",
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
371 &httpd_stacks[i][0],
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
372 sizeof(httpd_stacks[i]),
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
373 &httpd_thread[i],
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
374 &httpd_thread_object[i]
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
375 );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
376
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
377 cyg_thread_resume( httpd_thread[i] );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
378 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
379
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
380 /* Now go be a server ourself.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
381 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
382 cyg_httpd_server(arg);
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
383 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
384
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
385 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
386 /* System initializer
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
387 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
388 * This is called from the static constructor in init.cxx. It spawns
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
389 * the main server thread and makes it ready to run.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
390 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
391
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
392 __externC void cyg_httpd_startup(void)
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
393 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
394 cyg_thread_create( CYGNUM_HTTPD_THREAD_PRIORITY,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
395 cyg_httpd_init,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
396 0,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
397 "HTTPD",
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
398 &httpd_stacks[0][0],
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
399 sizeof(httpd_stacks[0]),
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
400 &httpd_thread[0],
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
401 &httpd_thread_object[0]
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
402 );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
403
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
404 cyg_thread_resume( httpd_thread[0] );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
405 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
406
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
407 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
408 /* HTTP protocol handling
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
409 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
410 * cyg_http_start() generates an HTTP header with the given content
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
411 * type and, if non-zero, length.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
412 * cyg_http_finish() just adds a couple of newlines for luck and
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
413 * flushes the stream.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
414 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
415
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
416 __externC void cyg_http_start( FILE *client, char *content_type,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
417 int content_length )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
418 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
419 fputs( "HTTP/1.1 200 OK\n"
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
420 "Server: " CYGDAT_HTTPD_SERVER_ID,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
421 client );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
422
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
423 if( content_type != NULL )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
424 fprintf( client,"Content-type: %s\n", content_type );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
425
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
426 if( content_length != 0 )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
427 fprintf( client, "Content-length: %d\n", content_length );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
428
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
429 fputs( "Connection: close\n"
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
430 "\n",
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
431 client );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
432 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
433
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
434 __externC void cyg_http_finish( FILE *client )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
435 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
436 fputs( "\n\n", client );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
437 fflush( client );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
438 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
439
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
440
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
441 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
442 /* HTML tag generation
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
443 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
444 * These functions generate standard HTML begin and end tags. By using
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
445 * these rather than direct printf()s we help to reduce the number of
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
446 * distinct strings present in the executable.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
447 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
448
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
449 __externC void cyg_html_tag_begin( FILE *client, char *tag, char *attr )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
450 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
451 char *pad = "";
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
452
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
453 if( attr == NULL )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
454 attr = pad;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
455 else if( attr[0] != 0 )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
456 pad = " ";
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
457
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
458 fprintf(client, "<%s%s%s>\n",tag,pad,attr);
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
459 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
460
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
461 __externC void cyg_html_tag_end( FILE *client, char *tag )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
462 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
463 fprintf( client, "<%s%s%s>\n","/",tag,"");
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
464 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
465
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
466 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
467 /* Parse form request data
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
468 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
469 * Given a form response string, we parse it into an argv/environment
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
470 * style array of "name=value" strings. We also convert any '+'
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
471 * separators back into spaces.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
472 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
473 * TODO: also translate any %xx escape sequences back into real
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
474 * characters.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
475 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
476
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
477 __externC void cyg_formdata_parse( char *data, char *list[], int size )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
478 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
479 char *p = data;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
480 int i = 0;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
481
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
482 list[i] = p;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
483
1008
4ca8a5f30c03 * src/monitor.c (cyg_monitor_network): Added IPv6 information to
asl
parents: 468
diff changeset
484 while( p && *p != 0 && i < size-1 )
468
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
485 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
486 if( *p == '&' )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
487 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
488 *p++ = 0;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
489 list[++i] = p;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
490 continue;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
491 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
492 if( *p == '+' )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
493 *p = ' ';
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
494 p++;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
495 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
496
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
497 list[++i] = 0;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
498 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
499
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
500 /* ----------------------------------------------------------------- */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
501 /* Search for a form response value
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
502 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
503 * Search a form response list generated by cyg_formdata_parse() for
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
504 * the named element. If it is found a pointer to the value part is
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
505 * returned. If it is not found a NULL pointer is returned.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
506 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
507
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
508 __externC char *cyg_formlist_find( char *list[], char *name )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
509 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
510 while( *list != 0 )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
511 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
512 char *p = *list;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
513 char *q = name;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
514
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
515 while( *p == *q )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
516 p++, q++;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
517
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
518 if( *q == 0 && *p == '=' )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
519 return p+1;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
520
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
521 list++;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
522 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
523
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
524 return 0;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
525 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
526
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
527 /* ================================================================= */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
528 /* Predefined page handlers
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
529 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
530
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
531 /* ----------------------------------------------------------------- */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
532 /* Send an HTML page from a single string
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
533 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
534 * This just sends the string passed as the argument with an HTTP
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
535 * header that describes it as HTML. This is useful for sending
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
536 * straightforward static web content.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
537 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
538
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
539 __externC cyg_bool cyg_httpd_send_html( FILE *client, char *filename,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
540 char *request, void *arg )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
541 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
542 html_begin( client );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
543
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
544 fwrite( arg, 1, strlen((char *)arg), client );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
545
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
546 html_end( client );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
547
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
548 return true;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
549 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
550
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
551 /* ----------------------------------------------------------------- */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
552 /* Send arbitrary data
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
553 *
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
554 * This takes a pointer to a cyg_httpd_data structure as the argument
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
555 * and sends the data therein after a header that uses the content
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
556 * type and size from the structure. This is useful for non-HTML data
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
557 * such a images.
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
558 */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
559
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
560 __externC cyg_bool cyg_httpd_send_data( FILE *client, char *filename,
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
561 char *request, void *arg )
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
562 {
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
563 cyg_httpd_data *data = (cyg_httpd_data *)arg;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
564
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
565 cyg_http_start( client, data->content_type, data->content_length );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
566
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
567 fwrite( data->data, 1, data->content_length, client );
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
568
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
569 return true;
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
570 }
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
571
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
572 /* ----------------------------------------------------------------- */
ca4f29d41b18 Created new HTTPD package.
nickg
parents:
diff changeset
573 /* end of httpd.c */