diff options
| author | Barry Warsaw | 2012-03-13 21:03:01 -0700 |
|---|---|---|
| committer | Barry Warsaw | 2012-03-13 21:03:01 -0700 |
| commit | 80ac803cb2816dde0503671fd117ed134680de53 (patch) | |
| tree | ed2d40855f6b45dedf421a7a98bd83d95b6e3b40 /src/mailman/archiving/prototype.py | |
| parent | 07685642934fe934098927a9a9d20c17080f3dab (diff) | |
| download | mailman-80ac803cb2816dde0503671fd117ed134680de53.tar.gz mailman-80ac803cb2816dde0503671fd117ed134680de53.tar.zst mailman-80ac803cb2816dde0503671fd117ed134680de53.zip | |
* The LMTP server now requires that the incoming message have a `Message-ID`,
otherwise it rejects the message with a 550 error. Also, the LMTP server
adds the `X-Message-ID-Hash` header automatically. The `inject` cli
command will also add the `X-Message-ID-Hash` header, but it will craft a
`Message-ID` header first if one is missing from the injected text. Also,
`inject` will always set the correct value for the `original_size`
attribute on the message object, instead of trusting a possibly incorrect
value if it's already set. The individual `IArchiver` implementations no
longer set the `X-Message-ID-Hash` header.
Diffstat (limited to 'src/mailman/archiving/prototype.py')
| -rw-r--r-- | src/mailman/archiving/prototype.py | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/mailman/archiving/prototype.py b/src/mailman/archiving/prototype.py index 0a857fd77..55d78074e 100644 --- a/src/mailman/archiving/prototype.py +++ b/src/mailman/archiving/prototype.py @@ -25,9 +25,6 @@ __all__ = [ ] -import hashlib - -from base64 import b32encode from urlparse import urljoin from zope.interface import implements @@ -54,20 +51,12 @@ class Prototype: @staticmethod def permalink(mlist, msg): """See `IArchiver`.""" - message_id = msg.get('message-id') - # It is not the archiver's job to ensure the message has a Message-ID. - # If this header is missing, there is no permalink. - if message_id is None: + # It is the LMTP server's responsibility to ensure that the message + # has a X-Message-ID-Hash header. If it doesn't then there's no + # permalink. + message_id_hash = msg.get('x-message-id-hash') + if message_id_hash is None: return None - # The angle brackets are not part of the Message-ID. See RFC 2822. - if message_id.startswith('<') and message_id.endswith('>'): - message_id = message_id[1:-1] - else: - message_id = message_id.strip() - digest = hashlib.sha1(message_id).digest() - message_id_hash = b32encode(digest) - del msg['x-message-id-hash'] - msg['X-Message-ID-Hash'] = message_id_hash return urljoin(Prototype.list_url(mlist), message_id_hash) @staticmethod |
