Commit db3ba1d7 authored by Julian Klemann's avatar Julian Klemann Committed by Alexandre Julliard

httpapi: Stop setting group->url if add_url() fails.

The URL should not be set if the URL cannot be added to a request queue. Signed-off-by: 's avatarJulian Klemann <jklemann@codeweavers.com> Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3b91c7c5
...@@ -686,6 +686,7 @@ ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, ...@@ -686,6 +686,7 @@ ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url,
HTTP_URL_CONTEXT context, ULONG reserved) HTTP_URL_CONTEXT context, ULONG reserved)
{ {
struct url_group *group = get_url_group(id); struct url_group *group = get_url_group(id);
ULONG ret;
TRACE("id %s, url %s, context %s, reserved %#lx.\n", wine_dbgstr_longlong(id), TRACE("id %s, url %s, context %s, reserved %#lx.\n", wine_dbgstr_longlong(id),
debugstr_w(url), wine_dbgstr_longlong(context), reserved); debugstr_w(url), wine_dbgstr_longlong(context), reserved);
...@@ -696,13 +697,17 @@ ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, ...@@ -696,13 +697,17 @@ ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url,
return ERROR_CALL_NOT_IMPLEMENTED; return ERROR_CALL_NOT_IMPLEMENTED;
} }
if (group->queue)
{
ret = add_url(group->queue, url, context);
if (ret)
return ret;
}
if (!(group->url = heap_strdupW(url))) if (!(group->url = heap_strdupW(url)))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
group->context = context; group->context = context;
if (group->queue)
return add_url(group->queue, url, context);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
......
...@@ -1268,8 +1268,8 @@ static void test_v2_bound_port(void) ...@@ -1268,8 +1268,8 @@ static void test_v2_bound_port(void)
s = socket(AF_INET, SOCK_STREAM, 0); s = socket(AF_INET, SOCK_STREAM, 0);
ret = connect(s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)); ret = connect(s, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
todo_wine ok(ret, "Connecting to socket succeeded, %lu.\n", GetLastError()); ok(ret, "Connecting to socket succeeded, %lu.\n", GetLastError());
todo_wine ok(GetLastError() == WSAECONNREFUSED, "Unexpected error connecting to socket, %lu.\n", GetLastError()); ok(GetLastError() == WSAECONNREFUSED, "Unexpected error connecting to socket, %lu.\n", GetLastError());
closesocket(s); closesocket(s);
ret = pHttpCloseRequestQueue(dummy_queue); ret = pHttpCloseRequestQueue(dummy_queue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment