The URL should not be set if the URL cannot be added to a request queue.
Signed-off-by: Julian Klemann jklemann@codeweavers.com --- v2: No change. --- dlls/httpapi/httpapi_main.c | 11 ++++++++--- dlls/httpapi/tests/httpapi.c | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c index 4d2d307ffcb..a5f8007b0a9 100644 --- a/dlls/httpapi/httpapi_main.c +++ b/dlls/httpapi/httpapi_main.c @@ -686,6 +686,7 @@ 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); + ULONG ret;
TRACE("id %s, url %s, context %s, reserved %#lx.\n", wine_dbgstr_longlong(id), debugstr_w(url), wine_dbgstr_longlong(context), reserved); @@ -696,13 +697,17 @@ ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, 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))) return ERROR_OUTOFMEMORY; group->context = context;
- if (group->queue) - return add_url(group->queue, url, context); - return ERROR_SUCCESS; }
diff --git a/dlls/httpapi/tests/httpapi.c b/dlls/httpapi/tests/httpapi.c index d231fd1d8ed..3c3f7abcd90 100644 --- a/dlls/httpapi/tests/httpapi.c +++ b/dlls/httpapi/tests/httpapi.c @@ -1268,8 +1268,8 @@ static void test_v2_bound_port(void)
s = socket(AF_INET, SOCK_STREAM, 0); ret = connect(s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)); - todo_wine ok(ret, "Connecting to socket succeeded, %lu.\n", GetLastError()); - todo_wine ok(GetLastError() == WSAECONNREFUSED, "Unexpected error connecting to socket, %lu.\n", GetLastError()); + ok(ret, "Connecting to socket succeeded, %lu.\n", GetLastError()); + ok(GetLastError() == WSAECONNREFUSED, "Unexpected error connecting to socket, %lu.\n", GetLastError());
closesocket(s); ret = pHttpCloseRequestQueue(dummy_queue);