folz / bento

:bento: A fast, correct, pure-Elixir library for reading and writing Bencoded metainfo (.torrent) files.
Mozilla Public License 2.0
95 stars 14 forks source link

added check for lexicographical ordering of keys when decoding dictionaries in Bento.Parser #31

Open ifoo opened 1 year ago

ifoo commented 1 year ago

I'm not sure if you want to add this, as it might break parsing of malformed dictionaries. On the one hand, dictionary keys that are not ordered are clearly defined as invalid in the spec. On the other hand, we might want the parser to be liberal. Best case would be the have an option (like strict: true) in the parsers function. Bento.decode already has opts, but Bento.Parser does not and I didn't want to break the API.