Relaxing a few checks

Julien ÉLIE julien at
Sat Apr 1 14:41:18 UTC 2017

Hi Kamil,

> I wrote another patch.
> This collect empty header names, and if there is any, add
> X-Mailpost-Empty-Hdrs field (with collected names) to post.

It is indeed another solution, that has the advantage of keeping
trace of the removal of empty header fields.

In your patch:

  $emptyhdrs=join(", " , @emptyHdrs);
  while (length ($emptyhdrs) >975 ){ #998-length "X-Mailpost-Empty-Hdrs: ")

Instead of stripping a possible too long line, why not keep all
the header field names and use folding?

For instance with:

  $emptyhdrs=join("\n\t" , @emptyHdrs);

I think it would make the code simpler, and permit to keep everything.

Of course, if you fear one may inject overlong header field names,
it is possible to retain only "normal" ones with a truncation or
an additional condition.  For instance:

  push (@emptyHdrs, substr($1, 0, 975));
  push (@emptyHdrs, $1) if length($1) < 975;

when filling the array.  Maybe the truncation is the better solution.

Julien ÉLIE

« Mais pourquoi courent-ils si vite ? Pour gagner du temps ! Comme
  le temps, c'est de l'argent… plus ils courent vite, plus ils en
  gagnent. » (Raymond Devos)

More information about the inn-workers mailing list