From 5a23afb34dc69f407f62eadcc7ee70b7e7c73c6a Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 15 Nov 2024 11:29:01 +0100 Subject: [PATCH] wininet: Accept UTC as the equivalent of GMT. Based on a patch by Etaash Mathamsetty. --- dlls/wininet/http.c | 6 +++--- dlls/wininet/tests/internet.c | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 38f6575c1fd..cc9b89d1129 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -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; diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index c432de9e488..f2579c4993a 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -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);