annotate packages/net/athttpd/current/include/http.h @ 2729:74dbf4c3f2e1 after-copyright-change-20090129

Update all copyright banners to reflect FSF ownership; fix and improve licence text.
author jlarmour
date Thu, 29 Jan 2009 17:47:46 +0000
parents 0e9d1d1df4a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
1 /* =================================================================
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
2 *
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
3 * http.h
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
4 *
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
5 * Improved HTTPD server.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
6 *
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
7 * =================================================================
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
8 * ####ECOSGPLCOPYRIGHTBEGIN####
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
9 * -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
10 * This file is part of eCos, the Embedded Configurable Operating System.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
11 * Copyright (C) 2005 Free Software Foundation, Inc.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
12 *
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
13 * eCos is free software; you can redistribute it and/or modify it under
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
14 * the terms of the GNU General Public License as published by the Free
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
15 * Software Foundation; either version 2 or (at your option) any later
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
16 * version.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
17 *
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
18 * eCos is distributed in the hope that it will be useful, but WITHOUT
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
21 * for more details.
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
22 *
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
23 * You should have received a copy of the GNU General Public License
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
24 * along with eCos; if not, write to the Free Software Foundation, Inc.,
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
26 *
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
27 * As a special exception, if other files instantiate templates or use
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
28 * macros or inline functions from this file, or you compile this file
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
29 * and link it with other works to produce a work based on this file,
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
30 * this file does not by itself cause the resulting work to be covered by
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
31 * the GNU General Public License. However the source code for this file
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
32 * must still be made available in accordance with section (3) of the GNU
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
33 * General Public License v2.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
34 *
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
35 * This exception does not invalidate any other reasons why a work based
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
36 * on this file might be covered by the GNU General Public License.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
37 * -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2485
diff changeset
38 * ####ECOSGPLCOPYRIGHTEND####
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
39 * =================================================================
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
40 * #####DESCRIPTIONBEGIN####
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
41 *
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
42 * Author(s): Anthony Tonizzo (atonizzo@gmail.com)
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
43 * Contributors:
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
44 * Date: 2006-06-12
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
45 * Purpose:
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
46 * Description:
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
47 *
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
48 * ####DESCRIPTIONEND####
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
49 *
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
50 * =================================================================
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
51 */
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
52 #ifndef __HTTP_H__
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
53 #define __HTTP_H__
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
54
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
55 #include <pkgconf/system.h>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
56 #include <pkgconf/isoinfra.h>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
57 #include <cyg/hal/hal_tables.h>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
58
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
59 #include <pkgconf/athttpd.h>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
60 #include <cyg/athttpd/auth.h>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
61
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
62 #ifdef CYGOPT_NET_ATHTTPD_USE_CGIBIN_TCL
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
63 #include <cyg/athttpd/jim.h>
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
64 #endif
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
65
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
66
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
67 typedef enum cyg_httpd_req_type
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
68 {
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
69 CYG_HTTPD_METHOD_GET = 1,
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
70 CYG_HTTPD_METHOD_HEAD = 2,
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
71 CYG_HTTPD_METHOD_POST = 3
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
72 } cyg_httpd_req_type;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
73
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
74 #define CYG_HTTPD_MAXURL 128
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
75 #define CYG_HTTPD_MAXPATH 128
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
76
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
77 #define CYG_HTTPD_MAXINBUFFER CYGNUM_ATHTTPD_SERVER_BUFFER_SIZE
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
78 #define CYG_HTTPD_MAXOUTBUFFER CYGNUM_ATHTTPD_SERVER_BUFFER_SIZE
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
79
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
80 #define CYG_HTTPD_DEFAULT_CGIBIN_OBJLOADER_EXTENSION ".o"
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
81 #define CYG_HTTPD_DEFAULT_CGIBIN_TCL_EXTENSION ".tcl"
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
82
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
83 #define CYG_HTTPD_TIME_STRING_LEN 32
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
84
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
85 #define CYG_HTTPD_STATUS_OK 200
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
86 #define CYG_HTTPD_STATUS_MOVED_PERMANENTLY 301
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
87 #define CYG_HTTPD_STATUS_MOVED_TEMPORARILY 302
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
88 #define CYG_HTTPD_STATUS_NOT_MODIFIED 304
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
89 #define CYG_HTTPD_STATUS_BAD_REQUEST 400
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
90 #define CYG_HTTPD_STATUS_NOT_AUTHORIZED 401
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
91 #define CYG_HTTPD_STATUS_FORBIDDEN 403
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
92 #define CYG_HTTPD_STATUS_NOT_FOUND 404
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
93 #define CYG_HTTPD_STATUS_METHOD_NOT_ALLOWED 405
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
94 #define CYG_HTTPD_STATUS_SYSTEM_ERROR 500
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
95 #define CYG_HTTPD_STATUS_NOT_IMPLEMENTED 501
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
96
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
97 #define CYG_HTTPD_MODE_CLOSE_CONN 0x0001
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
98 #define CYG_HTTPD_MODE_TRANSFER_CHUNKED 0x0002
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
99 #define CYG_HTTPD_MODE_SEND_HEADER_ONLY 0x0004
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
100 #define CYG_HTTPD_MODE_NO_CACHE 0x0008
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
101 #define CYG_HTTPD_MODE_FORM_DATA 0x0010
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
102
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
103 // This must be generated at random...
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
104 #define CYG_HTTPD_MD5_AUTH_NAME "MD5"
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
105 #define CYG_HTTPD_MD5_AUTH_QOP "auth"
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
106 #define CYG_HTTPD_MD5_AUTH_OPAQUE "0000000000000000"
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
107
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
108 #define TIME_FORMAT_RFC1123 "%a, %d %b %Y %H:%H:%S GMT"
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
109
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
110 typedef struct __socket_entry
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
111 {
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
112 cyg_int32 descriptor;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
113 time_t timestamp;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
114 } socket_entry;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
115
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
116 // =============================================================================
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
117 // Main HTTP structure.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
118 // =============================================================================
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
119 typedef struct
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
120 {
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
121 cyg_httpd_req_type method;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
122 fd_set rfds;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
123
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
124 cyg_int32 host[4];
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
125
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
126 char url[CYG_HTTPD_MAXURL+1];
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
127 char inbuffer[CYG_HTTPD_MAXINBUFFER+1];
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
128 cyg_int32 inbuffer_len, content_len;
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
129
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
130 // Packet status.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
131 //
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
132 // bit Description
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
133 // -------------------------------------------------------------------------
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
134 // 0 A 1 means that the connection will be closed after the request
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
135 // has been served (i.e. Connection: close" will appear in
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
136 // the header. Otherwise the connection will be kept alive
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
137 // "Connection: keep-alive"
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
138 // 1 Set when the transfer will be chunked
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
139 // 2 Set when the we need to send only the header
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
140 // 3 Set when the we do not want this document to be cached (i.e.
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
141 // "Cache-Control: no-cache" will appear in the header) which
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
142 // is meant for c language callbacks and GCI.
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
143 // 4 Set when the the frame we just received contains form data.
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
144 // In this case we call the function that parsed the data into
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
145 // user-defined form variables.
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
146 cyg_uint16 mode;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
147
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
148 // Ouptut data.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
149 cyg_uint16 status_code;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
150 char *mime_type;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
151 cyg_int32 payload_len;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
152 char outbuffer[CYG_HTTPD_MAXOUTBUFFER+1];
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
153
2485
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
154 socket_entry sockets[CYGPKG_NET_MAXSOCKETS];
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
155 cyg_int32 fdmax;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
156
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
157 // Socket handle.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
158 cyg_int32 client_index;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
159
2485
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
160 // Modified-since is always reset to -1 before parsing the headers of a
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
161 // request. If the "Modified-Since" element is present in the header then
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
162 // we'll copy the value in this variable, otherwise it will remain to -1.
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
163 // This will tell us if we can send a CYG_HTTPD_STATUS_NOT_MODIFIED back to
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
164 // the client or instead we'll have to send the whole page again.
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
165 time_t modified_since;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
166 time_t last_modified;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
167
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
168 #ifdef CYGOPT_NET_ATHTTPD_USE_CGIBIN_TCL
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
169 Jim_Interp *jim_interp;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
170 #endif
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
171
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
172 // Pointer to the data immediately following the last byte of the header.
2485
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
173 // In a POST request, this is where the goods are. After the post request
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
174 // is handles it will point to the start of the new request, if any.
0e9d1d1df4a0 * src/jim-aio.c (JimAioHandlerCommand): GCC 4.3.1 pointed out a
asl
parents: 2326
diff changeset
175 char *request_end;
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
176
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
177 // This pointer points to the buffer where we collected all the post
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
178 // data (it might come in more than one frame) and must be visible to
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
179 // handlers and cgi scripts.
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
180 char *post_data;
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
181
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
182 // This pointer points to the information about the domain that needs
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
183 // to be authenticated. It is only used by the function that builds the
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
184 // header.
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
185 cyg_httpd_auth_table_entry *needs_auth;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
186
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
187 struct sockaddr_in server_conn;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
188 struct sockaddr_in client_conn;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
189 } CYG_HTTPD_STATE;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
190
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
191 extern CYG_HTTPD_STATE httpstate;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
192
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
193 extern const char *day_of_week[];
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
194 extern const char *month_of_year[];
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
195
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
196 struct cyg_httpd_mime_table_entry
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
197 {
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
198 char *extension;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
199 char *mime_string;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
200 } CYG_HAL_TABLE_TYPE;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
201
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
202 typedef struct cyg_httpd_mime_table_entry cyg_httpd_mime_table_entry;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
203
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
204 #define CYG_HTTPD_MIME_TABLE_ENTRY(__name, __pattern, __arg) \
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
205 cyg_httpd_mime_table_entry __name CYG_HAL_TABLE_ENTRY(httpd_mime_table) = \
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
206 { __pattern, __arg }
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
207
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
208 extern cyg_int32 debug_print;
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
209
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
210 void cyg_httpd_set_home_page(cyg_int8*);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
211 char* cyg_httpd_find_mime_string(char*);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
212 cyg_int32 cyg_httpd_initialize(void);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
213 void cyg_httpd_cleanup_filename(char*);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
214 char* cyg_httpd_parse_GET(char*);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
215 char* cyg_httpd_parse_POST(char*);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
216 void cyg_httpd_handle_method_GET(void);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
217 void cyg_httpd_handle_method_HEAD(void);
2326
bd648d8929f6 * cdl/httpd.cdl: Improve CDL dependencies.
jlarmour
parents: 2250
diff changeset
218 void cyg_httpd_process_method(void);
2250
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
219 void cyg_httpd_send_file(char*);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
220 void cyg_httpd_send_error(cyg_int32);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
221 cyg_int32 cyg_httpd_format_header(void);
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
222
0830ae6acddc Add ATHTTPD server from Anthony Tonizzo.
jlarmour
parents:
diff changeset
223 #endif