Closed chasehere closed 5 years ago
I've reduced the tests and tried to make them closer to the tests in the package. Note that fix tag 212 needs to be present for the first test to pass.
def test_parser_nonfix_string(self):
"""Test parsing non-FIX message."""
parser = FixParser()
parser.append_buffer(b"8=FIX.4.2\x01212=26\x01213=<RTRF>8=FIX.4.2\x0110=161\x01</RTRF>\x0110=143\x01")
msg = parser.get_message()
self.assertIsNotNone(msg)
self.assertEqual(b"FIX.4.2", msg.get(8))
self.assertEqual(b"143", msg.get(10))
return
def test_parser_partial_nonfix_string(self):
"""Test parsing incomplete non-FIX message."""
parser = FixParser()
parser.append_buffer(b"8=FIX.4.2\x01212=26\x01213=<RTRF>8=FIX.4")
msg = parser.get_message()
self.assertIsNone(msg)
parser.append_buffer(b".2\x0110=161\x01</RTRF>\x0110=143\x01")
msg = parser.get_message()
self.assertIsNotNone(msg)
self.assertEqual(b"FIX.4.2", msg.get(8))
self.assertEqual(b"143", msg.get(10))
return
Thanks for the report. I'll have a look at this later today. At first glance, I think you're right: it's a bug.
The problem is that the parsed raw length value (from XmlDataLen (212) in this case) is reset to zero when get_message()
is called. Because 212 is in part1
and 213 is in part2
, the parsed length of the XML field (481) is lost.
So -- confirmed as a bug.
See release v1.0.12, which contains this fix.
The CME sends execution reports over drop copy with the format:
If this message is split inside the XML then FixParser will interpret 10=XXX as the end of the message instead of 10=YYY.
Test Case: