summaryrefslogtreecommitdiff
path: root/skip/ceph/11-dump_time_header_impl.patch
blob: d19e7ed596afa7252954f3a1e439844b9ffd1923 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Patch by Robin Mueller

The strftime method of the libmusl writes 'UTC' instead of 'GMT' when
the character Z is used in the format pattern, and it looks like the
S3 clients don't like 'UTC' in the date strings.

This patch replaces 'UTC' with 'GMT' at the relevant location.

--- a/src/rgw/rgw_rest.cc	2021-07-08 16:03:56.000000000 +0200
+++ b/src/rgw/rgw_rest.cc	2021-08-19 09:48:30.339492024 +0200
@@ -436,8 +436,21 @@
     return 0;
   }
 
-  return strftime(timestr, sizeof(timestr),
-                  "%a, %d %b %Y %H:%M:%S %Z", tmp);
+  size_t len = strftime(timestr, sizeof(timestr),
+                        "%a, %d %b %Y %H:%M:%S %Z", tmp);
+
+  int position = 0;
+  while (timestr[position] != 'U' && len - position > 3)
+    position++;
+
+  if (len - position == 3) {
+    char substr[4];
+    memcpy(substr, &timestr[position], 4);
+
+    if (strcmp(substr, "UTC") == 0)
+      memcpy(&timestr[position], "GMT", 3);
+  }
+  return len;
 }
 
 void dump_time_header(struct req_state *s, const char *name, real_time t)