projects/aports·blob master · refs

34 lines · 1.0 KiB

1Patch by Robin Mueller
2
3The strftime method of the libmusl writes 'UTC' instead of 'GMT' when
4the character Z is used in the format pattern, and it looks like the
5S3 clients don't like 'UTC' in the date strings.
6
7This patch replaces 'UTC' with 'GMT' at the relevant location.
8
9--- a/src/rgw/rgw_rest.cc 2021-07-08 16:03:56.000000000 +0200
10+++ b/src/rgw/rgw_rest.cc 2021-08-19 09:48:30.339492024 +0200
11@@ -436,8 +436,21 @@
12 return 0;
13 }
14
15- return strftime(timestr, sizeof(timestr),
16- "%a, %d %b %Y %H:%M:%S %Z", tmp);
17+ size_t len = strftime(timestr, sizeof(timestr),
18+ "%a, %d %b %Y %H:%M:%S %Z", tmp);
19+
20+ int position = 0;
21+ while (timestr[position] != 'U' && len - position > 3)
22+ position++;
23+
24+ if (len - position == 3) {
25+ char substr[4];
26+ memcpy(substr, &timestr[position], 4);
27+
28+ if (strcmp(substr, "UTC") == 0)
29+ memcpy(&timestr[position], "GMT", 3);
30+ }
31+ return len;
32 }
33
34 void dump_time_header(struct req_state *s, const char *name, real_time t)