wininet: Accept UTC as the equivalent of GMT.

Based on a patch by Etaash Mathamsetty.
This commit is contained in:
Hans Leidekker 2024-11-15 11:29:01 +01:00 committed by Alexandre Julliard
parent 6a01532899
commit 5a23afb34d
Notes: Alexandre Julliard 2024-11-15 22:24:54 +01:00
Approved-by: Jacek Caban (@jacek)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6823
2 changed files with 8 additions and 3 deletions

View file

@ -4521,7 +4521,7 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft)
/* asctime() doesn't report a timezone, but some web servers do, so accept
* with or without GMT.
*/
if (*ptr && wcscmp(ptr, L"GMT"))
if (*ptr && (wcscmp(ptr, L"GMT") && wcscmp(ptr, L"UTC")))
{
ERR("unexpected timezone %s\n", debugstr_w(ptr));
return FALSE;
@ -4598,7 +4598,7 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft)
while (iswspace(*ptr))
ptr++;
if (wcscmp(ptr, L"GMT"))
if (wcscmp(ptr, L"GMT") && wcscmp(ptr, L"UTC"))
{
ERR("unexpected time zone %s\n", debugstr_w(ptr));
return FALSE;
@ -4715,7 +4715,7 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft)
while (iswspace(*ptr))
ptr++;
if (wcscmp(ptr, L"GMT"))
if (wcscmp(ptr, L"GMT") && wcscmp(ptr, L"UTC"))
{
ERR("unexpected time zone %s\n", debugstr_w(ptr));
return FALSE;

View file

@ -1116,9 +1116,11 @@ static void test_InternetTimeToSystemTime(void)
test_data[] =
{
{ "Fri, 07 Jan 2005 12:06:35 GMT", &expect1, TRUE },
{ "Fri, 07 Jan 2005 12:06:35 UTC", &expect1, TRUE },
{ " fri, 7 jan 2005 12 06 35", &expect1, TRUE },
{ "Fri, 07-01-2005 12:06:35", &expect1, TRUE },
{ "5, 07-01-2005 12:06:35 GMT", &expect1, TRUE },
{ "5, 07-01-2005 12:06:35 UTC", &expect1, TRUE },
{ "5, 07-01-2005 12:06:35 GMT;", &expect1, TRUE },
{ "5, 07-01-2005 12:06:35 GMT123", &expect1, TRUE },
{ "2, 11 01 2022 11 13 05", &expect2, TRUE },
@ -1126,6 +1128,9 @@ static void test_InternetTimeToSystemTime(void)
{ "2, 11*01/2022 11+13=05", &expect2, TRUE },
{ "2, 11-Jan-2022 11:13:05", &expect2, TRUE },
{ "Fr", NULL, FALSE },
{ "Fri Jan 7 12:06:35 2005", &expect1, TRUE, TRUE },
{ "Fri Jan 7 12:06:35 2005 GMT", &expect1, TRUE, TRUE },
{ "Fri Jan 7 12:06:35 2005 UTC", &expect1, TRUE, TRUE },
};
ret = pInternetTimeToSystemTimeA(NULL, NULL, 0);