<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10069">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">syncami: wrap utf-8 string before parsing<br><br>For some reason in some older versions of Python directly passing a utf-8 string<br>to HeaderParser's parsestr method would not parse the data correctly. However,<br>wrapping it in a StringIO object first works for all versions.<br><br>Change-Id: I24af2df707983accc9298da095c018b1aaf963e3<br>---<br>M lib/python/asterisk/syncami.py<br>1 file changed, 5 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/lib/python/asterisk/syncami.py b/lib/python/asterisk/syncami.py</span><br><span>index 5482400..917e9e4 100644</span><br><span>--- a/lib/python/asterisk/syncami.py</span><br><span>+++ b/lib/python/asterisk/syncami.py</span><br><span>@@ -15,6 +15,7 @@</span><br><span> # python 3 import</span><br><span> from urllib.parse import urlencode</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+from StringIO import StringIO</span><br><span> from email.parser import HeaderParser</span><br><span> try:</span><br><span> from httplib import *</span><br><span>@@ -93,7 +94,8 @@</span><br><span> if res.status != 200:</span><br><span> raise InvalidAMIResponse(res)</span><br><span> self.cookie = res.getheader('set-cookie', None)</span><br><span style="color: hsl(0, 100%, 40%);">- data = res.read().decode('utf-8')</span><br><span style="color: hsl(0, 100%, 40%);">- parser = HeaderParser()</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return parser.parsestr(data)</span><br><span style="color: hsl(120, 100%, 40%);">+ data = StringIO(res.read().decode('utf-8', 'ignore'))</span><br><span style="color: hsl(120, 100%, 40%);">+ res = HeaderParser().parse(data)</span><br><span style="color: hsl(120, 100%, 40%);">+ data.close()</span><br><span style="color: hsl(120, 100%, 40%);">+ return res</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10069">change 10069</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10069"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I24af2df707983accc9298da095c018b1aaf963e3 </div>
<div style="display:none"> Gerrit-Change-Number: 10069 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>