Change header callback to bytes, but default Milter to convert

to str with surrogateescape.
This commit is contained in:
Stuart D. Gathman
2019-08-27 21:47:26 -04:00
parent 18186a3c11
commit 4749f0ff98
3 changed files with 23 additions and 3 deletions
+7
View File
@@ -701,6 +701,13 @@ def connect_callback(ctx,hostname,family,hostaddr,nr_mask=P_NR_CONN):
m._setctx(ctx)
return m.connect(hostname,family,hostaddr)
## @private
# @brief check str/bytes decorator and invoke header method.
def header_callback(ctx,fld,val):
m = ctx.getpriv()
s = val.decode(encoding='ascii',errors='surrogateescape')
return m.header(fld,s)
## @private
# @brief Disconnect milterContext and call close method.
def close_callback(ctx):