2 * HTTP Server API definitions
4 * Copyright (C) 2009 Andrey Turkin
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 typedef struct _HTTPAPI_VERSION
33 USHORT HttpApiMajorVersion
;
34 USHORT HttpApiMinorVersion
;
35 } HTTPAPI_VERSION
, *PHTTPAPI_VERSION
;
37 #define HTTPAPI_VERSION_1 {1,0}
38 #define HTTPAPI_VERSION_2 {2,0}
40 #define HTTP_INITIALIZE_SERVER 0x00000001
41 #define HTTP_INITIALIZE_CONFIG 0x00000002
43 #define HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY 0x00000001
44 #define HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY 0x00000002
46 #define HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS 0x00000001
47 #define HTTP_REQUEST_FLAG_IP_ROUTED 0x00000002
48 #define HTTP_REQUEST_FLAG_HTTP2 0x00000004
50 #define HTTP_SEND_RESPONSE_FLAG_DISCONNECT 0x00000001
51 #define HTTP_SEND_RESPONSE_FLAG_MORE_DATA 0x00000002
52 #define HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 0x00000004
53 #define HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING 0x00000008
54 #define HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES 0x00000020
55 #define HTTP_SEND_RESPONSE_FLAG_OPAQUE 0x00000040
57 #define HTTP_URL_FLAG_REMOVE_ALL 0x0000001
59 typedef enum _HTTP_SERVICE_CONFIG_ID
61 HttpServiceConfigIPListenList
,
62 HttpServiceConfigSSLCertInfo
,
63 HttpServiceConfigUrlAclInfo
,
64 HttpServiceConfigTimeout
,
66 } HTTP_SERVICE_CONFIG_ID
, *PHTTP_SERVICE_CONFIG_ID
;
68 #define HTTP_NULL_ID ((ULONGLONG)0)
70 typedef ULONGLONG HTTP_OPAQUE_ID
, *PHTTP_OPAQUE_ID
;
71 typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID
, *PHTTP_CONNECTION_ID
;
72 typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID
, *PHTTP_RAW_CONNECTION_ID
;
73 typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID
, *PHTTP_REQUEST_ID
;
74 typedef HTTP_OPAQUE_ID HTTP_SERVER_SESSION_ID
, *PHTTP_SERVER_SESSION_ID
;
75 typedef HTTP_OPAQUE_ID HTTP_URL_GROUP_ID
, *PHTTP_URL_GROUP_ID
;
76 typedef ULONGLONG HTTP_URL_CONTEXT
;
78 typedef struct _HTTP_VERSION
82 } HTTP_VERSION
, *PHTTP_VERSION
;
84 typedef enum _HTTP_VERB
107 } HTTP_VERB
, *PHTTP_VERB
;
109 typedef struct _HTTP_COOKED_URL
111 USHORT FullUrlLength
;
113 USHORT AbsPathLength
;
114 USHORT QueryStringLength
;
115 const WCHAR
*pFullUrl
;
117 const WCHAR
*pAbsPath
;
118 const WCHAR
*pQueryString
;
119 } HTTP_COOKED_URL
, *PHTTP_COOKED_URL
;
121 typedef struct _HTTP_TRANSPORT_ADDRESS
123 SOCKADDR
*pRemoteAddress
;
124 SOCKADDR
*pLocalAddress
;
125 } HTTP_TRANSPORT_ADDRESS
, *PHTTP_TRANSPORT_ADDRESS
;
127 typedef struct _HTTP_UNKNOWN_HEADER
130 USHORT RawValueLength
;
132 const char *pRawValue
;
133 } HTTP_UNKNOWN_HEADER
, *PHTTP_UNKNOWN_HEADER
;
135 typedef struct _HTTP_KNOWN_HEADER
137 USHORT RawValueLength
;
138 const char *pRawValue
;
139 } HTTP_KNOWN_HEADER
, *PHTTP_KNOWN_HEADER
;
141 typedef enum _HTTP_HEADER_ID
143 HttpHeaderCacheControl
= 0,
144 HttpHeaderConnection
= 1,
146 HttpHeaderKeepAlive
= 3,
147 HttpHeaderPragma
= 4,
148 HttpHeaderTrailer
= 5,
149 HttpHeaderTransferEncoding
= 6,
150 HttpHeaderUpgrade
= 7,
152 HttpHeaderWarning
= 9,
153 HttpHeaderAllow
= 10,
154 HttpHeaderContentLength
= 11,
155 HttpHeaderContentType
= 12,
156 HttpHeaderContentEncoding
= 13,
157 HttpHeaderContentLanguage
= 14,
158 HttpHeaderContentLocation
= 15,
159 HttpHeaderContentMd5
= 16,
160 HttpHeaderContentRange
= 17,
161 HttpHeaderExpires
= 18,
162 HttpHeaderLastModified
= 19,
164 HttpHeaderAccept
= 20,
165 HttpHeaderAcceptCharset
= 21,
166 HttpHeaderAcceptEncoding
= 22,
167 HttpHeaderAcceptLanguage
= 23,
168 HttpHeaderAuthorization
= 24,
169 HttpHeaderCookie
= 25,
170 HttpHeaderExpect
= 26,
173 HttpHeaderIfMatch
= 29,
174 HttpHeaderIfModifiedSince
= 30,
175 HttpHeaderIfNoneMatch
= 31,
176 HttpHeaderIfRange
= 32,
177 HttpHeaderIfUnmodifiedSince
= 33,
178 HttpHeaderMaxForwards
= 34,
179 HttpHeaderProxyAuthorization
= 35,
180 HttpHeaderReferer
= 36,
181 HttpHeaderRange
= 37,
183 HttpHeaderTranslate
= 39,
184 HttpHeaderUserAgent
= 40,
185 HttpHeaderRequestMaximum
= 41,
187 HttpHeaderAcceptRanges
= 20,
190 HttpHeaderLocation
= 23,
191 HttpHeaderProxyAuthenticate
= 24,
192 HttpHeaderRetryAfter
= 25,
193 HttpHeaderServer
= 26,
194 HttpHeaderSetCookie
= 27,
196 HttpHeaderWwwAuthenticate
= 29,
197 HttpHeaderResponseMaximum
= 30,
199 HttpHeaderMaximum
= 41,
200 } HTTP_HEADER_ID
, *PHTTP_HEADER_ID
;
202 typedef struct _HTTP_REQUEST_HEADERS
204 USHORT UnknownHeaderCount
;
205 HTTP_UNKNOWN_HEADER
*pUnknownHeaders
;
207 HTTP_UNKNOWN_HEADER
*pTrailers
;
208 HTTP_KNOWN_HEADER KnownHeaders
[HttpHeaderRequestMaximum
];
209 } HTTP_REQUEST_HEADERS
, *PHTTP_REQUEST_HEADERS
;
211 typedef enum _HTTP_DATA_CHUNK_TYPE
213 HttpDataChunkFromMemory
= 0,
214 HttpDataChunkFromFileHandle
,
215 HttpDataChunkFromFragmentCache
,
216 HttpDataChunkFromFragmentCacheEx
,
217 HttpDataChunkMaximum
,
218 } HTTP_DATA_CHUNK_TYPE
, *PHTTP_DATA_CHUNK_TYPE
;
220 #define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1)
222 typedef struct _HTTP_BYTE_RANGE
224 ULARGE_INTEGER StartingOffset
;
225 ULARGE_INTEGER Length
;
226 } HTTP_BYTE_RANGE
, *PHTTP_BYTE_RANGE
;
228 typedef struct _HTTP_DATA_CHUNK
230 HTTP_DATA_CHUNK_TYPE DataChunkType
;
240 HTTP_BYTE_RANGE ByteRange
;
245 USHORT FragmentNameLength
;
246 const WCHAR
*pFragmentName
;
249 } HTTP_DATA_CHUNK
, *PHTTP_DATA_CHUNK
;
251 typedef struct _HTTP_SSL_CLIENT_CERT_INFO
254 ULONG CertEncodedSize
;
257 BOOLEAN CertDeniedByMapper
;
258 } HTTP_SSL_CLIENT_CERT_INFO
, *PHTTP_SSL_CLIENT_CERT_INFO
;
260 typedef struct _HTTP_SSL_INFO
262 USHORT ServerCertKeySize
;
263 USHORT ConnectionKeySize
;
264 ULONG ServerCertIssuerSize
;
265 ULONG ServerCertSubjectSize
;
266 const char *pServerCertIssuer
;
267 const char *pServerCertSubject
;
268 HTTP_SSL_CLIENT_CERT_INFO
*pClientCertInfo
;
269 ULONG SslClientCertNegotiated
;
270 } HTTP_SSL_INFO
, *PHTTP_SSL_INFO
;
272 typedef struct _HTTP_REQUEST_V1
275 HTTP_CONNECTION_ID ConnectionId
;
276 HTTP_REQUEST_ID RequestId
;
277 HTTP_URL_CONTEXT UrlContext
;
278 HTTP_VERSION Version
;
280 USHORT UnknownVerbLength
;
282 const char *pUnknownVerb
;
284 HTTP_COOKED_URL CookedUrl
;
285 HTTP_TRANSPORT_ADDRESS Address
;
286 HTTP_REQUEST_HEADERS Headers
;
287 ULONGLONG BytesReceived
;
288 USHORT EntityChunkCount
;
289 HTTP_DATA_CHUNK
*pEntityChunks
;
290 HTTP_RAW_CONNECTION_ID RawConnectionId
;
291 HTTP_SSL_INFO
*pSslInfo
;
294 typedef enum _HTTP_REQUEST_INFO_TYPE
296 HttpRequestInfoTypeAuth
= 0,
297 } HTTP_REQUEST_INFO_TYPE
, *PHTTP_REQUEST_INFO_TYPE
;
299 typedef struct _HTTP_REQUEST_INFO
301 HTTP_REQUEST_INFO_TYPE InfoType
;
304 } HTTP_REQUEST_INFO
, *PHTTP_REQUEST_INFO
;
307 typedef struct _HTTP_REQUEST_V2
: HTTP_REQUEST_V1
309 USHORT RequestInfoCount
;
310 HTTP_REQUEST_INFO
*pRequestInfo
;
311 } HTTP_REQUEST_V2
, *PHTTP_REQUEST_V2
;
313 typedef struct _HTTP_REQUEST_V2
316 USHORT RequestInfoCount
;
317 HTTP_REQUEST_INFO
*pRequestInfo
;
318 } HTTP_REQUEST_V2
, *PHTTP_REQUEST_V2
;
321 typedef HTTP_REQUEST_V2 HTTP_REQUEST
, *PHTTP_REQUEST
;
323 typedef struct _HTTP_RESPONSE_HEADERS
325 USHORT UnknownHeaderCount
;
326 HTTP_UNKNOWN_HEADER
*pUnknownHeaders
;
328 HTTP_UNKNOWN_HEADER
*pTrailers
;
329 HTTP_KNOWN_HEADER KnownHeaders
[HttpHeaderResponseMaximum
];
330 } HTTP_RESPONSE_HEADERS
,*PHTTP_RESPONSE_HEADERS
;
332 typedef struct _HTTP_RESPONSE_V1
335 HTTP_VERSION Version
;
339 HTTP_RESPONSE_HEADERS Headers
;
340 USHORT EntityChunkCount
;
341 HTTP_DATA_CHUNK
*pEntityChunks
;
342 } HTTP_RESPONSE_V1
, *PHTTP_RESPONSE_V1
;
344 typedef enum _HTTP_RESPONSE_INFO_TYPE
346 HttpResponseInfoTypeMultipleKnownHeaders
= 0,
347 HttpResponseInfoTypeAuthenticationProperty
,
348 HttpResponseInfoTypeQosProperty
,
349 HttpResponseInfoTypeChannelBind
,
350 } HTTP_RESPONSE_INFO_TYPE
, *PHTTP_RESPONSE_INFO_TYPE
;
352 typedef struct _HTTP_RESPONSE_INFO
354 HTTP_RESPONSE_INFO_TYPE Type
;
357 } HTTP_RESPONSE_INFO
, *PHTTP_RESPONSE_INFO
;
360 typedef struct _HTTP_RESPONSE_V2
: HTTP_RESPONSE_V1
362 USHORT ResponseInfoCount
;
363 HTTP_RESPONSE_INFO
*pResponseInfo
;
364 } HTTP_RESPONSE_V2
, *PHTTP_RESPONSE_V2
;
366 typedef struct _HTTP_RESPONSE_V2
369 USHORT ResponseInfoCount
;
370 HTTP_RESPONSE_INFO
*pResponseInfo
;
371 } HTTP_RESPONSE_V2
, *PHTTP_RESPONSE_V2
;
374 typedef HTTP_RESPONSE_V2 HTTP_RESPONSE
, *PHTTP_RESPONSE
;
376 typedef enum _HTTP_CACHE_POLICY_TYPE
378 HttpCachePolicyNocache
,
379 HttpCachePolicyUserInvalidates
,
380 HttpCachePolicyTimeToLive
,
381 HttpCachePolicyMaximum
,
382 } HTTP_CACHE_POLICY_TYPE
, *PHTTP_CACHE_POLICY_TYPE
;
384 typedef struct _HTTP_CACHE_POLICY
386 HTTP_CACHE_POLICY_TYPE Policy
;
388 } HTTP_CACHE_POLICY
, *PHTTP_CACHE_POLICY
;
390 typedef enum _HTTP_LOG_DATA_TYPE
392 HttpLogDataTypeFields
= 0,
393 } HTTP_LOG_DATA_TYPE
, *PHTTP_LOG_DATA_TYPE
;
395 typedef struct _HTTP_LOG_DATA
397 HTTP_LOG_DATA_TYPE Type
;
398 } HTTP_LOG_DATA
, *PHTTP_LOG_DATA
;
400 ULONG WINAPI
HttpAddUrl(HANDLE
,PCWSTR
,PVOID
);
401 ULONG WINAPI
HttpCloseServerSession(HTTP_SERVER_SESSION_ID id
);
402 ULONG WINAPI
HttpCloseUrlGroup(HTTP_URL_GROUP_ID id
);
403 ULONG WINAPI
HttpCreateHttpHandle(PHANDLE
,ULONG
);
404 ULONG WINAPI
HttpCreateServerSession(HTTPAPI_VERSION
,PHTTP_SERVER_SESSION_ID
,ULONG
);
405 ULONG WINAPI
HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id
, HTTP_URL_GROUP_ID
*group_id
, ULONG reserved
);
406 ULONG WINAPI
HttpDeleteServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,LPOVERLAPPED
);
407 ULONG WINAPI
HttpInitialize(HTTPAPI_VERSION version
, ULONG flags
, void *reserved
);
408 ULONG WINAPI
HttpTerminate(ULONG flags
, void *reserved
);
409 ULONG WINAPI
HttpQueryServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,PVOID
,ULONG
,PULONG
,LPOVERLAPPED
);
410 ULONG WINAPI
HttpReceiveHttpRequest(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, HTTP_REQUEST
*request
, ULONG size
, ULONG
*ret_size
, OVERLAPPED
*ovl
);
411 ULONG WINAPI
HttpRemoveUrl(HANDLE queue
, const WCHAR
*url
);
412 ULONG WINAPI
HttpSendHttpResponse(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, HTTP_RESPONSE
*response
, HTTP_CACHE_POLICY
*cache_policy
, ULONG
*ret_size
, void *reserved1
, ULONG reserved2
, OVERLAPPED
*ovl
, HTTP_LOG_DATA
*log_data
);
413 ULONG WINAPI
HttpSetServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,LPOVERLAPPED
);
419 #endif /* __WINE_HTTP_H */