summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-12 19:33:54 -0400
committerJune McEnroe <june@causal.agency>2020-04-12 19:33:54 -0400
commit0cffffbb9453d8026b2dbdb6a342bdf641cfa687 (patch)
tree0f0f9be31184efe6e650a19ca04534ac9936a816
parentMangle message IDs in paths (diff)
downloadbubger-0cffffbb9453d8026b2dbdb6a342bdf641cfa687.tar.gz
bubger-0cffffbb9453d8026b2dbdb6a342bdf641cfa687.zip
Allow missing DOW and obsolete zone in date
Diffstat (limited to '')
-rw-r--r--parse.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index 33acd5b..6f1a56b 100644
--- a/parse.c
+++ b/parse.c
@@ -14,6 +14,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
+#include <ctype.h>
 #include <err.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -66,7 +67,16 @@ void parseEnvelope(struct Envelope *envelope, struct List list) {
 	}
 
 	const char *date = dataCheck(list.ptr[Date], String).string;
-	date = strptime(date, "%a, %e %b %Y %H:%M:%S %z", &envelope->date);
+	if (isalpha(date[0])) {
+		date = strptime(date, "%a, %e %b %Y %H:%M:%S ", &envelope->date);
+	} else {
+		date = strptime(date, "%e %b %Y %H:%M:%S ", &envelope->date);
+	}
+	if (date && (date[0] == '+' || date[0] == '-')) {
+		date = strptime(date, "%z", &envelope->date);
+	} else if (date) {
+		date = strptime(date, "%Z", &envelope->date);
+	}
 	if (!date) errx(EX_PROTOCOL, "invalid envelope date format");
 
 	envelope->date.tm_isdst = -1;