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_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING 0x00000001
41 #define HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER 0x00000002
43 #define HTTP_INITIALIZE_SERVER 0x00000001
44 #define HTTP_INITIALIZE_CONFIG 0x00000002
46 #define HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY 0x00000001
47 #define HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY 0x00000002
49 #define HTTP_RECEIVE_REQUEST_ENTITY_BODY_FLAG_FILL_BUFFER 0x00000001
51 #define HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS 0x00000001
52 #define HTTP_REQUEST_FLAG_IP_ROUTED 0x00000002
53 #define HTTP_REQUEST_FLAG_HTTP2 0x00000004
55 #define HTTP_SEND_RESPONSE_FLAG_DISCONNECT 0x00000001
56 #define HTTP_SEND_RESPONSE_FLAG_MORE_DATA 0x00000002
57 #define HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 0x00000004
58 #define HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING 0x00000008
59 #define HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES 0x00000020
60 #define HTTP_SEND_RESPONSE_FLAG_OPAQUE 0x00000040
62 #define HTTP_URL_FLAG_REMOVE_ALL 0x0000001
64 typedef enum _HTTP_SERVICE_CONFIG_ID
66 HttpServiceConfigIPListenList
,
67 HttpServiceConfigSSLCertInfo
,
68 HttpServiceConfigUrlAclInfo
,
69 HttpServiceConfigTimeout
,
71 } HTTP_SERVICE_CONFIG_ID
, *PHTTP_SERVICE_CONFIG_ID
;
73 #define HTTP_NULL_ID ((ULONGLONG)0)
75 typedef ULONGLONG HTTP_OPAQUE_ID
, *PHTTP_OPAQUE_ID
;
76 typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID
, *PHTTP_CONNECTION_ID
;
77 typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID
, *PHTTP_RAW_CONNECTION_ID
;
78 typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID
, *PHTTP_REQUEST_ID
;
79 typedef HTTP_OPAQUE_ID HTTP_SERVER_SESSION_ID
, *PHTTP_SERVER_SESSION_ID
;
80 typedef HTTP_OPAQUE_ID HTTP_URL_GROUP_ID
, *PHTTP_URL_GROUP_ID
;
81 typedef ULONGLONG HTTP_URL_CONTEXT
;
83 typedef struct _HTTP_VERSION
87 } HTTP_VERSION
, *PHTTP_VERSION
;
89 typedef enum _HTTP_VERB
112 } HTTP_VERB
, *PHTTP_VERB
;
114 typedef struct _HTTP_COOKED_URL
116 USHORT FullUrlLength
;
118 USHORT AbsPathLength
;
119 USHORT QueryStringLength
;
120 const WCHAR
*pFullUrl
;
122 const WCHAR
*pAbsPath
;
123 const WCHAR
*pQueryString
;
124 } HTTP_COOKED_URL
, *PHTTP_COOKED_URL
;
126 typedef struct _HTTP_TRANSPORT_ADDRESS
128 SOCKADDR
*pRemoteAddress
;
129 SOCKADDR
*pLocalAddress
;
130 } HTTP_TRANSPORT_ADDRESS
, *PHTTP_TRANSPORT_ADDRESS
;
132 typedef struct _HTTP_UNKNOWN_HEADER
135 USHORT RawValueLength
;
137 const char *pRawValue
;
138 } HTTP_UNKNOWN_HEADER
, *PHTTP_UNKNOWN_HEADER
;
140 typedef struct _HTTP_KNOWN_HEADER
142 USHORT RawValueLength
;
143 const char *pRawValue
;
144 } HTTP_KNOWN_HEADER
, *PHTTP_KNOWN_HEADER
;
146 typedef enum _HTTP_HEADER_ID
148 HttpHeaderCacheControl
= 0,
149 HttpHeaderConnection
= 1,
151 HttpHeaderKeepAlive
= 3,
152 HttpHeaderPragma
= 4,
153 HttpHeaderTrailer
= 5,
154 HttpHeaderTransferEncoding
= 6,
155 HttpHeaderUpgrade
= 7,
157 HttpHeaderWarning
= 9,
158 HttpHeaderAllow
= 10,
159 HttpHeaderContentLength
= 11,
160 HttpHeaderContentType
= 12,
161 HttpHeaderContentEncoding
= 13,
162 HttpHeaderContentLanguage
= 14,
163 HttpHeaderContentLocation
= 15,
164 HttpHeaderContentMd5
= 16,
165 HttpHeaderContentRange
= 17,
166 HttpHeaderExpires
= 18,
167 HttpHeaderLastModified
= 19,
169 HttpHeaderAccept
= 20,
170 HttpHeaderAcceptCharset
= 21,
171 HttpHeaderAcceptEncoding
= 22,
172 HttpHeaderAcceptLanguage
= 23,
173 HttpHeaderAuthorization
= 24,
174 HttpHeaderCookie
= 25,
175 HttpHeaderExpect
= 26,
178 HttpHeaderIfMatch
= 29,
179 HttpHeaderIfModifiedSince
= 30,
180 HttpHeaderIfNoneMatch
= 31,
181 HttpHeaderIfRange
= 32,
182 HttpHeaderIfUnmodifiedSince
= 33,
183 HttpHeaderMaxForwards
= 34,
184 HttpHeaderProxyAuthorization
= 35,
185 HttpHeaderReferer
= 36,
186 HttpHeaderRange
= 37,
188 HttpHeaderTranslate
= 39,
189 HttpHeaderUserAgent
= 40,
190 HttpHeaderRequestMaximum
= 41,
192 HttpHeaderAcceptRanges
= 20,
195 HttpHeaderLocation
= 23,
196 HttpHeaderProxyAuthenticate
= 24,
197 HttpHeaderRetryAfter
= 25,
198 HttpHeaderServer
= 26,
199 HttpHeaderSetCookie
= 27,
201 HttpHeaderWwwAuthenticate
= 29,
202 HttpHeaderResponseMaximum
= 30,
204 HttpHeaderMaximum
= 41,
205 } HTTP_HEADER_ID
, *PHTTP_HEADER_ID
;
207 typedef struct _HTTP_REQUEST_HEADERS
209 USHORT UnknownHeaderCount
;
210 HTTP_UNKNOWN_HEADER
*pUnknownHeaders
;
212 HTTP_UNKNOWN_HEADER
*pTrailers
;
213 HTTP_KNOWN_HEADER KnownHeaders
[HttpHeaderRequestMaximum
];
214 } HTTP_REQUEST_HEADERS
, *PHTTP_REQUEST_HEADERS
;
216 typedef enum _HTTP_DATA_CHUNK_TYPE
218 HttpDataChunkFromMemory
= 0,
219 HttpDataChunkFromFileHandle
,
220 HttpDataChunkFromFragmentCache
,
221 HttpDataChunkFromFragmentCacheEx
,
222 HttpDataChunkMaximum
,
223 } HTTP_DATA_CHUNK_TYPE
, *PHTTP_DATA_CHUNK_TYPE
;
225 #define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1)
227 typedef struct _HTTP_BYTE_RANGE
229 ULARGE_INTEGER StartingOffset
;
230 ULARGE_INTEGER Length
;
231 } HTTP_BYTE_RANGE
, *PHTTP_BYTE_RANGE
;
233 typedef struct _HTTP_DATA_CHUNK
235 HTTP_DATA_CHUNK_TYPE DataChunkType
;
245 HTTP_BYTE_RANGE ByteRange
;
250 USHORT FragmentNameLength
;
251 const WCHAR
*pFragmentName
;
254 } HTTP_DATA_CHUNK
, *PHTTP_DATA_CHUNK
;
256 typedef struct _HTTP_SSL_CLIENT_CERT_INFO
259 ULONG CertEncodedSize
;
262 BOOLEAN CertDeniedByMapper
;
263 } HTTP_SSL_CLIENT_CERT_INFO
, *PHTTP_SSL_CLIENT_CERT_INFO
;
265 typedef struct _HTTP_SSL_INFO
267 USHORT ServerCertKeySize
;
268 USHORT ConnectionKeySize
;
269 ULONG ServerCertIssuerSize
;
270 ULONG ServerCertSubjectSize
;
271 const char *pServerCertIssuer
;
272 const char *pServerCertSubject
;
273 HTTP_SSL_CLIENT_CERT_INFO
*pClientCertInfo
;
274 ULONG SslClientCertNegotiated
;
275 } HTTP_SSL_INFO
, *PHTTP_SSL_INFO
;
277 typedef struct _HTTP_REQUEST_V1
280 HTTP_CONNECTION_ID ConnectionId
;
281 HTTP_REQUEST_ID RequestId
;
282 HTTP_URL_CONTEXT UrlContext
;
283 HTTP_VERSION Version
;
285 USHORT UnknownVerbLength
;
287 const char *pUnknownVerb
;
289 HTTP_COOKED_URL CookedUrl
;
290 HTTP_TRANSPORT_ADDRESS Address
;
291 HTTP_REQUEST_HEADERS Headers
;
292 ULONGLONG BytesReceived
;
293 USHORT EntityChunkCount
;
294 HTTP_DATA_CHUNK
*pEntityChunks
;
295 HTTP_RAW_CONNECTION_ID RawConnectionId
;
296 HTTP_SSL_INFO
*pSslInfo
;
299 typedef enum _HTTP_REQUEST_INFO_TYPE
301 HttpRequestInfoTypeAuth
= 0,
302 } HTTP_REQUEST_INFO_TYPE
, *PHTTP_REQUEST_INFO_TYPE
;
304 typedef struct _HTTP_REQUEST_INFO
306 HTTP_REQUEST_INFO_TYPE InfoType
;
309 } HTTP_REQUEST_INFO
, *PHTTP_REQUEST_INFO
;
312 typedef struct _HTTP_REQUEST_V2
: HTTP_REQUEST_V1
314 USHORT RequestInfoCount
;
315 HTTP_REQUEST_INFO
*pRequestInfo
;
316 } HTTP_REQUEST_V2
, *PHTTP_REQUEST_V2
;
318 typedef struct _HTTP_REQUEST_V2
321 USHORT RequestInfoCount
;
322 HTTP_REQUEST_INFO
*pRequestInfo
;
323 } HTTP_REQUEST_V2
, *PHTTP_REQUEST_V2
;
326 typedef HTTP_REQUEST_V2 HTTP_REQUEST
, *PHTTP_REQUEST
;
328 typedef struct _HTTP_RESPONSE_HEADERS
330 USHORT UnknownHeaderCount
;
331 HTTP_UNKNOWN_HEADER
*pUnknownHeaders
;
333 HTTP_UNKNOWN_HEADER
*pTrailers
;
334 HTTP_KNOWN_HEADER KnownHeaders
[HttpHeaderResponseMaximum
];
335 } HTTP_RESPONSE_HEADERS
,*PHTTP_RESPONSE_HEADERS
;
337 typedef struct _HTTP_RESPONSE_V1
340 HTTP_VERSION Version
;
344 HTTP_RESPONSE_HEADERS Headers
;
345 USHORT EntityChunkCount
;
346 HTTP_DATA_CHUNK
*pEntityChunks
;
347 } HTTP_RESPONSE_V1
, *PHTTP_RESPONSE_V1
;
349 typedef enum _HTTP_RESPONSE_INFO_TYPE
351 HttpResponseInfoTypeMultipleKnownHeaders
= 0,
352 HttpResponseInfoTypeAuthenticationProperty
,
353 HttpResponseInfoTypeQosProperty
,
354 HttpResponseInfoTypeChannelBind
,
355 } HTTP_RESPONSE_INFO_TYPE
, *PHTTP_RESPONSE_INFO_TYPE
;
357 typedef struct _HTTP_RESPONSE_INFO
359 HTTP_RESPONSE_INFO_TYPE Type
;
362 } HTTP_RESPONSE_INFO
, *PHTTP_RESPONSE_INFO
;
365 typedef struct _HTTP_RESPONSE_V2
: HTTP_RESPONSE_V1
367 USHORT ResponseInfoCount
;
368 HTTP_RESPONSE_INFO
*pResponseInfo
;
369 } HTTP_RESPONSE_V2
, *PHTTP_RESPONSE_V2
;
371 typedef struct _HTTP_RESPONSE_V2
374 USHORT ResponseInfoCount
;
375 HTTP_RESPONSE_INFO
*pResponseInfo
;
376 } HTTP_RESPONSE_V2
, *PHTTP_RESPONSE_V2
;
379 typedef HTTP_RESPONSE_V2 HTTP_RESPONSE
, *PHTTP_RESPONSE
;
381 typedef enum _HTTP_CACHE_POLICY_TYPE
383 HttpCachePolicyNocache
,
384 HttpCachePolicyUserInvalidates
,
385 HttpCachePolicyTimeToLive
,
386 HttpCachePolicyMaximum
,
387 } HTTP_CACHE_POLICY_TYPE
, *PHTTP_CACHE_POLICY_TYPE
;
389 typedef struct _HTTP_CACHE_POLICY
391 HTTP_CACHE_POLICY_TYPE Policy
;
393 } HTTP_CACHE_POLICY
, *PHTTP_CACHE_POLICY
;
395 typedef enum _HTTP_LOG_DATA_TYPE
397 HttpLogDataTypeFields
= 0,
398 } HTTP_LOG_DATA_TYPE
, *PHTTP_LOG_DATA_TYPE
;
400 typedef struct _HTTP_LOG_DATA
402 HTTP_LOG_DATA_TYPE Type
;
403 } HTTP_LOG_DATA
, *PHTTP_LOG_DATA
;
405 typedef enum _HTTP_SERVER_PROPERTY
407 HttpServerAuthenticationProperty
,
408 HttpServerLoggingProperty
,
409 HttpServerQosProperty
,
410 HttpServerTimeoutsProperty
,
411 HttpServerQueueLengthProperty
,
412 HttpServerStateProperty
,
413 HttpServer503VerbosityProperty
,
414 HttpServerBindingProperty
,
415 HttpServerExtendedAuthenticationProperty
,
416 HttpServerListenEndpointProperty
,
417 HttpServerChannelBindProperty
,
418 HttpServerProtectionLevelProperty
,
419 } HTTP_SERVER_PROPERTY
, *PHTTP_SERVER_PROPERTY
;
421 typedef struct _HTTP_PROPERTY_FLAGS
424 } HTTP_PROPERTY_FLAGS
, *PHTTP_PROPERTY_FLAGS
;
426 typedef struct _HTTP_BINDING_INFO
428 HTTP_PROPERTY_FLAGS Flags
;
429 HANDLE RequestQueueHandle
;
430 } HTTP_BINDING_INFO
, *PHTTP_BINDING_INFO
;
432 typedef enum _HTTP_QOS_SETTING_TYPE
434 HttpQosSettingTypeBandwidth
,
435 HttpQosSettingTypeConnectionLimit
,
436 HttpQosSettingTypeFlowRate
,
437 } HTTP_QOS_SETTING_TYPE
, *PHTTP_QOS_SETTING_TYPE
;
439 typedef struct _HTTP_BANDWIDTH_LIMIT_INFO
441 HTTP_PROPERTY_FLAGS Flags
;
443 } HTTP_BANDWIDTH_LIMIT_INFO
, *PHTTP_BANDWIDTH_LIMIT_INFO
;
445 typedef struct _HTTP_CONNECTION_LIMIT_INFO
447 HTTP_PROPERTY_FLAGS Flags
;
448 ULONG MaxConnections
;
449 } HTTP_CONNECTION_LIMIT_INFO
, *PHTTP_CONNECTION_LIMIT_INFO
;
451 typedef struct _HTTP_FLOWRATE_INFO
453 HTTP_PROPERTY_FLAGS Flags
;
455 ULONG MaxPeakBandwidth
;
457 } HTTP_FLOWRATE_INFO
, *PHTTP_FLOWRATE_INFO
;
459 typedef struct _HTTP_QOS_SETTING_INFO
461 HTTP_QOS_SETTING_TYPE QosType
;
463 } HTTP_QOS_SETTING_INFO
, *PHTTP_QOS_SETTING_INFO
;
465 ULONG WINAPI
HttpAddUrl(HANDLE
,PCWSTR
,PVOID
);
466 ULONG WINAPI
HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id
, const WCHAR
*url
, HTTP_URL_CONTEXT context
, ULONG reserved
);
467 ULONG WINAPI
HttpCloseRequestQueue(HANDLE handle
);
468 ULONG WINAPI
HttpCloseServerSession(HTTP_SERVER_SESSION_ID id
);
469 ULONG WINAPI
HttpCloseUrlGroup(HTTP_URL_GROUP_ID id
);
470 ULONG WINAPI
HttpCreateHttpHandle(PHANDLE
,ULONG
);
471 ULONG WINAPI
HttpCreateRequestQueue(HTTPAPI_VERSION version
, const WCHAR
*name
, SECURITY_ATTRIBUTES
*sa
, ULONG flags
, HANDLE
*handle
);
472 ULONG WINAPI
HttpCreateServerSession(HTTPAPI_VERSION
,PHTTP_SERVER_SESSION_ID
,ULONG
);
473 ULONG WINAPI
HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id
, HTTP_URL_GROUP_ID
*group_id
, ULONG reserved
);
474 ULONG WINAPI
HttpDeleteServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,LPOVERLAPPED
);
475 ULONG WINAPI
HttpInitialize(HTTPAPI_VERSION version
, ULONG flags
, void *reserved
);
476 ULONG WINAPI
HttpTerminate(ULONG flags
, void *reserved
);
477 ULONG WINAPI
HttpQueryServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,PVOID
,ULONG
,PULONG
,LPOVERLAPPED
);
478 ULONG WINAPI
HttpReceiveHttpRequest(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, HTTP_REQUEST
*request
, ULONG size
, ULONG
*ret_size
, OVERLAPPED
*ovl
);
479 ULONG WINAPI
HttpReceiveRequestEntityBody(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, void *buffer
, ULONG size
, ULONG
*ret_size
, OVERLAPPED
*ovl
);
480 ULONG WINAPI
HttpRemoveUrl(HANDLE queue
, const WCHAR
*url
);
481 ULONG WINAPI
HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id
, const WCHAR
*url
, ULONG flags
);
482 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
);
483 ULONG WINAPI
HttpSetRequestQueueProperty(HANDLE queue
, HTTP_SERVER_PROPERTY property
, void *value
, ULONG length
, ULONG reserved1
, void *reserved2
);
484 ULONG WINAPI
HttpSetServerSessionProperty(HTTP_SERVER_SESSION_ID id
, HTTP_SERVER_PROPERTY property
, void *value
, ULONG size
);
485 ULONG WINAPI
HttpSetServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,LPOVERLAPPED
);
486 ULONG WINAPI
HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID id
, HTTP_SERVER_PROPERTY property
, void *value
, ULONG length
);
492 #endif /* __WINE_HTTP_H */