httpapi: Implement HttpAddUrlToUrlGroup() and HttpRemoveUrlFromUrlGroup().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-08-29 19:58:05 -05:00 committed by Alexandre Julliard
parent f0458b2148
commit f18e026e51
3 changed files with 82 additions and 9 deletions

View File

@ -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

View File

@ -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);
@ -622,5 +637,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;
}

View File

@ -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);