Skip to content

Commit

Permalink
_WireReader.read() should make flags a dns.flags.Flag [Issue #606]
Browse files Browse the repository at this point in the history
  • Loading branch information
rthalley committed Jan 4, 2021
1 parent 00b5754 commit 14bbb9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dns/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ def read(self):
self.parser.get_struct('!HHHHHH')
factory = _message_factory_from_opcode(dns.opcode.from_flags(flags))
self.message = factory(id=id)
self.message.flags = flags
self.message.flags = dns.flags.Flag(flags)
self.initialize_message(self.message)
self.one_rr_per_rrset = \
self.message._get_one_rr_per_rrset(self.one_rr_per_rrset)
Expand Down
5 changes: 5 additions & 0 deletions tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,11 @@ def test_bad_text_rrs(self):
IN SOA
''')

def test_from_wire_makes_Flag(self):
m = dns.message.from_wire(goodwire)
self.assertIsInstance(m.flags, dns.flags.Flag)
self.assertEqual(m.flags, dns.flags.Flag.RD)


if __name__ == '__main__':
unittest.main()

0 comments on commit 14bbb9c

Please sign in to comment.