← Commit list

d1317b5d4a

Daniel Stenberg
Daniel Stenberg
2026-09-21
SUCCESS Duration: 394s

Subject

parsedate: remove the unused leading three letters

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/parsedate.c+9 -7
@@ -103,10 +103,6 @@ const char * const Curl_month[] = {
#define PARSEDATE_SOONER 2
#endif
-static const char * const weekday[] = {
- "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
-};
-
struct tzinfo {
uint32_t tz;
int16_t offset; /* +/- in minutes */
@@ -248,10 +244,16 @@ UNITTEST int checkday(const char *check, size_t len)
break;
}
if((len > 3) && (day != -1)) {
- /* when more than three letters are provided, verify the full name case
+ /* when more than three letters are provided, verify the tail name case
insensitively */
- size_t wlen = strlen(weekday[day]);
- if((len != wlen) || !curl_strnequal(&check[3], &weekday[day][3], len - 3))
+ static const char * const daysuffix[] = {
+ /* without the leading three letters */
+ "day", "sday", "nesday", "rsday", "day", "urday", "day"
+ };
+
+ size_t wlen = strlen(daysuffix[day]);
+ if(((len - 3) != wlen) ||
+ !curl_strnequal(&check[3], daysuffix[day], wlen))
return -1;
}
return day;
tests/libtest/lib517.c+4 -0
@@ -32,6 +32,10 @@ static CURLcode test_lib517(const char *URL)
static const struct dcheck dates[] = {
{ "Sat May 5 GMT 11:56:27 2035", 2061978987 },
+ { "Sat, May 5 GMT 11:56:27 2035", 2061978987 },
+ { "Saturday, May 5 GMT 11:56:27 2035", 2061978987 },
+ { "Saturdax, May 5 GMT 11:56:27 2035", -1 },
+ { "Saturda, May 5 GMT 11:56:27 2035", -1 },
{ "Sun, 06 Nov 1994 08:49:37 GMT", 784111777 },
{ "Sunday, 06-Nov-94 08:49:37 GMT", 784111777 },
{ "Sun Nov 6 08:49:37 1994", 784111777 },