RecordItems iterator stops on mismatching record type #1
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mikedilger/resolv-rs#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
All sections can carry records of different type; the iterator should skip all records with different type.
Right now it returns
None(through the.ok()call at the end), which is the "universal" stop signal for iterators.The most important case for this is when iterating over the answer section which contains a CNAME (usually as the first record in the section).
The iterator should also either returns the parse errors (after skipping the records with different type) or skip broken records; returning
Noneis again not a good option.Thanks for finding this. By way of explanation, I coded this library for a project that a client cancelled, so it may not have much real world exposure yet, hence bugs like this.
Can you check if the code on the 'fix1' branch fixes this for you? I don't easily have access to the situation you describe. Thanks.
I'll try to test it later, but it looks good so far regarding my original issue. Small nit: if the lower level parse error should lead to aborting the sequence you might want to set index to len before returning
None.I can confirm it fixes the issue. If you want to try yourself, query e.g. for
mail.google.com- for me this returns this in the answer section (i.e. mixed types):I just updated to 0.1.4 and published.
Thanks for fixing, and thanks for providing the crate in the first place.
I decided to roll my own iterator anyway (because I really wanted "proper" error handling), and build an
AddressRecordtrait on top ofRecordData. See https://github.com/stbuehler/rust-alookup/blob/master/src/resolv_ext.rs if you're interested.