]> git.cworth.org Git - notmuch/commit
lib: replace the header parser with gmime
authorJani Nikula <jani@nikula.org>
Sun, 30 Mar 2014 21:21:49 +0000 (00:21 +0300)
committerDavid Bremner <david@tethera.net>
Sat, 5 Apr 2014 15:53:04 +0000 (12:53 -0300)
commit473930bb6fb167078a9428ad85f53accf7d4559f
tree4cdf734de80569e918ff29116a0419f2ab66f4b4
parent6812136bf576d894591606d9e10096719054d1f9
lib: replace the header parser with gmime

The notmuch library includes a full blown message header parser. Yet
the same message headers are parsed by gmime during indexing. Switch
to gmime parsing completely.

These are the main changes:

* Gmime stops header parsing at the first invalid header, and presumes
  the message body starts from there. The current parser is quite
  liberal in accepting broken headers. The change means we will be
  much pickier about accepting invalid messages.

* The current parser converts tabs used in header folding to
  spaces. Gmime preserve the tabs. Due to a broken python library used
  in mailman, there are plenty of mailing lists that produce headers
  with tabs in header folding, and we'll see plenty of tabs. (This
  change has been mitigated in preparatory patches.)

* For pure header parsing, the current parser is likely faster than
  gmime, which parses the whole message rather than just the
  headers. Since we parse the message and its headers using gmime for
  indexing anyway, this avoids and extra header parsing round when
  adding new messages. In case of duplicate messages, we'll end up
  parsing the full message although just headers would be
  sufficient. All in all this should still speed up 'notmuch new'.

* Calls to notmuch_message_get_header() may be slightly slower than
  previously for headers that are not indexed in the database, due to
  parsing of the whole message. Within the notmuch code base, notmuch
  reply is the only such user.
lib/database.cc
lib/index.cc
lib/message-file.c
lib/notmuch-private.h