root/trunk/gsdl/src/w32server/httpreq.h @ 3811

Revision 3811, 3.8 KB (checked in by sjboddie, 17 years ago)

Removed a couple of unused variables

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1/**********************************************************************
2 *
3 * httpreq.h
4 * Copyright (C) 1996
5 *
6 * A component of the fnord webserver written by bmorin@wpi.edu.
7 *
8 * Altered for use with the Greenstone digital library software by the
9 * New Zealand Digital Library Project at the University of Waikato,
10 * New Zealand.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 *********************************************************************/
27
28#ifndef HTTPREQ_H
29#define HTTPREQ_H
30
31// need this to avoid bizarre compiler problems under VC++ 6.0
32#if !defined (GSDL_NAMESPACE_BROKEN) && !defined (GSDL_USE_IOS_H)
33# include <iostream>
34# include <fstream>
35using namespace std;
36#endif
37
38#include "locate.h"
39#include "text_t.h"
40
41/*
42Module Name: HTTP Request
43Purpose: Parses HTTP requests and then calls the appropriate function
44    to respond to the request
45Public Functions:
46    Request Thread
47*/
48
49// Public Data Structures
50
51//Used for sending information to the request thread
52struct RequestThreadMessageT {
53  SOCKADDR_IN ClientSockAddr;
54  SOCKET ClientSocket;
55  int AddrLen;
56};
57
58#define MAX_OTHER_HEADERS 100
59
60struct RequestHeaderT {
61  text_t Var;
62  text_t Val;
63};
64
65struct RequestFieldsT {
66  //Simple request line info v0.9
67  text_t MethodStr;
68  text_t URIStr;
69  //added v1.0
70  text_t VersionStr;
71  //General Header
72  text_t DateStr;
73  text_t MIMEVerStr;
74  text_t PragmaStr;
75  //Request Header
76  text_t AuthorizationStr;
77  text_t FromStr;
78  text_t IfModSinceStr;
79  text_t RefererStr;
80  text_t UserAgentStr;
81  //Entity Header (Only CGI stuff)
82  text_t ContentEncodingStr;
83  text_t ContentTypeStr;
84  text_t ContentLengthStr;
85  //v1.0 Optional (the more common ones)
86  text_t AcceptStr;
87  text_t AcceptLangStr;
88  //v1.1 Exentions
89  text_t ConnectionStr;
90  //Pointer to buffer containing the content
91  DWORD ContentLength;
92  BYTE *Content;
93 
94  //Other Headers
95  int NumOtherHeaders;
96  RequestHeaderT OtherHeaders[MAX_OTHER_HEADERS];
97};
98
99struct RequestInfoT {
100  int ThreadNum;
101 
102  //Buffer for IO operations (so we're not constantly reallocating buffers)
103  BYTE *IOBuffer;
104  int IOBufferSize;
105 
106  //Socket the request is on and its address
107  SOCKET ClientSocket;
108  SOCKADDR_IN ClientSockAddr;
109  int AddrLen;
110 
111  //Should we keep the connection alive?
112  BOOL KeepAlive;
113};
114
115
116// Public Functions
117
118/*
119Function Name: RequestThread
120Purpose: Was the HTTP request processing thread
121         Now just a standard procedure called to process a request
122Parameters:
123           Pointer to packed parameter structure
124*/
125void RequestThread(RequestThreadMessageT *Parameters);
126
127/*
128Function Name: Process 1.0 Request
129Purpose: Sends a HTTP 1.0 (plus some) reply to a HTTP 1.x request
130Parameters:
131    ClientSocket - Socket the client is on
132    ClientSockAddr - Address of client
133    AddrLen - Length of client address
134    RequestInfo - Structure storing the parsed headers
135    KeepAlive - To be set to true if we are maintainig the connection
136    IOBuffer - Pointer to buffer allocated for IO operations
137    TheadNum - Number of calling thread for debugging
138Notes: The function uses "Connection: Keep-Alive" as written in the HTTP/1.1
139    draft and implemented by Netscape and MSIE
140*/
141void Process10Request(RequestInfoT &RequestInfo, RequestFieldsT &RequestFields);
142
143#endif
Note: See TracBrowser for help on using the browser.