source: trunk/gsdl/src/w32server/httpreq.h@ 1293

Last change on this file since 1293 was 611, checked in by sjboddie, 25 years ago

initial commit of windows server code

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1#ifndef HTTPREQ_H
2#define HTTPREQ_H
3
4/*
5Copyright (C) 1996
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21The author can be contacted via Email at [email protected]
22*/
23
24/*
25Module Name: HTTP Reqeust
26Purpose: Parses HTTP requests and then calls the appropriate function
27 to respond to the request
28Public Functions:
29 Request Thread
30*/
31
32// Public Data Structures
33
34//Used for sending information to the request thread
35struct RequestThreadMessageT {
36 SOCKADDR_IN ClientSockAddr;
37 SOCKET ClientSocket;
38 int AddrLen;
39 };
40
41//Length constants for RequestFieldsT
42#define ReqMethodStrLen 24
43#define ReqURIStrLen 255
44#define ReqVersionStrLen 24
45#define ReqDateStrLen 48
46#define ReqMIMEVerStrLen 24
47#define ReqPragmaStrLen 128
48#define ReqAuthorizationStrLen 512
49#define ReqFromStrLen 128
50#define ReqIfModSinceStrLen 48
51#define ReqRefererStrLen 512
52#define ReqUserAgentStrLen 256
53#define ReqContentEncodingStrLen 128
54#define ReqContentTypeStrLen 128
55#define ReqContentLengthStrLen 48
56#define ReqAcceptStrLen 256
57#define ReqAcceptLangStrLen 48
58#define ReqConnectionStrLen 24
59#define ReqAuthorizedUserStrLen 48
60#define ReqPathInfoStrLen 512
61#define ReqPathTranslatedStrLen 512
62#define ReqScriptNameStrLen 512
63// ---
64// 4436
65
66#define MAX_OTHER_HEADERS 100
67
68struct RequestHeaderT {
69 char *Var;
70 char *Val;
71 };
72
73struct RequestFieldsT {
74 //Simple request line info v0.9
75 char MethodStr[ReqMethodStrLen];
76 char URIStr[ReqURIStrLen];
77 //added v1.0
78 char VersionStr[ReqVersionStrLen];
79 //General Header
80 char DateStr[ReqDateStrLen];
81 char MIMEVerStr[ReqMIMEVerStrLen];
82 char PragmaStr[ReqPragmaStrLen];
83 //Request Header
84 char AuthorizationStr[ReqAuthorizationStrLen];
85 char FromStr[ReqFromStrLen];
86 char IfModSinceStr[ReqIfModSinceStrLen];
87 char RefererStr[ReqRefererStrLen];
88 char UserAgentStr[ReqUserAgentStrLen];
89 //Entity Header (Only CGI stuff)
90 char ContentEncodingStr[ReqContentEncodingStrLen];
91 char ContentTypeStr[ReqContentTypeStrLen];
92 char ContentLengthStr[ReqContentLengthStrLen];
93 //v1.0 Optional (the more common ones)
94 char AcceptStr[ReqAcceptStrLen];
95 char AcceptLangStr[ReqAcceptLangStrLen];
96 //v1.1 Exentions
97 char ConnectionStr[ReqConnectionStrLen];
98 //Pointer to buffer containing the content
99 DWORD ContentLength;
100 BYTE *Content;
101
102 //Authorized user, filled in if a user is authorized from Auth..Str above
103 char AuthorizedUserStr[ReqAuthorizedUserStrLen];
104
105 //CGI style fields
106 char PathInfoStr[ReqPathInfoStrLen];
107 char PathTranslatedStr[ReqPathTranslatedStrLen];
108 char ScriptNameStr[ReqScriptNameStrLen];
109
110 //Other Headers
111 int NumOtherHeaders;
112 RequestHeaderT OtherHeaders[MAX_OTHER_HEADERS];
113 };
114
115struct RequestInfoT {
116 int ThreadNum;
117
118 //Buffer for IO operations (so we're not constantly reallocating buffers)
119 BYTE *IOBuffer;
120 int IOBufferSize;
121
122 //Socket the request is on and its address
123 SOCKET ClientSocket;
124 SOCKADDR_IN ClientSockAddr;
125 int AddrLen;
126
127 //Should we keep the connection alive?
128 BOOL KeepAlive;
129 };
130
131
132// Public Functions
133
134/*
135Function Name: RequestThread
136Purpose: Was the HTTP request processing thread
137 Now just a standard procedure called to process a request
138Parameters:
139 Pointer to packed parameter structure
140*/
141void RequestThread(RequestThreadMessageT *Parameters);
142
143/*
144Function Name: Process 1.0 Request
145Purpose: Sends a HTTP 1.0 (plus some) reply to a HTTP 1.x request
146Parameters:
147 ClientSocket - Socket the client is on
148 ClientSockAddr - Address of client
149 AddrLen - Length of client address
150 RequestInfo - Structure storing the parsed headers
151 KeepAlive - To be set to true if we are maintainig the connection
152 IOBuffer - Pointer to buffer allocated for IO operations
153 TheadNum - Number of calling thread for debugging
154Notes: The function uses "Connection: Keep-Alive" as written in the HTTP/1.1
155 draft and implemented by Netscape and MSIE
156*/
157void Process10Request(RequestInfoT &RequestInfo, RequestFieldsT &RequestFields);
158
159#endif
Note: See TracBrowser for help on using the repository browser.