refactoring/integrating ARC code
This commit is contained in:
+351
-534
File diff suppressed because it is too large
Load Diff
@@ -72,7 +72,7 @@ Y+vtSBczUiKERHv1yRbcaQtZFh5wtiRrN04BLUTD21MycBX5jYchHjPY/wIDAQAB"""
|
||||
# A message verifies after being signed.
|
||||
sig_lines = dkim.arc_sign(
|
||||
self.message, b"test", b"example.com", self.key,
|
||||
"test.domain: none", dkim.CV_None)
|
||||
b"test.domain: none", dkim.CV_None)
|
||||
(cv, res, reason) = dkim.arc_verify(b''.join(sig_lines) + self.message, dnsfunc=self.dnsfunc)
|
||||
self.assertEquals(cv, dkim.CV_Pass)
|
||||
|
||||
|
||||
+8
-4
@@ -16,6 +16,8 @@
|
||||
#
|
||||
# Copyright (c) 2011 William Grant <me@williamgrant.id.au>
|
||||
|
||||
import re
|
||||
|
||||
import logging
|
||||
try:
|
||||
from logging import NullHandler
|
||||
@@ -61,12 +63,14 @@ def parse_tag_value(tag_list):
|
||||
tag_specs.pop()
|
||||
for tag_spec in tag_specs:
|
||||
try:
|
||||
key, value = tag_spec.split(b'=', 1)
|
||||
key, value = [x.strip() for x in tag_spec.split(b'=', 1)]
|
||||
except ValueError:
|
||||
raise InvalidTagSpec(tag_spec)
|
||||
if key.strip() in tags:
|
||||
raise DuplicateTag(key.strip())
|
||||
tags[key.strip()] = value.strip()
|
||||
if re.match(br'^[a-zA-Z](\w)*', key) is None:
|
||||
raise InvalidTagSpec(tag_spec)
|
||||
if key in tags:
|
||||
raise DuplicateTag(key)
|
||||
tags[key] = value
|
||||
return tags
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user