9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: theinicke@bss-wf.de, 9front@9front.org
Subject: Re: [9front] [Bug] [PATCH] Mail cannot cope with multi-line header fields
Date: Sat, 12 Sep 2020 15:58:45 -0700	[thread overview]
Message-ID: <5021098071C7A58059D67139EDC43A44@eigenstate.org> (raw)
In-Reply-To: <E5B90C9FB0641679CAAC6A91690E70ED@bss-wf.de>

> Then the simplest way to do that might be something like the following (remove all line breaks from info fields, preserving it everywhere else).
> But maybe we would like to take into account the fact that some info fields never contain line breaks or remove them not just in info file but earlier by stripping them in copy822,..

I think I like your idea of doing it in copy822. How's this?

diff -r 9f6e77258f69 sys/src/cmd/upas/fs/mbox.c
--- a/sys/src/cmd/upas/fs/mbox.c	Thu Sep 10 16:26:42 2020 -0700
+++ b/sys/src/cmd/upas/fs/mbox.c	Sat Sep 12 15:57:45 2020 -0700
@@ -733,6 +733,19 @@
 }
 
 static char*
+unfold(char *s)
+{
+	char *p, *q;
+
+	q = s;
+	for(p = q; *p != '\0'; p++)
+		if(*p != '\r' && *p != '\n')
+			*q++ = *p;
+	*q = '\0';
+	return s;
+}
+
+static char*
 addr822(char *p, char **ac)
 {
 	int n, c, space, incomment, addrdone, inanticomment, quoted;
@@ -883,7 +896,7 @@
 static char*
 copy822(Message*, Header *h, char*, char *p)
 {
-	return rtrim(strdup(skipwhite(p + h->len)));
+	return rtrim(unfold(strdup(skipwhite(p + h->len))));
 }
 
 static char*



  parent reply	other threads:[~2020-09-12 22:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 19:33 theinicke
2020-09-09 19:50 ` [9front] " ori
2020-09-10  6:27   ` theinicke
2020-09-10 19:58     ` theinicke
2020-09-10 21:12       ` ori
2020-09-11 21:08         ` theinicke
2020-09-12 21:19           ` theinicke
2020-09-12 22:58           ` ori [this message]
2020-09-14 21:49             ` theinicke
2020-09-17 23:01               ` ori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5021098071C7A58059D67139EDC43A44@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    --cc=theinicke@bss-wf.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).