abhishek-ram / pyas2-lib

AS2 Library for building and parsing Messages and MDNs
GNU General Public License v3.0
42 stars 27 forks source link

Preserve Enveloped Data Content Headers #35

Closed derekmwright closed 2 years ago

derekmwright commented 2 years ago

Noticed an issue when using mendelson AS2 and this lib that the data returned from msg.payload.get_payload() was not encoding back to utf-8 properly. This appears to be due to the headers being completely overwritten on the enveloped data structure. I've created a work-around for now that addresses the issue and allows us to cleanly parse/save the test message coming from mendelson AS2 with UTF-8 encoding.

Reference: https://github.com/abhishek-ram/pyas2-lib/blob/master/pyas2lib/as2.py#L657-L660

I'm still not sure I agree with taking the outer-most envelopes headers and smooshing them into the encapsulated messages headers as the integrity of the original transmitted message has been compromised. Instead we may want to think about assigning those original headers to an instance var if we need to reference them later on. But thats another issue :)

PR Incoming