| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 958da45 commit 484c4f6
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + Copyright 2023 Ada authors | ||
| 2 | + | ||
| 3 | + Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 4 | + this software and associated documentation files (the "Software"), to deal in | ||
| 5 | + the Software without restriction, including without limitation the rights to | ||
| 6 | + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 7 | + the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 8 | + subject to the following conditions: | ||
| 9 | + | ||
| 10 | + The above copyright notice and this permission notice shall be included in all | ||
| 11 | + copies or substantial portions of the Software. | ||
| 12 | + | ||
| 13 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 14 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 15 | + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 16 | + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 17 | + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 18 | + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - /* auto-generated on 2023-02-06 08:25:59 -0500. Do not edit! */ | ||
| 1 | + /* auto-generated on 2023-02-07 17:26:54 -0500. Do not edit! */ | ||
| 2 | 2 | // dofile: invoked with prepath=/Users/yagiz/Developer/url-parser/src, filename=ada.cpp | |
| 3 | 3 | /* begin file src/ada.cpp */ | |
| 4 | 4 | #include "ada.h" | |
@@ -970,6 +970,13 @@ namespace ada::helpers { | |||
| 970 | 970 | } while (true); | |
| 971 | 971 | } | |
| 972 | 972 | } | |
| 973 | + | ||
| 974 | + ada_really_inline void strip_trailing_spaces_from_opaque_path(ada::url& url) noexcept { | ||
| 975 | + if (!url.has_opaque_path) return; | ||
| 976 | + if (url.fragment.has_value()) return; | ||
| 977 | + if (url.query.has_value()) return; | ||
| 978 | + while (!url.path.empty() && url.path.back() == ' ') { url.path.resize(url.path.size()-1); } | ||
| 979 | + } | ||
| 973 | 980 | } // namespace ada::helpers | |
| 974 | 981 | ||
| 975 | 982 | namespace ada { | |
@@ -1650,7 +1657,7 @@ namespace ada { | |||
| 1650 | 1657 | void url::set_hash(const std::string_view input) { | |
| 1651 | 1658 | if (input.empty()) { | |
| 1652 | 1659 | fragment = std::nullopt; | |
| 1653 | - // TODO: Potentially strip trailing spaces from an opaque path with this. | ||
| 1660 | + helpers::strip_trailing_spaces_from_opaque_path(*this); | ||
| 1654 | 1661 | return; | |
| 1655 | 1662 | } | |
| 1656 | 1663 | ||
@@ -1664,9 +1671,7 @@ namespace ada { | |||
| 1664 | 1671 | void url::set_search(const std::string_view input) { | |
| 1665 | 1672 | if (input.empty()) { | |
| 1666 | 1673 | query = std::nullopt; | |
| 1667 | - // Empty this’s query object’s list. | ||
| 1668 | - // @todo Implement this if/when we have URLSearchParams. | ||
| 1669 | - // Potentially strip trailing spaces from an opaque path with this. | ||
| 1674 | + helpers::strip_trailing_spaces_from_opaque_path(*this); | ||
| 1670 | 1675 | return; | |
| 1671 | 1676 | } | |
| 1672 | 1677 | ||
@@ -1679,10 +1684,6 @@ namespace ada { | |||
| 1679 | 1684 | ada::character_sets::QUERY_PERCENT_ENCODE; | |
| 1680 | 1685 | ||
| 1681 | 1686 | query = ada::unicode::percent_encode(std::string_view(new_value), query_percent_encode_set); | |
| 1682 | - | ||
| 1683 | - // Set this’s query object’s list to the result of parsing input. | ||
| 1684 | - // @todo Implement this if/when we have URLSearchParams. | ||
| 1685 | - return ; | ||
| 1686 | 1687 | } | |
| 1687 | 1688 | ||
| 1688 | 1689 | bool url::set_pathname(const std::string_view input) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - /* auto-generated on 2023-02-06 08:25:59 -0500. Do not edit! */ | ||
| 1 | + /* auto-generated on 2023-02-07 17:26:54 -0500. Do not edit! */ | ||
| 2 | 2 | // dofile: invoked with prepath=/Users/yagiz/Developer/url-parser/include, filename=ada.h | |
| 3 | 3 | /* begin file include/ada.h */ | |
| 4 | 4 | /** | |
@@ -1774,6 +1774,11 @@ namespace ada::helpers { | |||
| 1774 | 1774 | */ | |
| 1775 | 1775 | ada_really_inline void trim_c0_whitespace(std::string_view& input) noexcept; | |
| 1776 | 1776 | ||
| 1777 | + /** | ||
| 1778 | + * @see https://url.spec.whatwg.org/#potentially-strip-trailing-spaces-from-an-opaque-path | ||
| 1779 | + */ | ||
| 1780 | + ada_really_inline void strip_trailing_spaces_from_opaque_path(ada::url& url) noexcept; | ||
| 1781 | + | ||
| 1777 | 1782 | } // namespace ada::helpers | |
| 1778 | 1783 | ||
| 1779 | 1784 | #endif // ADA_HELPERS_H | |
@@ -4328,14 +4333,14 @@ namespace ada { | |||
| 4328 | 4333 | #ifndef ADA_ADA_VERSION_H | |
| 4329 | 4334 | #define ADA_ADA_VERSION_H | |
| 4330 | 4335 | ||
| 4331 | - #define ADA_VERSION "1.0.0" | ||
| 4336 | + #define ADA_VERSION "1.0.1" | ||
| 4332 | 4337 | ||
| 4333 | 4338 | namespace ada { | |
| 4334 | 4339 | ||
| 4335 | 4340 | enum { | |
| 4336 | 4341 | ADA_VERSION_MAJOR = 1, | |
| 4337 | 4342 | ADA_VERSION_MINOR = 0, | |
| 4338 | - ADA_VERSION_REVISION = 0, | ||
| 4343 | + ADA_VERSION_REVISION = 1, | ||
| 4339 | 4344 | }; | |
| 4340 | 4345 | ||
| 4341 | 4346 | } // namespace ada | |
| Back | FazBrowse Home | New Git URL |
0 commit comments