[PATCH 0/4] some more mailinfo cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 11, 2020 at 08:17:30AM -0800, Junio C Hamano wrote:

> Jeff King <peff@xxxxxxxx> writes:
> 
> > Something like the (largely untested) patch below. That would also make
> > it easy to support arbitrary amounts of whitespace after the header,
> > which I think are allowed by the standard (whereas now we'd parse
> > "Content-type:    text/plain" as "    text/plain", which is silly).
> >
> > Worth doing?
> 
> The result does look cleaner.  I do not think we've seen much
> polishing in this area of the code for quite a long time, which
> might indicate that what we have may be good enough, but at the same
> time it would mean it is quiescent time for the code and it is safe
> to clean it up.

Yeah, it feels a little like code churn. It's not like we ever add new
headers to match. But I doodled the series below while I was in a
meeting, and it does fix one tiny user-visible bug (that I don't think
anybody has ever noticed or complained about), so maybe it's worth
doing. ;)

This is on top of rs/strbuf-insertstr, since it relies on 517b60564e
(mailinfo: don't insert header prefix for handle_content_type(),
2020-02-10).

  [1/4]: mailinfo: treat header values as C strings
  [2/4]: mailinfo: simplify parsing of header values
  [3/4]: mailinfo: be more liberal with header whitespace
  [4/4]: mailinfo: factor out some repeated header handling

 mailinfo.c          | 62 +++++++++++++++++++++++++++------------------
 t/t5100-mailinfo.sh | 15 +++++++++++
 2 files changed, 52 insertions(+), 25 deletions(-)

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux