Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/httpapi/httpapi.spec | 1 + dlls/httpapi/httpapi_main.c | 25 +++++++++++++++++++++++++ include/http.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+)
diff --git a/dlls/httpapi/httpapi.spec b/dlls/httpapi/httpapi.spec index aad5d58437c..b3f3148acbc 100644 --- a/dlls/httpapi/httpapi.spec +++ b/dlls/httpapi/httpapi.spec @@ -49,6 +49,7 @@ @ stub HttpSetControlChannelInformation @ stub HttpSetServerContextInformation @ stdcall HttpSetServiceConfiguration(ptr long ptr long ptr) +@ stdcall HttpSetUrlGroupProperty(int64 long ptr long) @ stub HttpShutdownAppPool @ stub HttpShutdownFilter @ stdcall HttpTerminate(long ptr) diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c index c7d95c9fbad..29a8e70301f 100644 --- a/dlls/httpapi/httpapi_main.c +++ b/dlls/httpapi/httpapi_main.c @@ -474,6 +474,7 @@ ULONG WINAPI HttpSendHttpResponse(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags, struct url_group { struct list entry, session_entry; + HANDLE queue; };
static struct list url_groups = LIST_INIT(url_groups); @@ -598,3 +599,27 @@ ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id)
return ERROR_SUCCESS; } + +/*********************************************************************** + * HttpSetUrlGroupProperty (HTTPAPI.@) + */ +ULONG WINAPI HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID id, HTTP_SERVER_PROPERTY property, void *value, ULONG length) +{ + struct url_group *group = get_url_group(id); + const HTTP_BINDING_INFO *info = value; + + TRACE("id %s, property %u, value %p, length %u.\n", + wine_dbgstr_longlong(id), property, value, length); + + if (property != HttpServerBindingProperty) + { + FIXME("Unhandled property %u.\n", property); + return ERROR_CALL_NOT_IMPLEMENTED; + } + + TRACE("Binding to queue %p.\n", info->RequestQueueHandle); + + group->queue = info->RequestQueueHandle; + + return ERROR_SUCCESS; +} diff --git a/include/http.h b/include/http.h index b07c3b03f93..60494a130f9 100644 --- a/include/http.h +++ b/include/http.h @@ -397,6 +397,33 @@ typedef struct _HTTP_LOG_DATA HTTP_LOG_DATA_TYPE Type; } HTTP_LOG_DATA, *PHTTP_LOG_DATA;
+typedef enum _HTTP_SERVER_PROPERTY +{ + HttpServerAuthenticationProperty, + HttpServerLoggingProperty, + HttpServerQosProperty, + HttpServerTimeoutsProperty, + HttpServerQueueLengthProperty, + HttpServerStateProperty, + HttpServer503VerbosityProperty, + HttpServerBindingProperty, + HttpServerExtendedAuthenticationProperty, + HttpServerListenEndpointProperty, + HttpServerChannelBindProperty, + HttpServerProtectionLevelProperty, +} HTTP_SERVER_PROPERTY, *PHTTP_SERVER_PROPERTY; + +typedef struct _HTTP_PROPERTY_FLAGS +{ + ULONG Present : 1; +} HTTP_PROPERTY_FLAGS, *PHTTP_PROPERTY_FLAGS; + +typedef struct _HTTP_BINDING_INFO +{ + HTTP_PROPERTY_FLAGS Flags; + HANDLE RequestQueueHandle; +} HTTP_BINDING_INFO, *PHTTP_BINDING_INFO; + ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID); ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id); ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id); @@ -411,6 +438,7 @@ ULONG WINAPI HttpReceiveHttpRequest(HANDLE queue, HTTP_REQUEST_ID id, ULONG flag ULONG WINAPI HttpRemoveUrl(HANDLE queue, const WCHAR *url); 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); ULONG WINAPI HttpSetServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED); +ULONG WINAPI HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID id, HTTP_SERVER_PROPERTY property, void *value, ULONG length);
#ifdef __cplusplus }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/httpapi/httpapi.spec | 2 + dlls/httpapi/httpapi_main.c | 87 +++++++++++++++++++++++++++++++++---- include/http.h | 2 + 3 files changed, 82 insertions(+), 9 deletions(-)
diff --git a/dlls/httpapi/httpapi.spec b/dlls/httpapi/httpapi.spec index b3f3148acbc..ae3406f44ee 100644 --- a/dlls/httpapi/httpapi.spec +++ b/dlls/httpapi/httpapi.spec @@ -1,6 +1,7 @@ @ stub HttpAddFragmentToCache @ stdcall HttpAddUrl(ptr wstr ptr) @ stub HttpAddUrlToConfigGroup +@ stdcall HttpAddUrlToUrlGroup(int64 wstr int64 long) @ stub HttpCancelHttpRequest @ stub HttpCreateAppPool @ stub HttpCreateConfigGroup @@ -40,6 +41,7 @@ @ stub HttpRemoveAllUrlsFromConfigGroup @ stdcall HttpRemoveUrl(ptr wstr) @ stub HttpRemoveUrlFromConfigGroup +@ stdcall HttpRemoveUrlFromUrlGroup(int64 wstr long) @ stub HttpSendHttpRequest @ stdcall HttpSendHttpResponse(ptr int64 long ptr ptr ptr ptr long ptr ptr) @ stub HttpSendRequestEntityBody diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c index 29a8e70301f..79497087d31 100644 --- a/dlls/httpapi/httpapi_main.c +++ b/dlls/httpapi/httpapi_main.c @@ -27,6 +27,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(httpapi);
+static WCHAR *heap_strdupW(const WCHAR *str) +{ + int len = wcslen(str) + 1; + WCHAR *ret = heap_alloc(len * sizeof(WCHAR)); + wcscpy(ret, str); + return ret; +} + BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID lpv ) { switch(reason) @@ -247,21 +255,13 @@ ULONG WINAPI HttpAddUrl(HANDLE queue, const WCHAR *url, void *reserved) return add_url(queue, url, 0); }
-/*********************************************************************** - * HttpRemoveUrl (HTTPAPI.@) - */ -ULONG WINAPI HttpRemoveUrl(HANDLE queue, const WCHAR *urlW) +static ULONG remove_url(HANDLE queue, const WCHAR *urlW) { ULONG ret = ERROR_SUCCESS; OVERLAPPED ovl = {}; char *url; int len;
- TRACE("queue %p, url %s.\n", queue, debugstr_w(urlW)); - - if (!queue) - return ERROR_INVALID_PARAMETER; - len = WideCharToMultiByte(CP_ACP, 0, urlW, -1, NULL, 0, NULL, NULL); if (!(url = heap_alloc(len))) return ERROR_OUTOFMEMORY; @@ -276,6 +276,19 @@ ULONG WINAPI HttpRemoveUrl(HANDLE queue, const WCHAR *urlW) return ret; }
+/*********************************************************************** + * HttpRemoveUrl (HTTPAPI.@) + */ +ULONG WINAPI HttpRemoveUrl(HANDLE queue, const WCHAR *url) +{ + TRACE("queue %p, url %s.\n", queue, debugstr_w(url)); + + if (!queue) + return ERROR_INVALID_PARAMETER; + + return remove_url(queue, url); +} + /*********************************************************************** * HttpReceiveHttpRequest (HTTPAPI.@) */ @@ -475,6 +488,8 @@ struct url_group { struct list entry, session_entry; HANDLE queue; + WCHAR *url; + HTTP_URL_CONTEXT context; };
static struct list url_groups = LIST_INIT(url_groups); @@ -621,5 +636,59 @@ ULONG WINAPI HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID id, HTTP_SERVER_PROPERTY
group->queue = info->RequestQueueHandle;
+ if (group->url) + add_url(group->queue, group->url, group->context); + + return ERROR_SUCCESS; +} + +/*********************************************************************** + * HttpAddUrlToUrlGroup (HTTPAPI.@) + */ +ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, + HTTP_URL_CONTEXT context, ULONG reserved) +{ + struct url_group *group = get_url_group(id); + + TRACE("id %s, url %s, context %s, reserved %#x.\n", wine_dbgstr_longlong(id), + debugstr_w(url), wine_dbgstr_longlong(context), reserved); + + if (group->url) + { + FIXME("Multiple URLs are not handled!\n"); + return ERROR_CALL_NOT_IMPLEMENTED; + } + + if (!(group->url = heap_strdupW(url))) + return ERROR_OUTOFMEMORY; + group->context = context; + + if (group->queue) + return add_url(group->queue, url, context); + + return ERROR_SUCCESS; +} + +/*********************************************************************** + * HttpRemoveUrlFromUrlGroup (HTTPAPI.@) + */ +ULONG WINAPI HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, ULONG flags) +{ + struct url_group *group = get_url_group(id); + + TRACE("id %s, url %s, flags %#x.\n", wine_dbgstr_longlong(id), debugstr_w(url), flags); + + if (!group->url) + return ERROR_FILE_NOT_FOUND; + + if (flags) + FIXME("Ignoring flags %#x.\n", flags); + + heap_free(group->url); + group->url = NULL; + + if (group->queue) + return remove_url(group->queue, url); + return ERROR_SUCCESS; } diff --git a/include/http.h b/include/http.h index 60494a130f9..c4bb107dd18 100644 --- a/include/http.h +++ b/include/http.h @@ -425,6 +425,7 @@ typedef struct _HTTP_BINDING_INFO } HTTP_BINDING_INFO, *PHTTP_BINDING_INFO;
ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID); +ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, HTTP_URL_CONTEXT context, ULONG reserved); ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id); ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id); ULONG WINAPI HttpCreateHttpHandle(PHANDLE,ULONG); @@ -436,6 +437,7 @@ 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 HttpRemoveUrl(HANDLE queue, const WCHAR *url); +ULONG WINAPI HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, ULONG flags); 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); ULONG WINAPI HttpSetServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED); ULONG WINAPI HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID id, HTTP_SERVER_PROPERTY property, void *value, ULONG length);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/httpapi/httpapi.spec | 2 ++ dlls/httpapi/httpapi_main.c | 42 ++++++++++++++++++++++++++++++++++++- include/http.h | 5 +++++ 3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/dlls/httpapi/httpapi.spec b/dlls/httpapi/httpapi.spec index ae3406f44ee..e2f165c6880 100644 --- a/dlls/httpapi/httpapi.spec +++ b/dlls/httpapi/httpapi.spec @@ -7,8 +7,10 @@ @ stub HttpCreateConfigGroup @ stub HttpCreateFilter @ stdcall HttpCreateHttpHandle(ptr long) +@ stdcall HttpCreateRequestQueue(long wstr ptr long ptr) @ stdcall HttpCreateServerSession(long ptr long) @ stdcall HttpCreateUrlGroup(int64 ptr long) +@ stdcall HttpCloseRequestQueue(ptr) @ stdcall HttpCloseServerSession(int64) @ stdcall HttpCloseUrlGroup(int64) @ stub HttpDeleteConfigGroup diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c index 79497087d31..20405d9ea3e 100644 --- a/dlls/httpapi/httpapi_main.c +++ b/dlls/httpapi/httpapi_main.c @@ -27,6 +27,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(httpapi);
+static const WCHAR device_nameW[] = {'\','D','e','v','i','c','e','\','H','t','t','p','\','R','e','q','Q','u','e','u','e',0}; + static WCHAR *heap_strdupW(const WCHAR *str) { int len = wcslen(str) + 1; @@ -207,7 +209,6 @@ ULONG WINAPI HttpSetServiceConfiguration( HANDLE handle, HTTP_SERVICE_CONFIG_ID */ ULONG WINAPI HttpCreateHttpHandle(HANDLE *handle, ULONG reserved) { - static const WCHAR device_nameW[] = {'\','D','e','v','i','c','e','\','H','t','t','p','\','R','e','q','Q','u','e','u','e',0}; OBJECT_ATTRIBUTES attr = {sizeof(attr)}; UNICODE_STRING string; IO_STATUS_BLOCK iosb; @@ -692,3 +693,42 @@ ULONG WINAPI HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, U
return ERROR_SUCCESS; } + +/*********************************************************************** + * HttpCreateRequestQueue (HTTPAPI.@) + */ +ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION version, const WCHAR *name, + SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle) +{ + OBJECT_ATTRIBUTES attr = {sizeof(attr)}; + UNICODE_STRING string; + IO_STATUS_BLOCK iosb; + + TRACE("version %u.%u, name %s, sa %p, flags %#x, handle %p.\n", + version.HttpApiMajorVersion, version.HttpApiMinorVersion, + debugstr_w(name), sa, flags, handle); + + if (name) + FIXME("Unhandled name %s.\n", debugstr_w(name)); + if (flags) + FIXME("Unhandled flags %#x.\n", flags); + + RtlInitUnicodeString(&string, device_nameW); + attr.ObjectName = &string; + if (sa && sa->bInheritHandle) + attr.Attributes |= OBJ_INHERIT; + attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; + return RtlNtStatusToDosError(NtCreateFile(handle, 0, &attr, &iosb, NULL, + FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN, FILE_NON_DIRECTORY_FILE, NULL, 0)); +} + +/*********************************************************************** + * HttpCloseRequestQueue (HTTPAPI.@) + */ +ULONG WINAPI HttpCloseRequestQueue(HANDLE handle) +{ + TRACE("handle %p.\n", handle); + if (!CloseHandle(handle)) + return GetLastError(); + return ERROR_SUCCESS; +} diff --git a/include/http.h b/include/http.h index c4bb107dd18..7586d0cbe01 100644 --- a/include/http.h +++ b/include/http.h @@ -37,6 +37,9 @@ typedef struct _HTTPAPI_VERSION #define HTTPAPI_VERSION_1 {1,0} #define HTTPAPI_VERSION_2 {2,0}
+#define HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING 0x00000001 +#define HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER 0x00000002 + #define HTTP_INITIALIZE_SERVER 0x00000001 #define HTTP_INITIALIZE_CONFIG 0x00000002
@@ -426,9 +429,11 @@ typedef struct _HTTP_BINDING_INFO
ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID); ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, HTTP_URL_CONTEXT context, ULONG reserved); +ULONG WINAPI HttpCloseRequestQueue(HANDLE handle); ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id); ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id); ULONG WINAPI HttpCreateHttpHandle(PHANDLE,ULONG); +ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION version, const WCHAR *name, SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle); ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION,PHTTP_SERVER_SESSION_ID,ULONG); ULONG WINAPI HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id, HTTP_URL_GROUP_ID *group_id, ULONG reserved); ULONG WINAPI HttpDeleteServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED);
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47476 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46549
On 8/29/19 7:58 PM, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/httpapi/httpapi.spec | 2 ++ dlls/httpapi/httpapi_main.c | 42 ++++++++++++++++++++++++++++++++++++- include/http.h | 5 +++++ 3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/dlls/httpapi/httpapi.spec b/dlls/httpapi/httpapi.spec index ae3406f44ee..e2f165c6880 100644 --- a/dlls/httpapi/httpapi.spec +++ b/dlls/httpapi/httpapi.spec @@ -7,8 +7,10 @@ @ stub HttpCreateConfigGroup @ stub HttpCreateFilter @ stdcall HttpCreateHttpHandle(ptr long) +@ stdcall HttpCreateRequestQueue(long wstr ptr long ptr) @ stdcall HttpCreateServerSession(long ptr long) @ stdcall HttpCreateUrlGroup(int64 ptr long) +@ stdcall HttpCloseRequestQueue(ptr) @ stdcall HttpCloseServerSession(int64) @ stdcall HttpCloseUrlGroup(int64) @ stub HttpDeleteConfigGroup diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c index 79497087d31..20405d9ea3e 100644 --- a/dlls/httpapi/httpapi_main.c +++ b/dlls/httpapi/httpapi_main.c @@ -27,6 +27,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(httpapi);
+static const WCHAR device_nameW[] = {'\','D','e','v','i','c','e','\','H','t','t','p','\','R','e','q','Q','u','e','u','e',0};
- static WCHAR *heap_strdupW(const WCHAR *str) { int len = wcslen(str) + 1;
@@ -207,7 +209,6 @@ ULONG WINAPI HttpSetServiceConfiguration( HANDLE handle, HTTP_SERVICE_CONFIG_ID */ ULONG WINAPI HttpCreateHttpHandle(HANDLE *handle, ULONG reserved) {
- static const WCHAR device_nameW[] = {'\','D','e','v','i','c','e','\','H','t','t','p','\','R','e','q','Q','u','e','u','e',0}; OBJECT_ATTRIBUTES attr = {sizeof(attr)}; UNICODE_STRING string; IO_STATUS_BLOCK iosb;
@@ -692,3 +693,42 @@ ULONG WINAPI HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, U
return ERROR_SUCCESS;
}
+/***********************************************************************
HttpCreateRequestQueue (HTTPAPI.@)
- */
+ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION version, const WCHAR *name,
SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle)
+{
- OBJECT_ATTRIBUTES attr = {sizeof(attr)};
- UNICODE_STRING string;
- IO_STATUS_BLOCK iosb;
- TRACE("version %u.%u, name %s, sa %p, flags %#x, handle %p.\n",
version.HttpApiMajorVersion, version.HttpApiMinorVersion,
debugstr_w(name), sa, flags, handle);
- if (name)
FIXME("Unhandled name %s.\n", debugstr_w(name));
- if (flags)
FIXME("Unhandled flags %#x.\n", flags);
- RtlInitUnicodeString(&string, device_nameW);
- attr.ObjectName = &string;
- if (sa && sa->bInheritHandle)
attr.Attributes |= OBJ_INHERIT;
- attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
- return RtlNtStatusToDosError(NtCreateFile(handle, 0, &attr, &iosb, NULL,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN, FILE_NON_DIRECTORY_FILE, NULL, 0));
+}
+/***********************************************************************
HttpCloseRequestQueue (HTTPAPI.@)
- */
+ULONG WINAPI HttpCloseRequestQueue(HANDLE handle) +{
- TRACE("handle %p.\n", handle);
- if (!CloseHandle(handle))
return GetLastError();
- return ERROR_SUCCESS;
+} diff --git a/include/http.h b/include/http.h index c4bb107dd18..7586d0cbe01 100644 --- a/include/http.h +++ b/include/http.h @@ -37,6 +37,9 @@ typedef struct _HTTPAPI_VERSION #define HTTPAPI_VERSION_1 {1,0} #define HTTPAPI_VERSION_2 {2,0}
+#define HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING 0x00000001 +#define HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER 0x00000002
- #define HTTP_INITIALIZE_SERVER 0x00000001 #define HTTP_INITIALIZE_CONFIG 0x00000002
@@ -426,9 +429,11 @@ typedef struct _HTTP_BINDING_INFO
ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID); ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, HTTP_URL_CONTEXT context, ULONG reserved); +ULONG WINAPI HttpCloseRequestQueue(HANDLE handle); ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id); ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id); ULONG WINAPI HttpCreateHttpHandle(PHANDLE,ULONG); +ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION version, const WCHAR *name, SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle); ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION,PHTTP_SERVER_SESSION_ID,ULONG); ULONG WINAPI HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id, HTTP_URL_GROUP_ID *group_id, ULONG reserved); ULONG WINAPI HttpDeleteServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/httpapi/tests/httpapi.c | 343 ++++++++++++++++++++++++++++++++--- 1 file changed, 317 insertions(+), 26 deletions(-)
diff --git a/dlls/httpapi/tests/httpapi.c b/dlls/httpapi/tests/httpapi.c index 2153361c59c..ff5884d72a1 100644 --- a/dlls/httpapi/tests/httpapi.c +++ b/dlls/httpapi/tests/httpapi.c @@ -33,23 +33,37 @@
static const WCHAR localhost_urlW[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','5','0','0','0','0','/',0}; static const WCHAR localhost_url2W[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','5','0','0','0','1','/',0}; - -static ULONG (WINAPI *pHttpCreateServerSession)(HTTPAPI_VERSION version, HTTP_SERVER_SESSION_ID *session_id, - ULONG reserved); +static const WCHAR invalid_url1[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','5','0','0','0','0',0}; +static const WCHAR invalid_url2[] = {'l','o','c','a','l','h','o','s','t',':','5','0','0','0','0',0}; +static const WCHAR invalid_url3[] = {'l','o','c','a','l','h','o','s','t',':','5','0','0','0','0','/',0}; +static const WCHAR invalid_url4[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/',0}; +static const WCHAR invalid_url5[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','/',0}; +static const WCHAR invalid_url6[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','0','/',0}; + +static ULONG (WINAPI *pHttpAddUrlToUrlGroup)(HTTP_URL_GROUP_ID id, const WCHAR *url, HTTP_URL_CONTEXT context, ULONG reserved); +static ULONG (WINAPI *pHttpCreateServerSession)(HTTPAPI_VERSION version, HTTP_SERVER_SESSION_ID *session_id, ULONG reserved); +static ULONG (WINAPI *pHttpCreateRequestQueue)(HTTPAPI_VERSION version, const WCHAR *name, SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle); +static ULONG (WINAPI *pHttpCreateUrlGroup)(HTTP_SERVER_SESSION_ID session_id, HTTP_URL_GROUP_ID *group_id, ULONG reserved); +static ULONG (WINAPI *pHttpCloseRequestQueue)(HANDLE queue); static ULONG (WINAPI *pHttpCloseServerSession)(HTTP_SERVER_SESSION_ID session_id); -static ULONG (WINAPI *pHttpCreateUrlGroup)(HTTP_SERVER_SESSION_ID session_id, HTTP_URL_GROUP_ID *group_id, - ULONG reserved); static ULONG (WINAPI *pHttpCloseUrlGroup)(HTTP_URL_GROUP_ID group_id); +static ULONG (WINAPI *pHttpRemoveUrlFromUrlGroup)(HTTP_URL_GROUP_ID id, const WCHAR *url, ULONG flags); +static ULONG (WINAPI *pHttpSetUrlGroupProperty)(HTTP_URL_GROUP_ID id, HTTP_SERVER_PROPERTY property, void *value, ULONG length);
static void init(void) { HMODULE mod = GetModuleHandleA("httpapi.dll");
#define X(f) p##f = (void *)GetProcAddress(mod, #f) + X(HttpAddUrlToUrlGroup); + X(HttpCreateRequestQueue); X(HttpCreateServerSession); - X(HttpCloseServerSession); X(HttpCreateUrlGroup); + X(HttpCloseRequestQueue); + X(HttpCloseServerSession); X(HttpCloseUrlGroup); + X(HttpRemoveUrlFromUrlGroup); + X(HttpSetUrlGroupProperty); #undef X }
@@ -92,12 +106,6 @@ static void send_response_v1(HANDLE queue, HTTP_REQUEST_ID id, int s)
static void test_v1_server(void) { - static const WCHAR invalid_url1[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','5','0','0','0','0',0}; - static const WCHAR invalid_url2[] = {'l','o','c','a','l','h','o','s','t',':','5','0','0','0','0',0}; - static const WCHAR invalid_url3[] = {'l','o','c','a','l','h','o','s','t',':','5','0','0','0','0','/',0}; - static const WCHAR invalid_url4[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/',0}; - static const WCHAR invalid_url5[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','/',0}; - static const WCHAR invalid_url6[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','0','/',0}; static const WCHAR cooked_urlW[] = {'h','t','t','p',':','/','/', 'l','o','c','a','l','h','o','s','t',':','5','0','0','0','0','/','f','o','o','b','a','r',0};
@@ -879,12 +887,6 @@ static void test_HttpCreateServerSession(void) HTTPAPI_VERSION version; ULONG ret;
- if (!pHttpCreateServerSession || !pHttpCloseServerSession) - { - skip("HttpCreateServerSession() is not supported.\n"); - return; - } - version.HttpApiMajorVersion = 1; version.HttpApiMinorVersion = 0; ret = pHttpCreateServerSession(version, NULL, 0); @@ -925,12 +927,6 @@ static void test_HttpCreateUrlGroup(void) HTTPAPI_VERSION version; ULONG ret;
- if (!pHttpCreateUrlGroup) - { - skip("HttpCreateUrlGroup is not supported.\n"); - return; - } - group_id = 1; ret = pHttpCreateUrlGroup(0, &group_id, 0); ok(ret == ERROR_INVALID_PARAMETER, "Unexpected return value %u.\n", ret); @@ -970,6 +966,289 @@ static void test_HttpCreateUrlGroup(void) ok(!ret, "Unexpected return value %u.\n", ret); }
+static void test_v2_server(void) +{ + static const WCHAR cooked_urlW[] = {'h','t','t','p',':','/','/', + 'l','o','c','a','l','h','o','s','t',':','5','0','0','0','0','/','f','o','o','b','a','r',0}; + + char DECLSPEC_ALIGN(8) req_buffer[2048], response_buffer[2048]; + HTTP_REQUEST_V2 *reqv2 = (HTTP_REQUEST_V2 *)req_buffer; + static const HTTPAPI_VERSION version = {2, 0}; + struct sockaddr_in sockaddr, *sin; + HTTP_REQUEST_V1 *req = &reqv2->s; + HTTP_SERVER_SESSION_ID session; + HTTP_RESPONSE_V2 response = {}; + HTTP_BINDING_INFO binding; + HTTP_URL_GROUP_ID group; + unsigned int i; + OVERLAPPED ovl; + DWORD ret_size; + HANDLE queue; + ULONG ret; + SOCKET s; + int len; + + ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL); + memset(req_buffer, 0xcc, sizeof(req_buffer)); + + ret = pHttpCreateServerSession(version, &session, 0); + ok(!ret, "Failed to create session, error %u.\n", ret); + ret = pHttpCreateUrlGroup(session, &group, 0); + ok(!ret, "Failed to create URL group, error %u.\n", ret); + ret = pHttpCreateRequestQueue(version, NULL, NULL, 0, &queue); + ok(!ret, "Failed to create request queue, error %u.\n", ret); + binding.Flags.Present = 1; + binding.RequestQueueHandle = queue; + ret = pHttpSetUrlGroupProperty(group, HttpServerBindingProperty, &binding, sizeof(binding)); + ok(!ret, "Failed to bind request queue, error %u.\n", ret); + + ret = HttpReceiveHttpRequest(NULL, HTTP_NULL_ID, 0, (HTTP_REQUEST *)req, sizeof(req_buffer), NULL, &ovl); + ok(ret == ERROR_INVALID_HANDLE, "Got error %u.\n", ret); + ret = HttpReceiveHttpRequest(queue, 0xdeadbeef, 0, (HTTP_REQUEST *)req, sizeof(req_buffer), NULL, &ovl); + ok(ret == ERROR_CONNECTION_INVALID, "Got error %u.\n", ret); + ret = HttpReceiveHttpRequest(queue, HTTP_NULL_ID, 0, (HTTP_REQUEST *)req, sizeof(req_buffer), NULL, &ovl); + ok(ret == ERROR_IO_PENDING, "Got error %u.\n", ret); + + SetLastError(0xdeadbeef); + ret = GetOverlappedResult(queue, &ovl, &ret_size, FALSE); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_IO_INCOMPLETE, "Got error %u.\n", GetLastError()); + + ret = pHttpAddUrlToUrlGroup(group, localhost_urlW, 0xdeadbeef, 0); + ok(!ret, "Got error %u.\n", ret); + ret = pHttpAddUrlToUrlGroup(group, invalid_url1, 0xdeadbeef, 0); + todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret); + ret = pHttpAddUrlToUrlGroup(group, invalid_url2, 0xdeadbeef, 0); + todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret); + ret = pHttpAddUrlToUrlGroup(group, invalid_url3, 0xdeadbeef, 0); + todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret); + ret = pHttpAddUrlToUrlGroup(group, invalid_url4, 0xdeadbeef, 0); + todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret); + ret = pHttpAddUrlToUrlGroup(group, invalid_url5, 0xdeadbeef, 0); + todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret); + ret = pHttpAddUrlToUrlGroup(group, invalid_url6, 0xdeadbeef, 0); + todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret); + ret = pHttpAddUrlToUrlGroup(group, localhost_urlW, 0xdeadbeef, 0); + todo_wine ok(ret == ERROR_ALREADY_EXISTS, "Got error %u.\n", ret); + ret = pHttpAddUrlToUrlGroup(group, localhost_url2W, 0xdeadbeef, 0); + todo_wine ok(!ret, "Got error %u.\n", ret); + + s = create_client_socket(); + len = sizeof(sockaddr); + ret = getsockname(s, (struct sockaddr *)&sockaddr, &len); + ok(ret == 0, "getsockname() failed, error %u.\n", WSAGetLastError()); + + SetLastError(0xdeadbeef); + ret = GetOverlappedResult(queue, &ovl, &ret_size, FALSE); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_IO_INCOMPLETE, "Got error %u.\n", GetLastError()); + + ret = send(s, simple_req, strlen(simple_req), 0); + ok(ret == strlen(simple_req), "send() returned %d.\n", ret); + + ret = GetOverlappedResult(queue, &ovl, &ret_size, TRUE); + ok(ret, "Got error %u.\n", GetLastError()); + ok(ret_size > sizeof(*req), "Got size %u.\n", ret_size); + Sleep(100); + + ok(!req->Flags, "Got flags %#x.\n", req->Flags); + ok(req->ConnectionId, "Expected nonzero connection ID.\n"); + ok(req->RequestId, "Expected nonzero connection ID.\n"); + ok(req->UrlContext == 0xdeadbeef, "Got URL context %s.\n", wine_dbgstr_longlong(req->UrlContext)); + ok(req->Version.MajorVersion == 1, "Got major version %u.\n", req->Version.MajorVersion); + ok(req->Version.MinorVersion == 1, "Got major version %u.\n", req->Version.MinorVersion); + ok(req->Verb == HttpVerbGET, "Got verb %u.\n", req->Verb); + ok(!req->UnknownVerbLength, "Got unknown verb length %u.\n", req->UnknownVerbLength); + ok(req->RawUrlLength == 7, "Got raw URL length %u.\n", req->RawUrlLength); + ok(!req->pUnknownVerb, "Got unknown verb %s.\n", req->pUnknownVerb); + ok(!strcmp(req->pRawUrl, "/foobar"), "Got raw URL %s.\n", req->pRawUrl); + ok(req->CookedUrl.FullUrlLength == 58, "Got full URL length %u.\n", req->CookedUrl.FullUrlLength); + ok(req->CookedUrl.HostLength == 30, "Got host length %u.\n", req->CookedUrl.HostLength); + ok(req->CookedUrl.AbsPathLength == 14, "Got absolute path length %u.\n", req->CookedUrl.AbsPathLength); + ok(!req->CookedUrl.QueryStringLength, "Got query string length %u.\n", req->CookedUrl.QueryStringLength); + ok(!wcscmp(req->CookedUrl.pFullUrl, cooked_urlW), "Got full URL %s.\n", wine_dbgstr_w(req->CookedUrl.pFullUrl)); + ok(req->CookedUrl.pHost == req->CookedUrl.pFullUrl + 7, "Got host %s.\n", wine_dbgstr_w(req->CookedUrl.pHost)); + ok(req->CookedUrl.pAbsPath == req->CookedUrl.pFullUrl + 22, + "Got absolute path %s.\n", wine_dbgstr_w(req->CookedUrl.pAbsPath)); + ok(!req->CookedUrl.pQueryString, "Got query string %s.\n", wine_dbgstr_w(req->CookedUrl.pQueryString)); + ok(!memcmp(req->Address.pRemoteAddress, &sockaddr, len), "Client addresses didn't match.\n"); + sin = (SOCKADDR_IN *)req->Address.pLocalAddress; + ok(sin->sin_family == AF_INET, "Got family %u.\n", sin->sin_family); + ok(ntohs(sin->sin_port) == 50000, "Got wrong port %u.\n", ntohs(sin->sin_port)); + ok(sin->sin_addr.S_un.S_addr == inet_addr("127.0.0.1"), "Got address %08x.\n", sin->sin_addr.S_un.S_addr); + ok(!req->Headers.UnknownHeaderCount, "Got %u unknown headers.\n", req->Headers.UnknownHeaderCount); + ok(!req->Headers.pUnknownHeaders, "Got unknown headers %p.\n", req->Headers.pUnknownHeaders); + for (i = 0; i < ARRAY_SIZE(req->Headers.KnownHeaders); ++i) + { + if (i == HttpHeaderConnection) + { + ok(req->Headers.KnownHeaders[i].RawValueLength == 10, "Got length %u.\n", + req->Headers.KnownHeaders[i].RawValueLength); + ok(!strcmp(req->Headers.KnownHeaders[i].pRawValue, "keep-alive"), + "Got connection '%s'.\n", req->Headers.KnownHeaders[i].pRawValue); + } + else if (i == HttpHeaderHost) + { + ok(req->Headers.KnownHeaders[i].RawValueLength == 15, "Got length %u.\n", + req->Headers.KnownHeaders[i].RawValueLength); + ok(!strcmp(req->Headers.KnownHeaders[i].pRawValue, "localhost:50000"), + "Got connection '%s'.\n", req->Headers.KnownHeaders[i].pRawValue); + } + else if (i == HttpHeaderUserAgent) + { + ok(req->Headers.KnownHeaders[i].RawValueLength == 4, "Got length %u.\n", + req->Headers.KnownHeaders[i].RawValueLength); + ok(!strcmp(req->Headers.KnownHeaders[i].pRawValue, "WINE"), + "Got connection '%s'.\n", req->Headers.KnownHeaders[i].pRawValue); + } + else + { + ok(!req->Headers.KnownHeaders[i].RawValueLength, "Header %#x: got length %u.\n", + i, req->Headers.KnownHeaders[i].RawValueLength); + ok(!req->Headers.KnownHeaders[i].pRawValue, "Header %#x: got value '%s'.\n", + i, req->Headers.KnownHeaders[i].pRawValue); + } + } + ok(req->BytesReceived == strlen(simple_req), "Got %s bytes.\n", wine_dbgstr_longlong(req->BytesReceived)); + ok(!req->EntityChunkCount, "Got %u entity chunks.\n", req->EntityChunkCount); + ok(!req->pEntityChunks, "Got entity chunks %p.\n", req->pEntityChunks); + ok(!req->RawConnectionId, "Got SSL connection ID %s.\n", wine_dbgstr_longlong(req->RawConnectionId)); + ok(!req->pSslInfo, "Got SSL info %p.\n", req->pSslInfo); + ok(!reqv2->RequestInfoCount, "Got request info count %u.\n", reqv2->RequestInfoCount); + ok(!reqv2->pRequestInfo, "Got request info %p.\n", reqv2->pRequestInfo); + + response.s.StatusCode = 418; + response.s.pReason = "I'm a teapot"; + response.s.ReasonLength = 12; + response.s.Headers.KnownHeaders[HttpHeaderRetryAfter].pRawValue = "120"; + response.s.Headers.KnownHeaders[HttpHeaderRetryAfter].RawValueLength = 3; + ret = HttpSendHttpResponse(queue, 0xdeadbeef, 0, (HTTP_RESPONSE *)&response, NULL, NULL, NULL, 0, &ovl, NULL); + ok(ret == ERROR_CONNECTION_INVALID, "Got error %u.\n", ret); + ret = HttpSendHttpResponse(queue, req->RequestId, 0, (HTTP_RESPONSE *)&response, NULL, NULL, NULL, 0, &ovl, NULL); + ok(!ret, "Got error %u.\n", ret); + ret = GetOverlappedResult(queue, &ovl, &ret_size, FALSE); + ok(ret, "Got error %u.\n", GetLastError()); + + ret = recv(s, response_buffer, sizeof(response_buffer), 0); + ok(ret == ret_size, "Expected size %u, got %u.\n", ret_size, ret); + + if (winetest_debug > 1) + trace("%.*s\n", ret, response_buffer); + + ok(!strncmp(response_buffer, "HTTP/1.1 418 I'm a teapot\r\n", 27), "Got incorrect status line.\n"); + ok(!!strstr(response_buffer, "\r\nRetry-After: 120\r\n"), "Missing or malformed Retry-After header.\n"); + ok(!!strstr(response_buffer, "\r\nDate:"), "Missing Date header.\n"); + + ret = HttpReceiveHttpRequest(queue, req->RequestId, 0, (HTTP_REQUEST *)req, sizeof(req_buffer), NULL, &ovl); + ok(ret == ERROR_CONNECTION_INVALID, "Got error %u.\n", ret); + + ret = pHttpRemoveUrlFromUrlGroup(group, localhost_urlW, 0); + ok(!ret, "Got error %u.\n", ret); + ret = pHttpRemoveUrlFromUrlGroup(group, localhost_urlW, 0); + ok(ret == ERROR_FILE_NOT_FOUND, "Got error %u.\n", ret); + ret = pHttpRemoveUrlFromUrlGroup(group, localhost_url2W, 0); + todo_wine ok(!ret, "Got error %u.\n", ret); + + closesocket(s); + CloseHandle(ovl.hEvent); + ret = pHttpCloseRequestQueue(queue); + ok(!ret, "Failed to close queue handle, error %u.\n", ret); + ret = pHttpCloseUrlGroup(group); + ok(!ret, "Failed to close group, error %u.\n", ret); + ret = pHttpCloseServerSession(session); + ok(!ret, "Failed to close group, error %u.\n", ret); +} + +static void test_v2_completion_port(void) +{ + char DECLSPEC_ALIGN(8) req_buffer[2048], response_buffer[2048]; + HTTP_REQUEST_V2 *req = (HTTP_REQUEST_V2 *)req_buffer; + static const HTTPAPI_VERSION version = {2, 0}; + HTTP_SERVER_SESSION_ID session; + HTTP_RESPONSE_V2 response = {}; + HTTP_BINDING_INFO binding; + HTTP_URL_GROUP_ID group; + OVERLAPPED ovl, *povl; + HANDLE queue, port; + DWORD ret_size; + ULONG_PTR key; + ULONG ret; + SOCKET s; + + ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL); + + ret = pHttpCreateServerSession(version, &session, 0); + ok(!ret, "Failed to create session, error %u.\n", ret); + ret = pHttpCreateUrlGroup(session, &group, 0); + ok(!ret, "Failed to create URL group, error %u.\n", ret); + ret = pHttpCreateRequestQueue(version, NULL, NULL, 0, &queue); + ok(!ret, "Failed to create request queue, error %u.\n", ret); + binding.Flags.Present = 1; + binding.RequestQueueHandle = queue; + ret = pHttpSetUrlGroupProperty(group, HttpServerBindingProperty, &binding, sizeof(binding)); + ok(!ret, "Failed to bind request queue, error %u.\n", ret); + + port = CreateIoCompletionPort(queue, NULL, 123, 0); + ok(!!port, "Failed to create completion port, error %u.\n", GetLastError()); + + ret = GetQueuedCompletionStatus(port, &ret_size, &key, &povl, 0); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == WAIT_TIMEOUT, "Got error %u.\n", GetLastError()); + + ret = HttpReceiveHttpRequest(queue, HTTP_NULL_ID, 0, (HTTP_REQUEST *)req, sizeof(req_buffer), NULL, &ovl); + ok(ret == ERROR_IO_PENDING, "Got error %u.\n", ret); + + ret = pHttpAddUrlToUrlGroup(group, localhost_urlW, 0, 0); + ok(!ret, "Got error %u.\n", ret); + + s = create_client_socket(); + + ret = GetQueuedCompletionStatus(port, &ret_size, &key, &povl, 0); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == WAIT_TIMEOUT, "Got error %u.\n", GetLastError()); + + ret = send(s, simple_req, strlen(simple_req), 0); + ok(ret == strlen(simple_req), "send() returned %d.\n", ret); + + ret_size = key = 0xdeadbeef; + ret = GetQueuedCompletionStatus(port, &ret_size, &key, &povl, 1000); + ok(ret, "Got error %u.\n", GetLastError()); + ok(povl == &ovl, "OVERLAPPED pointers didn't match.\n"); + ok(key == 123, "Got unexpected key %lu.\n", key); + ok(ret_size > sizeof(*req), "Got size %u.\n", ret_size); + + ret = GetQueuedCompletionStatus(port, &ret_size, &key, &povl, 0); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == WAIT_TIMEOUT, "Got error %u.\n", GetLastError()); + + response.s.StatusCode = 418; + response.s.pReason = "I'm a teapot"; + response.s.ReasonLength = 12; + ret = HttpSendHttpResponse(queue, req->s.RequestId, 0, (HTTP_RESPONSE *)&response, NULL, NULL, NULL, 0, &ovl, NULL); + ok(!ret, "Got error %u.\n", ret); + + ret_size = key = 0xdeadbeef; + ret = GetQueuedCompletionStatus(port, &ret_size, &key, &povl, 1000); + ok(ret, "Got error %u.\n", GetLastError()); + ok(povl == &ovl, "OVERLAPPED pointers didn't match.\n"); + ok(key == 123, "Got unexpected key %lu.\n", key); + + ret = recv(s, response_buffer, sizeof(response_buffer), 0); + ok(ret == ret_size, "Expected size %u, got %u.\n", ret_size, ret); + + ret = pHttpRemoveUrlFromUrlGroup(group, localhost_urlW, 0); + ok(!ret, "Got error %u.\n", ret); + closesocket(s); + CloseHandle(port); + CloseHandle(ovl.hEvent); + ret = pHttpCloseRequestQueue(queue); + ok(!ret, "Failed to close queue handle, error %u.\n", ret); + ret = pHttpCloseUrlGroup(group); + ok(!ret, "Failed to close group, error %u.\n", ret); + ret = pHttpCloseServerSession(session); + ok(!ret, "Failed to close group, error %u.\n", ret); +} + START_TEST(httpapi) { HTTPAPI_VERSION version = { 1, 0 }; @@ -991,9 +1270,21 @@ START_TEST(httpapi) test_v1_bad_request(); test_v1_cooked_url(); test_v1_unknown_tokens(); - test_HttpCreateServerSession(); - test_HttpCreateUrlGroup();
ret = HttpTerminate(HTTP_INITIALIZE_SERVER, NULL); ok(!ret, "Failed to terminate, ret %u.\n", ret); + + version.HttpApiMajorVersion = 2; + if (!HttpInitialize(version, HTTP_INITIALIZE_SERVER, NULL)) + { + test_HttpCreateServerSession(); + test_HttpCreateUrlGroup(); + test_v2_server(); + test_v2_completion_port(); + + ret = HttpTerminate(HTTP_INITIALIZE_SERVER, NULL); + ok(!ret, "Failed to terminate, ret %u.\n", ret); + } + else + win_skip("Version 2 is not supported.\n"); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=56010
Your paranoid android.
=== debian10 (32 bit Japanese:Japan report) ===
httpapi: httpapi.c:1202: Test failed: Got error 31. httpapi.c:87: Test failed: Failed to connect socket, error 10061. httpapi.c:1211: Test failed: send() returned -1. httpapi.c:1215: Test failed: Got error 258. httpapi.c:1216: Test failed: OVERLAPPED pointers didn't match. httpapi.c:1217: Test failed: Got unexpected key 3735928559. httpapi.c:1228: Test failed: Got error 1229. httpapi.c:1232: Test failed: Got error 1229. httpapi.c:1240: Test failed: Got error 2.
=== debian10 (32 bit WoW report) ===
httpapi: httpapi.c:402: Test failed: Got error 31. httpapi.c:87: Test failed: Failed to connect socket, error 10061. httpapi.c:416: Test failed: send() returned -1. httpapi.c:419: Test failed: Got 258. httpapi.c:87: Test failed: Failed to connect socket, error 10061. httpapi.c:425: Test failed: send() returned -1. httpapi.c:428: Test failed: Got 258. httpapi.c:430: Test failed: Got 258. httpapi.c:434: Test failed: Client addresses didn't match. Unhandled exception: page fault on read access to 0x203a6874 in 32-bit code (0xf7c28a3a).
Report errors: httpapi:httpapi crashed (c0000005)
On 8/29/19 8:36 PM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=56010
Your paranoid android.
=== debian10 (32 bit Japanese:Japan report) ===
httpapi: httpapi.c:1202: Test failed: Got error 31. httpapi.c:87: Test failed: Failed to connect socket, error 10061. httpapi.c:1211: Test failed: send() returned -1. httpapi.c:1215: Test failed: Got error 258. httpapi.c:1216: Test failed: OVERLAPPED pointers didn't match. httpapi.c:1217: Test failed: Got unexpected key 3735928559. httpapi.c:1228: Test failed: Got error 1229. httpapi.c:1232: Test failed: Got error 1229. httpapi.c:1240: Test failed: Got error 2.
=== debian10 (32 bit WoW report) ===
httpapi: httpapi.c:402: Test failed: Got error 31. httpapi.c:87: Test failed: Failed to connect socket, error 10061. httpapi.c:416: Test failed: send() returned -1. httpapi.c:419: Test failed: Got 258. httpapi.c:87: Test failed: Failed to connect socket, error 10061. httpapi.c:425: Test failed: send() returned -1. httpapi.c:428: Test failed: Got 258. httpapi.c:430: Test failed: Got 258. httpapi.c:434: Test failed: Client addresses didn't match. Unhandled exception: page fault on read access to 0x203a6874 in 32-bit code (0xf7c28a3a).
Report errors: httpapi:httpapi crashed (c0000005)
These are both caused by bind() returning WSAEADDRINUSE, and I doubt they're caused by these patches (cf. [1]). I don't know why bind() is returning WSAEADDRINUSE; I can't reproduce it locally. I don't know enough about the implementation of sockets, and I can't find anything of the man pages, but is it possible that this is returned if bind() is called too soon after a connection is closed?
[1] http://test.winehq.org/data/e54f1cf9fba1ae8748e8e5c577530138baaf9e3d/index_L...
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/httpapi/httpapi_main.c | 13 ------------- 1 file changed, 13 deletions(-)
diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c index 20405d9ea3e..100aac2639d 100644 --- a/dlls/httpapi/httpapi_main.c +++ b/dlls/httpapi/httpapi_main.c @@ -37,19 +37,6 @@ static WCHAR *heap_strdupW(const WCHAR *str) return ret; }
-BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID lpv ) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( hinst ); - break; - } - return TRUE; -} - /*********************************************************************** * HttpInitialize (HTTPAPI.@) *