httpapi: Implement HttpCreateServerSession() and HttpCloseServerSession().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
efacf6f455
commit
76eb42a760
|
@ -23,6 +23,7 @@
|
|||
#include "winternl.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(httpapi);
|
||||
|
||||
|
@ -470,13 +471,48 @@ ULONG WINAPI HttpSendHttpResponse(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags,
|
|||
return ret;
|
||||
}
|
||||
|
||||
struct server_session
|
||||
{
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
static struct list server_sessions = LIST_INIT(server_sessions);
|
||||
|
||||
static struct server_session *get_server_session(HTTP_SERVER_SESSION_ID id)
|
||||
{
|
||||
struct server_session *session;
|
||||
LIST_FOR_EACH_ENTRY(session, &server_sessions, struct server_session, entry)
|
||||
{
|
||||
if ((HTTP_SERVER_SESSION_ID)(ULONG_PTR)session == id)
|
||||
return session;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* HttpCreateServerSession (HTTPAPI.@)
|
||||
*/
|
||||
ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION version, HTTP_SERVER_SESSION_ID *id, ULONG reserved)
|
||||
{
|
||||
FIXME( "({%d,%d}, %p, %d): stub!\n", version.HttpApiMajorVersion, version.HttpApiMinorVersion, id, reserved );
|
||||
return ERROR_ACCESS_DENIED;
|
||||
struct server_session *session;
|
||||
|
||||
TRACE("version %u.%u, id %p, reserved %u.\n", version.HttpApiMajorVersion,
|
||||
version.HttpApiMinorVersion, id, reserved);
|
||||
|
||||
if (!id)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if ((version.HttpApiMajorVersion != 1 && version.HttpApiMajorVersion != 2)
|
||||
|| version.HttpApiMinorVersion)
|
||||
return ERROR_REVISION_MISMATCH;
|
||||
|
||||
if (!(session = heap_alloc(sizeof(*session))))
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
list_add_tail(&server_sessions, &session->entry);
|
||||
|
||||
*id = (ULONG_PTR)session;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -484,6 +520,14 @@ ULONG WINAPI HttpCreateServerSession( HTTPAPI_VERSION version, HTTP_SERVER_SESSI
|
|||
*/
|
||||
ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id)
|
||||
{
|
||||
FIXME( "(%s): stub!\n", wine_dbgstr_longlong(id));
|
||||
struct server_session *session;
|
||||
|
||||
TRACE("id %s.\n", wine_dbgstr_longlong(id));
|
||||
|
||||
if (!(session = get_server_session(id)))
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
list_remove(&session->entry);
|
||||
heap_free(session);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -888,37 +888,30 @@ static void test_HttpCreateServerSession(void)
|
|||
version.HttpApiMajorVersion = 1;
|
||||
version.HttpApiMinorVersion = 0;
|
||||
ret = pHttpCreateServerSession(version, NULL, 0);
|
||||
todo_wine
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "Unexpected return value %u.\n", ret);
|
||||
|
||||
version.HttpApiMajorVersion = 1;
|
||||
version.HttpApiMinorVersion = 1;
|
||||
ret = pHttpCreateServerSession(version, &session, 0);
|
||||
todo_wine
|
||||
ok(ret == ERROR_REVISION_MISMATCH, "Unexpected return value %u.\n", ret);
|
||||
|
||||
version.HttpApiMajorVersion = 3;
|
||||
version.HttpApiMinorVersion = 0;
|
||||
ret = pHttpCreateServerSession(version, &session, 0);
|
||||
todo_wine
|
||||
ok(ret == ERROR_REVISION_MISMATCH, "Unexpected return value %u.\n", ret);
|
||||
|
||||
version.HttpApiMajorVersion = 2;
|
||||
version.HttpApiMinorVersion = 0;
|
||||
ret = pHttpCreateServerSession(version, &session, 0);
|
||||
todo_wine
|
||||
ok(!ret, "Unexpected return value %u.\n", ret);
|
||||
ret = pHttpCloseServerSession(session);
|
||||
todo_wine
|
||||
ok(!ret, "Unexpected return value %u.\n", ret);
|
||||
|
||||
version.HttpApiMajorVersion = 1;
|
||||
version.HttpApiMinorVersion = 0;
|
||||
ret = pHttpCreateServerSession(version, &session, 0);
|
||||
todo_wine
|
||||
ok(!ret, "Unexpected return value %u.\n", ret);
|
||||
ret = pHttpCloseServerSession(session);
|
||||
todo_wine
|
||||
ok(!ret, "Unexpected return value %u.\n", ret);
|
||||
|
||||
ret = pHttpCloseServerSession(0xdead);
|
||||
|
|
|
@ -398,9 +398,9 @@ typedef struct _HTTP_LOG_DATA
|
|||
} HTTP_LOG_DATA, *PHTTP_LOG_DATA;
|
||||
|
||||
ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID);
|
||||
ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id);
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue