Feature #4324
openFaceUri: per-scheme parsing
40%
Description
Currently, FaceUri
parses a string with a set of regular expressions, but performs canonization with per-scheme logic. This causes FaceUri
to incorrectly accept invalid input in several occasions.
This issue is to refactor FaceUri
to have per-scheme parsing logic, and reject invalid input during parsing instead of during canonization.
Updated by Junxiao Shi about 7 years ago
- Blocks Bug #3896: FaceUri::parse doesn't reject some invalid unix:// URIs added
Updated by Junxiao Shi about 7 years ago
- Blocks Bug #3897: FaceUri::canonize doesn't always validate the port number added
Updated by Junxiao Shi about 7 years ago
- Blocks Bug #4100: FaceUri::parse doesn't reject IPv4 addresses with v6 scheme (and vice versa) added
Updated by Davide Pesavento about 7 years ago
I've been working on a rewritten FaceUri parser in a local branch, as a low priority task. The actual parsing (splitting the input string into URI components) is shared across all schemes, and follows RFC 3986 as closely as possible. After the parsing there is a validation step, which is scheme-specific.
Updated by Davide Pesavento about 7 years ago
- Status changed from New to In Progress
- Assignee set to Davide Pesavento
- % Done changed from 0 to 40
WIP change: https://gerrit.named-data.net/4281
Updated by Junxiao Shi about 7 years ago
I reviewed https://gerrit.named-data.net/4281 patchset-2.
I like that the parsing steps is cleaner.
I dislike that "validate" functions and "canonize" classes are separate. They should be together. A "scheme handler" (formerly "canonize provider") handles one or more schemes, and does both validation and canonization for these schemes. Each has its own file such as src/net/face-uri-udp.*
, and registers itself using a macro similar to NFD's strategy. Shared functions, such as IP address validation, can be placed in base classes.
Updated by Davide Pesavento about 7 years ago
Junxiao Shi wrote:
I dislike that "validate" functions and "canonize" classes are separate. They should be together.
I haven't touched canonization at all (yet).
Several checks performed by canonization are now redundant with the new parsing algorithm. I plan to remove this duplication. However, a larger refactoring such as the one you propose should be deferred to a separate commit, to make reviewing easier.
Each has its own file such as src/net/face-uri-udp.*, and registers itself using a macro [...]
I'm mildly against splitting into multiple files. The per-scheme logic is a relatively small amount of code.
Updated by Junxiao Shi about 7 years ago
a larger refactoring such as the one you propose should be deferred to a separate commit, to make reviewing easier.
In contrast, the end result of this refactoring is mostly new code, so I'd rather review them as new code.
I'm mildly against splitting into multiple files. The per-scheme logic is a relatively small amount of code.
CanonizeProvider
classes, altogether, are too long. Small files are easier to navigate.
Updated by Junxiao Shi almost 7 years ago
- Related to Bug #4474: FaceUri throws "Malformed URI" for IPv6 UDP multicast address added
Updated by Davide Pesavento almost 5 years ago
- Target version changed from v0.7 to 0.8.0
Updated by Davide Pesavento over 3 years ago
- Target version changed from 0.8.0 to 0.9.0