Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/httpapi/httpapi.spec | 2 +- dlls/httpapi/httpapi_main.c | 11 ++ include/http.h | 267 +++++++++++++++++++++++++++++++++++- 3 files changed, 276 insertions(+), 4 deletions(-)
diff --git a/dlls/httpapi/httpapi.spec b/dlls/httpapi/httpapi.spec index 1d8fcd81ad..fd5dec9f7b 100644 --- a/dlls/httpapi/httpapi.spec +++ b/dlls/httpapi/httpapi.spec @@ -32,7 +32,7 @@ @ stdcall HttpQueryServiceConfiguration(ptr long ptr long ptr long ptr ptr) @ stub HttpReadFragmentFromCache @ stub HttpReceiveClientCertificate -@ stub HttpReceiveHttpRequest +@ stdcall HttpReceiveHttpRequest(ptr int64 long ptr long ptr ptr) @ stub HttpReceiveHttpResponse @ stub HttpReceiveRequestEntityBody @ stub HttpRemoveAllUrlsFromConfigGroup diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c index a4f20b6bf6..71c63f3c1a 100644 --- a/dlls/httpapi/httpapi_main.c +++ b/dlls/httpapi/httpapi_main.c @@ -182,6 +182,17 @@ ULONG WINAPI HttpAddUrl( HANDLE handle, PCWSTR url, PVOID reserved ) return ERROR_CALL_NOT_IMPLEMENTED; }
+/*********************************************************************** + * HttpReceiveHttpRequest (HTTPAPI.@) + */ +ULONG WINAPI HttpReceiveHttpRequest(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags, + HTTP_REQUEST *request, ULONG size, ULONG *ret_size, OVERLAPPED *ovl) +{ + FIXME("queue %p, id %#I64x, flags %#x, request %p, size %#x, ret_size %p, ovl %p, stub!\n", + queue, id, flags, request, size, ret_size, ovl); + return ERROR_CALL_NOT_IMPLEMENTED; +} + /*********************************************************************** * HttpCreateServerSession (HTTPAPI.@) */ diff --git a/include/http.h b/include/http.h index 8f284a88aa..36acac63fd 100644 --- a/include/http.h +++ b/include/http.h @@ -37,10 +37,16 @@ typedef struct _HTTPAPI_VERSION #define HTTPAPI_VERSION_1 {1,0} #define HTTPAPI_VERSION_2 {2,0}
-/* HttpInitialize and HttpTerminate flags */ #define HTTP_INITIALIZE_SERVER 0x00000001 #define HTTP_INITIALIZE_CONFIG 0x00000002
+#define HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY 0x00000001 +#define HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY 0x00000002 + +#define HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS 0x00000001 +#define HTTP_REQUEST_FLAG_IP_ROUTED 0x00000002 +#define HTTP_REQUEST_FLAG_HTTP2 0x00000004 + typedef enum _HTTP_SERVICE_CONFIG_ID { HttpServiceConfigIPListenList, @@ -50,19 +56,274 @@ typedef enum _HTTP_SERVICE_CONFIG_ID HttpServiceConfigMax } HTTP_SERVICE_CONFIG_ID, *PHTTP_SERVICE_CONFIG_ID;
+#define HTTP_NULL_ID ((ULONGLONG)0) + typedef ULONGLONG HTTP_OPAQUE_ID, *PHTTP_OPAQUE_ID; +typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID, *PHTTP_CONNECTION_ID; +typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID, *PHTTP_RAW_CONNECTION_ID; +typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID, *PHTTP_REQUEST_ID; typedef HTTP_OPAQUE_ID HTTP_SERVER_SESSION_ID, *PHTTP_SERVER_SESSION_ID; typedef HTTP_OPAQUE_ID HTTP_URL_GROUP_ID, *PHTTP_URL_GROUP_ID; +typedef ULONGLONG HTTP_URL_CONTEXT; + +typedef struct _HTTP_VERSION +{ + USHORT MajorVersion; + USHORT MinorVersion; +} HTTP_VERSION, *PHTTP_VERSION; + +typedef enum _HTTP_VERB +{ + HttpVerbUnparsed = 0, + HttpVerbUnknown, + HttpVerbInvalid, + HttpVerbOPTIONS, + HttpVerbGET, + HttpVerbHEAD, + HttpVerbPOST, + HttpVerbPUT, + HttpVerbDELETE, + HttpVerbTRACE, + HttpVerbCONNECT, + HttpVerbTRACK, + HttpVerbMOVE, + HttpVerbCOPY, + HttpVerbPROPFIND, + HttpVerbPROPPATCH, + HttpVerbMKCOL, + HttpVerbLOCK, + HttpVerbUNLOCK, + HttpVerbSEARCH, + HttpVerbMaximum, +} HTTP_VERB, *PHTTP_VERB; + +typedef struct _HTTP_COOKED_URL +{ + USHORT FullUrlLength; + USHORT HostLength; + USHORT AbsPathLength; + USHORT QueryStringLength; + const WCHAR *pFullUrl; + const WCHAR *pHost; + const WCHAR *pAbsPath; + const WCHAR *pQueryString; +} HTTP_COOKED_URL, *PHTTP_COOKED_URL;
-ULONG WINAPI HttpInitialize(HTTPAPI_VERSION,ULONG,PVOID); -ULONG WINAPI HttpTerminate(ULONG,PVOID); +typedef struct _HTTP_TRANSPORT_ADDRESS +{ + SOCKADDR *pRemoteAddress; + SOCKADDR *pLocalAddress; +} HTTP_TRANSPORT_ADDRESS, *PHTTP_TRANSPORT_ADDRESS; + +typedef struct _HTTP_UNKNOWN_HEADER +{ + USHORT NameLength; + USHORT RawValueLength; + const char *pName; + const char *pRawValue; +} HTTP_UNKNOWN_HEADER, *PHTTP_UNKNOWN_HEADER; + +typedef struct _HTTP_KNOWN_HEADER +{ + USHORT RawValueLength; + const char *pRawValue; +} HTTP_KNOWN_HEADER, *PHTTP_KNOWN_HEADER; + +typedef enum _HTTP_HEADER_ID +{ + HttpHeaderCacheControl = 0, + HttpHeaderConnection = 1, + HttpHeaderDate = 2, + HttpHeaderKeepAlive = 3, + HttpHeaderPragma = 4, + HttpHeaderTrailer = 5, + HttpHeaderTransferEncoding = 6, + HttpHeaderUpgrade = 7, + HttpHeaderVia = 8, + HttpHeaderWarning = 9, + HttpHeaderAllow = 10, + HttpHeaderContentLength = 11, + HttpHeaderContentType = 12, + HttpHeaderContentEncoding = 13, + HttpHeaderContentLanguage = 14, + HttpHeaderContentLocation = 15, + HttpHeaderContentMd5 = 16, + HttpHeaderContentRange = 17, + HttpHeaderExpires = 18, + HttpHeaderLastModified = 19, + + HttpHeaderAccept = 20, + HttpHeaderAcceptCharset = 21, + HttpHeaderAcceptEncoding = 22, + HttpHeaderAcceptLanguage = 23, + HttpHeaderAuthorization = 24, + HttpHeaderCookie = 25, + HttpHeaderExpect = 26, + HttpHeaderFrom = 27, + HttpHeaderHost = 28, + HttpHeaderIfMatch = 29, + HttpHeaderIfModifiedSince = 30, + HttpHeaderIfNoneMatch = 31, + HttpHeaderIfRange = 32, + HttpHeaderIfUnmodifiedSince = 33, + HttpHeaderMaxForwards = 34, + HttpHeaderProxyAuthorization = 35, + HttpHeaderReferer = 36, + HttpHeaderRange = 37, + HttpHeaderTe = 38, + HttpHeaderTranslate = 39, + HttpHeaderUserAgent = 40, + HttpHeaderRequestMaximum = 41, + + HttpHeaderAcceptRanges = 20, + HttpHeaderAge = 21, + HttpHeaderEtag = 22, + HttpHeaderLocation = 23, + HttpHeaderProxyAuthenticate = 24, + HttpHeaderRetryAfter = 25, + HttpHeaderServer = 26, + HttpHeaderSetCookie = 27, + HttpHeaderVary = 28, + HttpHeaderWwwAuthenticate = 29, + HttpHeaderResponseMaximum = 30, + + HttpHeaderMaximum = 41, +} HTTP_HEADER_ID, *PHTTP_HEADER_ID; + +typedef struct _HTTP_REQUEST_HEADERS +{ + USHORT UnknownHeaderCount; + HTTP_UNKNOWN_HEADER *pUnknownHeaders; + USHORT TrailerCount; + HTTP_UNKNOWN_HEADER *pTrailers; + HTTP_KNOWN_HEADER KnownHeaders[HttpHeaderRequestMaximum]; +} HTTP_REQUEST_HEADERS, *PHTTP_REQUEST_HEADERS; + +typedef enum _HTTP_DATA_CHUNK_TYPE +{ + HttpDataChunkFromMemory = 0, + HttpDataChunkFromFileHandle, + HttpDataChunkFromFragmentCache, + HttpDataChunkFromFragmentCacheEx, + HttpDataChunkMaximum, +} HTTP_DATA_CHUNK_TYPE, *PHTTP_DATA_CHUNK_TYPE; + +#define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1) + +typedef struct _HTTP_BYTE_RANGE +{ + ULARGE_INTEGER StartingOffset; + ULARGE_INTEGER Length; +} HTTP_BYTE_RANGE, *PHTTP_BYTE_RANGE; + +typedef struct _HTTP_DATA_CHUNK +{ + HTTP_DATA_CHUNK_TYPE DataChunkType; + __C89_NAMELESS union + { + struct + { + void *pBuffer; + ULONG BufferLength; + } FromMemory; + struct + { + HTTP_BYTE_RANGE ByteRange; + HANDLE FileHandle; + } FromFileHandle; + struct + { + USHORT FragmentNameLength; + const WCHAR *pFragmentName; + } FromFragmentCache; + } DUMMYUNIONNAME; +} HTTP_DATA_CHUNK, *PHTTP_DATA_CHUNK; + +typedef struct _HTTP_SSL_CLIENT_CERT_INFO +{ + ULONG CertFlags; + ULONG CertEncodedSize; + UCHAR *pCertEncoded; + HANDLE Token; + BOOLEAN CertDeniedByMapper; +} HTTP_SSL_CLIENT_CERT_INFO, *PHTTP_SSL_CLIENT_CERT_INFO; + +typedef struct _HTTP_SSL_INFO +{ + USHORT ServerCertKeySize; + USHORT ConnectionKeySize; + ULONG ServerCertIssuerSize; + ULONG ServerCertSubjectSize; + const char *pServerCertIssuer; + const char *pServerCertSubject; + HTTP_SSL_CLIENT_CERT_INFO *pClientCertInfo; + ULONG SslClientCertNegotiated; +} HTTP_SSL_INFO, *PHTTP_SSL_INFO; + +typedef struct _HTTP_REQUEST_V1 +{ + ULONG Flags; + HTTP_CONNECTION_ID ConnectionId; + HTTP_REQUEST_ID RequestId; + HTTP_URL_CONTEXT UrlContext; + HTTP_VERSION Version; + HTTP_VERB Verb; + USHORT UnknownVerbLength; + USHORT RawUrlLength; + const char *pUnknownVerb; + const char *pRawUrl; + HTTP_COOKED_URL CookedUrl; + HTTP_TRANSPORT_ADDRESS Address; + HTTP_REQUEST_HEADERS Headers; + ULONGLONG BytesReceived; + USHORT EntityChunkCount; + HTTP_DATA_CHUNK *pEntityChunks; + HTTP_RAW_CONNECTION_ID RawConnectionId; + HTTP_SSL_INFO *pSslInfo; +} HTTP_REQUEST_V1; + +typedef enum _HTTP_REQUEST_INFO_TYPE +{ + HttpRequestInfoTypeAuth = 0, +} HTTP_REQUEST_INFO_TYPE, *PHTTP_REQUEST_INFO_TYPE; + +typedef struct _HTTP_REQUEST_INFO +{ + HTTP_REQUEST_INFO_TYPE InfoType; + ULONG InfoLength; + void *pInfo; +} HTTP_REQUEST_INFO, *PHTTP_REQUEST_INFO; + +#ifdef __cplusplus +typedef struct _HTTP_REQUEST_V2 : HTTP_REQUEST_V1 +{ + USHORT RequestInfoCount; + HTTP_REQUEST_INFO *pRequestInfo; +} HTTP_REQUEST_V2, *PHTTP_REQUEST_V2; +#else +typedef struct _HTTP_REQUEST_V2 +{ + __C89_NAMELESS HTTP_REQUEST_V1 DUMMYSTRUCTNAME; + USHORT RequestInfoCount; + HTTP_REQUEST_INFO *pRequestInfo; +} HTTP_REQUEST_V2, *PHTTP_REQUEST_V2; +#endif + +#if (_WIN32_WINNT >= 0x0600) +typedef HTTP_REQUEST_V2 HTTP_REQUEST, *PHTTP_REQUEST; +#else +typedef HTTP_REQUEST_V1 HTTP_REQUEST, *PHTTP_REQUEST; +#endif
ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID); ULONG WINAPI HttpCreateHttpHandle(PHANDLE,ULONG); ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION,PHTTP_SERVER_SESSION_ID,ULONG); ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID); ULONG WINAPI HttpDeleteServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED); +ULONG WINAPI HttpInitialize(HTTPAPI_VERSION version, ULONG flags, void *reserved); +ULONG WINAPI HttpTerminate(ULONG flags, void *reserved); ULONG WINAPI HttpQueryServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,PVOID,ULONG,PULONG,LPOVERLAPPED); +ULONG WINAPI HttpReceiveHttpRequest(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags, HTTP_REQUEST *request, ULONG size, ULONG *ret_size, OVERLAPPED *ovl); ULONG WINAPI HttpSetServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED);
#ifdef __cplusplus