aboutsummaryrefslogtreecommitdiff
path: root/src/Uri.cpp
AgeCommit message (Collapse)Author
2018-07-23Add copy constructor and assignment operatorRichard Walters
2018-07-04Fix bug in IPv6Address validationRichard Walters
A trailing group which is definitely not an IPv4Address needs to be counted. Detect this as the state being IN_GROUP_NOT_IPV4 after the end of the string.
2018-07-04RefactoringRichard Walters
Assign names to states in the IPv6Address validation routine
2018-07-04Fix bugs in IPv6 address parsingRichard Walters
* Multiple colons should not be accepted in state 4. * After parsing a digit group and encountering a colon, we need allow either another colon or the beginning of either another group or an IPv4 address. Add state 5 to handle this.
2018-07-04Normalize IPv6 addresses when generating URI stringsRichard Walters
2018-07-04Percent-encode if necessary any elements when generating stringsRichard Walters
2018-07-04Fix requirementsRichard Walters
Query and fragment may be empty but present in a URI. Handle this in the same way that port is handled: include a flag for each of query and fragment, to allow an empty but present query/fragment.
2018-07-04Add capability of setting other elementsRichard Walters
* userinfo * port (hasPort) * path * fragment Also include these element when generating string from URI.
2018-07-04Add GenerateString (incomplete)Richard Walters
Add methods to set scheme, host, and query elements. Add ability to generate URI strings out of scheme, host, and query elements. This does not yet support userinfo, port, or fragment elements.
2018-07-04Fix bug in truncated host elementsRichard Walters
For example, "[::1", where the square bracket at the end is missing. Handle truncated host element by checking the state we end up in after the entire string is parsed. Some states represent interal elements of a host name or address, and so if we're still in those states and run out of input characters, the input string was cut off early.
2018-07-04Fix bug in parsing out IPv6 and IPvFuture addressesRichard Walters
Don't include the square brackets in the parsed out host string; they are only there for delimiting them inside of an overall URI string.
2018-07-04Validate IPv6 addressesRichard Walters
* Add ValidateIpv6Address. * Add ValidateIpv4Address (since an IPv6 address is allowed to contain an IPv4 address for compatibility) * Add ValidateOctet (used by ValidateIpv4Address).
2018-07-04RefactoringRichard Walters
* Extract CanNavigatePathUpOneLevel from NormalizePath. * Add comments to explain what's going on elsewhere in NormalizePath.
2018-07-04Add missing "ok" return values in extracted methodsRichard Walters
2018-07-04Give names to states in host/port parsing state machineRichard Walters
2018-07-04RefactoringRichard Walters
* Extract methods to copy various elements of one URI from another. * Push NormalizePath implementation into a private method. * Simplify and consolidate checks for absolute paths. * Extract methods out of individual steps of ParseFromString.
2018-07-03Document parts of the path normalization processRichard Walters
Add comments that link parts of the code back to lines of the pseudocode in the RFC, to make the code easier to understand.
2018-07-03Complete rewrite of NormalizePathRichard Walters
The former algorithm was based on the pseuocode from the RFC, which is hard to follow, more suitable when the path is in a single string, not a sequence of segments. The new algorithm uses two flags: * isAbsolute - recognize that if the path starts out as an absolute path, it needs to stay that way. * atDirectoryLevel - recognize that if we encounter a "." or "..", then it will be reduced by simply discarding it or going back/up one stop, but then we will be in a "directory" context, meaning that should we end the path at this point, there needs to be an empty-string segment to mark that the end of the path is reaching into a directory, not just referring to the directory.
2018-07-02Add reference resolution and attempt to fix path normalizationRichard Walters
Path normalization is hideously broken for now.
2018-07-02Allow default move semanticsRichard Walters
2018-07-02Recognize special case of absolute URI with empty pathRichard Walters
Such a URI should be considered equivalent to a path of "/" because in both cases the path is an absolute path.
2018-07-02Add more path normalization tests and fix a bug in itRichard Walters
For normalization "step 2C", if the output path was empty, we don't want to pop the end of it off.
2018-07-02Add capability to compare Uri objects.Richard Walters
* Code the neat example in section 6.2.2 of the RFC. * Add equality/inequality operators for Uri.
2018-07-02Add NormalizePath methodRichard Walters
2018-07-02RefactoringRichard Walters
Extract methods that parse the query and fragment.
2018-07-02RefactoringRichard Walters
* Replaced the more formal "state machine" used in URI elements that may have percent-encoded characters, with a simpler loop with a flag and a few conditional logic paths. * Extracted the parsing of the above types of elements into a common method, DecodeElement. * Kept DecodeQueryOrFragment around, in order to prevent having to repeat the name of the allowed character set which is common between query and fragment; however the function is now just a very thin wrapper.
2018-07-01RefactoringRichard Walters
* Remove IsCharacterInSet function
2018-07-01Rename IsCharacterInSet module to CharacterSetRichard Walters
2018-07-01Normalize scheme and reg-name elements to lower caseRichard Walters
2018-07-01Allow HEXDIG to include lower-case 'a'..'f'Richard Walters
2018-07-01RefactoringRichard Walters
Added CharacterSet as a class to represent character sets, allowing us to build singletons and composite character sets more concisely.
2018-07-01RefactoringRichard Walters
* Extract IsCharacterInSet to its own module. * Extract PercentEncodedCharacterDecoder to its own module.
2018-07-01RefactoringRichard Walters
Remove state 3 hole in host/port parsing state machine
2018-07-01RefactoringRichard Walters
Extract percent-encoded character decoding, so that the logic is all in one class that is reused.
2018-07-01Added missing documentationRichard Walters
2018-07-01Check for illegal characters in query and fragment elementsRichard Walters
2018-07-01Check for illegal characters in path segmentsRichard Walters
2018-07-01Fix second bug in scheme delimiter searchingRichard Walters
Path may also have colon, so make sure we don't scan into the path element if there is one.
2018-07-01Handle bad host namesRichard Walters
* Detect bad characters in host names. * Incorporate splitting host and port into the state machine that is parsing/decoding the host. NOTE: IPv6address is not checked for bad characters yet. More research is needed to learn exactly what are the various ways to write an IPv6 address.
2018-07-01Fix bug in parsing schemeRichard Walters
A colon may be in the authority, if present, so limit the search for scheme delimiter so we aren't scanning the authority part, when parsing the scheme.
2018-07-01Handle bad characters in UserInfoRichard Walters
2018-06-30RefactoringRichard Walters
Extracted IsCharacterInSet function
2018-06-30Add code to check that scheme, if present, is legalRichard Walters
2018-06-30RefactoringRichard Walters
Extract method ParseAuthority
2018-06-30RefactoringRichard Walters
Extract method that parses the path segments from the whole path string.
2018-06-30RefactoringRichard Walters
* Extract function that parses 16-bit unsigned integers, to use in parsing port element. * Clean up and clarify what parts of the original URI string are still being held onto at various points in the code.
2018-06-30Fix bug in not clearing userInfo when there is no authorityRichard Walters
2018-06-30Add more element parsing of URIsRichard Walters
* Add IsRelativeReference. * Add IsRelativePath. * Add Query. * Add Fragment. * Add UserInfo. * Fix parsing of URIs that have no scheme.
2018-06-30Add support for port and hasPort elementsRichard Walters
2018-06-30Uri: fix mistakes from last sessionRichard Walters
* Parts of a path are called "segments", not "steps", in the RFC. * The RFC specifies that path separators are always forward slashes, so don't support other separators.