home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / WEBSERVE / PI3 / PI3WEB.EXE / DEVEL / INCLUDE / HTTPDefs.h < prev    next >
C/C++ Source or Header  |  1997-10-30  |  7KB  |  205 lines

  1. /*____________________________________________________________________________*\
  2.  *
  3.  
  4.  Copyright (c) 1997 John Roy. All rights reserved.
  5.  
  6.  These sources, libraries and applications are
  7.  FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
  8.  as long as the following conditions are adhered to.
  9.  
  10.  Redistribution and use in source and binary forms, with or without
  11.  modification, are permitted provided that the following conditions
  12.  are met:
  13.  
  14.  1. Redistributions of source code must retain the above copyright
  15.     notice, this list of conditions and the following disclaimer. 
  16.  
  17.  2. Redistributions in binary form must reproduce the above copyright
  18.     notice, this list of conditions and the following disclaimer in
  19.     the documentation and/or other materials provided with the
  20.     distribution.
  21.  
  22.  3. Redistributions of any form whatsoever and all advertising materials 
  23.     mentioning features must contain the following
  24.     acknowledgment:
  25.     "This product includes software developed by John Roy
  26.     (http://www.johnroy.com/pi3/)."
  27.  
  28.  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  29.  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30.  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  31.  IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  32.  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33.  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34.  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35.  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36.  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37.  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  38.  OF THE POSSIBILITY OF SUCH DAMAGE.
  39.  
  40.  *____________________________________________________________________________*|
  41.  *
  42.  * $Source: HTTPDefs.h$
  43.  * $Date: Sun Aug 10 06:36:31 1997$
  44.  *
  45.  Description:
  46. \*____________________________________________________________________________*/
  47. /* $SourceTop:$ */
  48.  
  49. #ifndef HTTPDEFS_H_
  50. #define HTTPDEFS_H_
  51.  
  52. /*____________________________________________________________________________*\
  53.  *
  54.  Description:
  55. \*____________________________________________________________________________*/
  56. #define KEY_CONF_DOCUMENTROOT        "DocumentRoot"
  57. #define KEY_CONF_MIMEFILE            "MIMEFile"
  58. #define KEY_CONF_ADDMIMEENTRY        "AddMIMEEntry"
  59.  
  60. /* --- HTTP headers (incoming), sent in rfc822 pairs --- */
  61. #define KEY_HTTP_STATUS                "Status"
  62. #define KEY_HTTP_IFMODIFIEDSINCE    "If-Modified-Since"
  63. #define KEY_HTTP_CONNECTION            "Connection"
  64. #define KEY_HTTP_URI                "URI"
  65.  
  66. /* --- HTTP incoming compoents, not sent in rfc822 pairs --- */
  67. #define KEY_HTTP_CLF                "CLF"            
  68. #define KEY_HTTP_METHOD                "Method"
  69. #define KEY_HTTP_PROTOCOL            "Protocol"
  70. #define KEY_HTTP_QUERYSTRING        "QueryString"
  71. #define KEY_HTTP_PROXYPROTOCOL        "ProxyProtocol"
  72. #define KEY_HTTP_PROXYHOST            "ProxyHost"
  73. #define KEY_HTTP_PROXYPORT            "ProxyPort"
  74.  
  75. /* --- outgoing --- */
  76. #define KEY_HTTP_CONTENTTYPE        "Content-Type"
  77. #define KEY_HTTP_CONTENTLENGTH        "Content-Length"
  78. #define KEY_HTTP_CONTENTENCODING    "Content-Encoding"
  79. #define KEY_HTTP_SERVER                "Server"
  80. #define KEY_HTTP_DATE                "Date"
  81. #define KEY_HTTP_LASTMODIFIED        "Last-Modified"
  82. #define KEY_HTTP_LOCATION            "Location"
  83. #define KEY_HTTP_HOST                "Host"
  84. #define KEY_HTTP_PRAGMA                "Pragma"
  85. #define KEY_HTTP_EXPIRES            "Expires"
  86. #define KEY_HTTP_WWW_AUTHENTICATE    "WWW-Authenticate"
  87. #define KEY_HTTP_AUTHORIZATION        "Authorization"
  88.  
  89. /* --- HTTP & SSL stuff --- */
  90. #define KEY_HTTPS_KEYSIZE            "KeySize"
  91. #define KEY_HTTPS_SECRETKEYSIZE        "SecretKeySize"
  92.  
  93. /* --- misc --- */
  94. #define HTTP_DIRSEPERATOR            '/'
  95. #define HTTP_DEFAULT_PORT            (80)
  96.  
  97. /* --- keys to data structures and internal values --- */
  98. #define KEY_DS_FILEINFO                "FileInfo"
  99. #define KEY_DS_FILEMAP                "FileMap"
  100. #define KEY_INT_PATH                "Path"
  101. #define KEY_INT_OLDPATH                "OldPath"
  102. #define KEY_INT_PATHINFO            "PathInfo"
  103. #define KEY_INT_AUTHTYPE            "AuthType"
  104. #define KEY_INT_AUTHPASS            "AuthPass"
  105. #define KEY_INT_REMOTEADDR            "RemoteAddr"
  106. #define KEY_INT_REMOTEHOST            "RemoteHost"
  107. #define KEY_INT_REMOTEIDENT            "RemoteIdent"
  108. #define KEY_INT_REMOTEUSER            "RemoteUser"
  109. #define KEY_INT_LOCALADDR            "LocalAddr"
  110. #define KEY_INT_SERVERPORT            "ServerPort"
  111. #define KEY_INT_HOSTNAME            "HostName"
  112. #define KEY_INT_KEEPOPEN            "KeepOpen"
  113. #define KEY_INT_OBJECTNAME            "ObjectName"
  114. #define KEY_INT_OBJECTMAP            "ObjectMap"
  115. #define KEY_INT_TEMPORARYFILE        "TemporaryFile"
  116. #define KEY_INT_DEBUGGING            "Debugging"
  117. #define KEY_INT_PATHTRANSLATED        "PathTranslated"
  118. #define KEY_INT_SCRIPTNAME            "ScriptName"
  119. #define KEY_INT_ERRORMESSAGE        "ErrorMessage"
  120. #define KEY_INT_AUTHENTICATIONREALM    "AuthenticationRealm"
  121. #define KEY_INT_RECVTIMEOUT            "RecvTimeout"
  122.  
  123. /* --- really internal values specific internal operation and profiling --- */
  124. #define KEY_INT_SECONDS                "Seconds"
  125. #define KEY_INT_MICROSECONDS        "MicroSeconds"
  126. #define KEY_INT_BYTESSENT            "BytesSent"
  127.  
  128. #define HTTP_LF                        (10)
  129. #define HTTP_CR                        (13)
  130. #define HTTP_CRLF                    "\r\n"
  131.  
  132. /* ---
  133.     Phases in request/response cycle
  134. --- */
  135. #define PH_INVALID                    (-1)
  136. #define PH_INIT                        0
  137. #define PH_HEADERS                    1
  138. #define PH_HOSTMAP                    2
  139. #define PH_MAPPING                    3
  140. #define PH_CHECKPATH                4
  141. #define PH_CHECKAUTH                5
  142. #define PH_CHECKACCESS                6
  143. #define PH_CHECKTYPE                7
  144. #define    PH_HANDLE                    8
  145. #define PH_LOG                        9
  146. #define PH_DESTROY                    10    
  147. #define PH_NUMBER                    11
  148.  
  149. /* ---
  150.     HTTP Status codes
  151. --- */
  152. #define ST_OK                        200
  153. #define ST_PERMANENTREDIRECT        301
  154. #define ST_NOTMODIFIED                304
  155. #define ST_BADREQUEST                400
  156. #define ST_UNAUTHORIZED                401
  157. #define ST_FORBIDDEN                403
  158. #define ST_NOTFOUND                    404
  159. #define ST_INTERNALERROR            500
  160. #define ST_NOTIMPLEMENTED            501
  161.  
  162. /* --- 
  163.     Return codes
  164. --- */
  165. #define INT_CONTINUE                0
  166. #define INT_REDIRECT                1
  167.     
  168. /* ---
  169.     HTTP Methods
  170. --- */
  171. #define MD_NAME_GET                    "GET"
  172. #define MD_NAME_POST                "POST"
  173. #define MD_NAME_HEAD                "HEAD"
  174. #define MD_UNKNOWN                    0    
  175. #define MD_GET                        1
  176. #define MD_POST                        2
  177. #define MD_HEAD                        3
  178.  
  179. /* ---
  180.     HTTP Protocols
  181. --- */
  182. #define PR_NAME_HTTP09                "HTTP/0.9"
  183. #define PR_NAME_HTTP10                "HTTP/1.0"
  184. #define PR_NAME_HTTP11                "HTTP/1.1"
  185. #define PR_NAME_UNKNOWN                "Unknown"
  186. #define PR_UNKNOWN                    0
  187. #define PR_HTTP09                    1
  188. #define PR_HTTP10                    2
  189. #define PR_HTTP11                    3
  190.  
  191. /* ---
  192. Content-Types
  193. --- */
  194. #define TYPE_MAGIC_DIRECTORY        "internal/x-directory"
  195. #define TYPE_MAGIC_CGI                "internal/x-cgi"
  196. #define TYPE_MAGIC_SSI                "internal/x-server-parsed-html"
  197.  
  198. /* ---
  199. Defaults
  200. --- */
  201. #define HTTP_DEFAULT_MIME_TYPE        "application/octet-stream"
  202.  
  203. #endif /* HTTPDEFS_H_ */
  204.  
  205.