From 1011499e7a266f0f01073f2230068c83bdaa3c33 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Thu, 29 Feb 2024 17:19:24 -0500 Subject: [PATCH] Preferences should contain info needed. Persist. Privacy. --- .../chrome/browser/about_flags.cc.patch | 38 ---- .../chrome/browser/flag-metadata.json.patch | 16 -- .../chrome/browser/flag_descriptions.cc.patch | 16 -- .../chrome/browser/flag_descriptions.h.patch | 24 --- .../browser/prefs/browser_prefs.cc.patch | 36 ---- .../common/chrome_content_client.cc.patch | 17 -- .../components/cbor/writer.cc.patch | 14 -- .../120.0.6099.200/url/url_canon_ipfs.cc | 55 ------ .../120.0.6099.200/url/url_util.cc.patch | 17 -- .../chrome/browser/BUILD.gn.patch | 35 ---- ...me_autocomplete_scheme_classifier.cc.patch | 50 ------ .../chrome_content_browser_client.cc.patch | 78 -------- .../chrome/browser/ipfs_extra_parts.cc | 10 -- .../chrome/browser/ipfs_extra_parts.h | 10 -- .../components/cbor/reader.cc.patch | 44 ----- .../components/cbor/reader.h.patch | 26 --- .../components/cbor/reader_unittest.cc.patch | 47 ----- .../components/cbor/values.cc.patch | 145 --------------- .../components/cbor/values.h.patch | 79 --------- .../components/cbor/writer_unittest.cc.patch | 36 ---- .../clipboard_recent_content_generic.cc.patch | 13 -- .../net/dns/dns_config_service_linux.cc.patch | 18 -- .../weborigin/scheme_registry.cc.patch | 13 -- .../121.0.6167.57/url/BUILD.gn.patch | 32 ---- .../121.0.6167.57/url/url_canon.h.patch | 28 --- .../121.0.6167.57/url/url_util.cc.patch | 17 -- .../components/cbor/reader_unittest.cc.patch | 4 +- .../components/cbor/reader_unittest.cc.patch | 4 +- .../chrome/browser/BUILD.gn.patch | 8 +- .../chrome/browser/about_flags.cc.patch | 10 +- ...me_autocomplete_scheme_classifier.cc.patch | 0 .../chrome_content_browser_client.cc.patch | 20 +-- .../chrome/browser/flag-metadata.json.patch | 6 +- .../chrome/browser/flag_descriptions.cc.patch | 8 +- .../chrome/browser/flag_descriptions.h.patch | 8 +- .../chrome/browser/ipfs_extra_parts.cc | 0 .../chrome/browser/ipfs_extra_parts.h | 0 .../browser/prefs/browser_prefs.cc.patch | 11 +- .../common/chrome_content_client.cc.patch | 2 +- .../components/cbor/reader.cc.patch | 10 +- .../components/cbor/reader.h.patch | 14 +- .../components/cbor/reader_unittest.cc.patch | 8 +- .../components/cbor/values.cc.patch | 0 .../components/cbor/values.h.patch | 0 .../components/cbor/writer.cc.patch | 2 +- .../components/cbor/writer_unittest.cc.patch | 0 .../clipboard_recent_content_generic.cc.patch | 2 +- .../net/dns/dns_config_service_linux.cc.patch | 4 +- .../weborigin/scheme_registry.cc.patch | 0 .../url/BUILD.gn.patch | 6 +- .../url/url_canon.h.patch | 4 +- .../url/url_canon_ipfs.cc | 2 +- .../124.0.6329.0/url/url_util.cc.patch | 22 +++ cmake/inc_link.py | 2 + cmake/patch.py | 22 ++- component/README.md | 4 +- component/chromium_dns_txt_lookup.cc | 2 +- component/inter_request_state.cc | 2 +- component/interceptor.cc | 2 +- component/preferences.cc | 166 +++++++++++++----- component/preferences.h | 11 +- .../include/ipfs_client/ctx/gateway_config.h | 19 +- .../ctx/transitory_gateway_config.h | 9 +- library/include/ipfs_client/gateway_spec.h | 8 + .../include/ipfs_client/gw/gateway_request.h | 17 +- .../ipfs_client/gw/gateway_request_type.h | 24 +++ library/include/ipfs_client/gw/requestor.h | 2 +- library/src/ipfs_client/client.cc | 2 +- .../src/ipfs_client/ctx/default_gateways.cc | 56 +++--- .../ctx/transitory_gateway_config.cc | 19 +- .../ipfs_client/gw/block_request_splitter.cc | 38 ++-- .../gw/block_request_splitter_unittest.cc | 14 +- .../src/ipfs_client/gw/default_requestor.cc | 3 +- .../src/ipfs_client/gw/dnslink_requestor.cc | 5 +- library/src/ipfs_client/gw/gateway_request.cc | 151 +++++++--------- .../ipfs_client/gw/gateway_request_type.cc | 55 ++++++ .../gw/gateway_request_unittest.cc | 23 +-- library/src/ipfs_client/gw/gateway_state.cc | 62 ++++++- library/src/ipfs_client/gw/gateway_state.h | 25 ++- .../ipfs_client/gw/gateway_state_unittest.cc | 6 +- .../ipfs_client/gw/inline_request_handler.cc | 3 +- .../gw/inline_request_handler_unittest.cc | 5 +- .../ipfs_client/gw/multi_gateway_requestor.cc | 58 +++--- .../gw/multi_gateway_requestor_unittest.cc | 3 +- .../src/ipfs_client/gw/providers_response.cc | 19 +- library/src/ipfs_client/gw/requestor.cc | 3 +- .../src/ipfs_client/gw/requestor_unittest.cc | 4 +- .../ipfs_client/gw/terminating_requestor.cc | 3 +- .../gw/terminating_requestor_unittest.cc | 6 +- library/src/ipfs_client/partition.cc | 1 + library/src/ipfs_client/partition_unittest.cc | 13 +- ...fMQfetXXzHKxRrC8vTJ1xJgAbvH9VtGoLKpeD2yxKQ | 2 - ...iuvcx9rAGLddvRedV32sVPHegWR1uLGoiL7XhbmYaC | 2 - ...mFLVQs5zfHHYTyyUznhwtEc39DMjLKTY7NLoJh6FXP | 2 - ...VT4XPH5XcjrjizWe9FkARGjRCnsNvhRiLafsJK4S34 | 2 - ...TWoGMNCzw7PSDi2xaPt9nhY4XWQ8KXeZzsVjCd9mAS | 2 - ...NS1UGZA2G6mnUdcqHLEhqXup65s4ChwDvPLCrHDNrZ | 2 - ...hLdYTzkAasaeoY6UuT8Vac6z5gwh6AXqKJU4ZT9Ya3 | 2 - ...pP235kTDzk8BsspxWBkUubufmqyuw9rcqLjv5YjU7t | 2 - ...BTt9LwuSWaxauCbCwH9w48xWQGZZbmyHtBkaMj8Scf | 2 - ...u3S8gaTfRvrztrGxm1H28obp5Y48JkXLu4GnFwFdbB | 2 - ...j2ef42npaipzhrwzgmohrkrcqcchcfbjcyffxpivwu | 1 - ...vqsvzxud7oh6hdpiueubrdqd5jn2lmvjhln6uedc7i | 1 - ...rkhen653iuaxezix5bvsfrlkdcpxmjng3jeqqgzeke | 1 - ...kd3nkoo5g5xuqfxoe5sfc7nf4arvkffpimywisanpi | 1 - ...gfvdajwcqnwqit27y5xdjwqq4g2f73xf6gf6p3nro4 | 1 - test_data/include/mock_api.h | 1 + test_data/include/mock_gw_cfg.h | 16 +- 108 files changed, 674 insertions(+), 1304 deletions(-) delete mode 100644 chromium_edits/120.0.6099.200/chrome/browser/about_flags.cc.patch delete mode 100644 chromium_edits/120.0.6099.200/chrome/browser/flag-metadata.json.patch delete mode 100644 chromium_edits/120.0.6099.200/chrome/browser/flag_descriptions.cc.patch delete mode 100644 chromium_edits/120.0.6099.200/chrome/browser/flag_descriptions.h.patch delete mode 100644 chromium_edits/120.0.6099.200/chrome/browser/prefs/browser_prefs.cc.patch delete mode 100644 chromium_edits/120.0.6099.200/chrome/common/chrome_content_client.cc.patch delete mode 100644 chromium_edits/120.0.6099.200/components/cbor/writer.cc.patch delete mode 100644 chromium_edits/120.0.6099.200/url/url_canon_ipfs.cc delete mode 100644 chromium_edits/120.0.6099.200/url/url_util.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/chrome/browser/BUILD.gn.patch delete mode 100644 chromium_edits/121.0.6167.57/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/chrome/browser/chrome_content_browser_client.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/chrome/browser/ipfs_extra_parts.cc delete mode 100644 chromium_edits/121.0.6167.57/chrome/browser/ipfs_extra_parts.h delete mode 100644 chromium_edits/121.0.6167.57/components/cbor/reader.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/components/cbor/reader.h.patch delete mode 100644 chromium_edits/121.0.6167.57/components/cbor/reader_unittest.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/components/cbor/values.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/components/cbor/values.h.patch delete mode 100644 chromium_edits/121.0.6167.57/components/cbor/writer_unittest.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/net/dns/dns_config_service_linux.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch delete mode 100644 chromium_edits/121.0.6167.57/url/BUILD.gn.patch delete mode 100644 chromium_edits/121.0.6167.57/url/url_canon.h.patch delete mode 100644 chromium_edits/121.0.6167.57/url/url_util.cc.patch rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/chrome/browser/BUILD.gn.patch (77%) rename chromium_edits/{121.0.6167.57 => 124.0.6329.0}/chrome/browser/about_flags.cc.patch (88%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch (100%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/chrome/browser/chrome_content_browser_client.cc.patch (85%) rename chromium_edits/{121.0.6167.57 => 124.0.6329.0}/chrome/browser/flag-metadata.json.patch (76%) rename chromium_edits/{121.0.6167.57 => 124.0.6329.0}/chrome/browser/flag_descriptions.cc.patch (67%) rename chromium_edits/{121.0.6167.57 => 124.0.6329.0}/chrome/browser/flag_descriptions.h.patch (75%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/chrome/browser/ipfs_extra_parts.cc (100%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/chrome/browser/ipfs_extra_parts.h (100%) rename chromium_edits/{121.0.6167.57 => 124.0.6329.0}/chrome/browser/prefs/browser_prefs.cc.patch (86%) rename chromium_edits/{121.0.6167.57 => 124.0.6329.0}/chrome/common/chrome_content_client.cc.patch (94%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/components/cbor/reader.cc.patch (80%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/components/cbor/reader.h.patch (64%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/components/cbor/reader_unittest.cc.patch (88%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/components/cbor/values.cc.patch (100%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/components/cbor/values.h.patch (100%) rename chromium_edits/{121.0.6167.57 => 124.0.6329.0}/components/cbor/writer.cc.patch (91%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/components/cbor/writer_unittest.cc.patch (100%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch (95%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/net/dns/dns_config_service_linux.cc.patch (88%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch (100%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/url/BUILD.gn.patch (87%) rename chromium_edits/{120.0.6099.200 => 124.0.6329.0}/url/url_canon.h.patch (91%) rename chromium_edits/{121.0.6167.57 => 124.0.6329.0}/url/url_canon_ipfs.cc (98%) create mode 100644 chromium_edits/124.0.6329.0/url/url_util.cc.patch create mode 100644 library/include/ipfs_client/gw/gateway_request_type.h create mode 100644 library/src/ipfs_client/gw/gateway_request_type.cc delete mode 100644 test_data/blocks/QmWsfMQfetXXzHKxRrC8vTJ1xJgAbvH9VtGoLKpeD2yxKQ delete mode 100644 test_data/blocks/QmWtiuvcx9rAGLddvRedV32sVPHegWR1uLGoiL7XhbmYaC delete mode 100644 test_data/blocks/QmX5mFLVQs5zfHHYTyyUznhwtEc39DMjLKTY7NLoJh6FXP delete mode 100644 test_data/blocks/QmXFVT4XPH5XcjrjizWe9FkARGjRCnsNvhRiLafsJK4S34 delete mode 100644 test_data/blocks/QmXLTWoGMNCzw7PSDi2xaPt9nhY4XWQ8KXeZzsVjCd9mAS delete mode 100644 test_data/blocks/QmXNNS1UGZA2G6mnUdcqHLEhqXup65s4ChwDvPLCrHDNrZ delete mode 100644 test_data/blocks/QmXRhLdYTzkAasaeoY6UuT8Vac6z5gwh6AXqKJU4ZT9Ya3 delete mode 100644 test_data/blocks/QmXRpP235kTDzk8BsspxWBkUubufmqyuw9rcqLjv5YjU7t delete mode 100644 test_data/blocks/QmXXBTt9LwuSWaxauCbCwH9w48xWQGZZbmyHtBkaMj8Scf delete mode 100644 test_data/blocks/QmXYu3S8gaTfRvrztrGxm1H28obp5Y48JkXLu4GnFwFdbB delete mode 100644 test_data/blocks/bafkreidnuq5zitsjj2ef42npaipzhrwzgmohrkrcqcchcfbjcyffxpivwu delete mode 100644 test_data/blocks/bafkreids37h3brdqvqsvzxud7oh6hdpiueubrdqd5jn2lmvjhln6uedc7i delete mode 100644 test_data/blocks/bafkreidzajuzxzbmrkhen653iuaxezix5bvsfrlkdcpxmjng3jeqqgzeke delete mode 100644 test_data/blocks/bafkreiecktbstkjikd3nkoo5g5xuqfxoe5sfc7nf4arvkffpimywisanpi delete mode 100644 test_data/blocks/bafkreiegx2nfk5rngfvdajwcqnwqit27y5xdjwqq4g2f73xf6gf6p3nro4 diff --git a/chromium_edits/120.0.6099.200/chrome/browser/about_flags.cc.patch b/chromium_edits/120.0.6099.200/chrome/browser/about_flags.cc.patch deleted file mode 100644 index bec369fa..00000000 --- a/chromium_edits/120.0.6099.200/chrome/browser/about_flags.cc.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 8736a91998f6b..da556109dcbb1 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -213,6 +213,7 @@ - #include "third_party/blink/public/common/features_generated.h" - #include "third_party/blink/public/common/forcedark/forcedark_switches.h" - #include "third_party/blink/public/common/switches.h" -+#include "third_party/ipfs_client/ipfs_buildflags.h" - #include "ui/accessibility/accessibility_features.h" - #include "ui/accessibility/accessibility_switches.h" - #include "ui/base/ui_base_features.h" -@@ -314,6 +315,10 @@ - #include "extensions/common/switches.h" - #endif // BUILDFLAG(ENABLE_EXTENSIONS) - -+#if BUILDFLAG(ENABLE_IPFS) -+#include "components/ipfs/ipfs_features.h" -+#endif -+ - #if BUILDFLAG(ENABLE_PDF) - #include "pdf/pdf_features.h" - #endif -@@ -9922,6 +9927,14 @@ const FeatureEntry kFeatureEntries[] = { - flag_descriptions::kOmitCorsClientCertDescription, kOsAll, - FEATURE_VALUE_TYPE(network::features::kOmitCorsClientCert)}, - -+#if BUILDFLAG(ENABLE_IPFS) -+ {"enable-ipfs", -+ flag_descriptions::kEnableIpfsName, -+ flag_descriptions::kEnableIpfsDescription, -+ kOsMac | kOsWin | kOsLinux,//TODO: These are the only variants currently getting built, but that is not likely to remain the case -+ FEATURE_VALUE_TYPE(ipfs::kEnableIpfs)}, -+#endif -+ - {"use-idna2008-non-transitional", - flag_descriptions::kUseIDNA2008NonTransitionalName, - flag_descriptions::kUseIDNA2008NonTransitionalDescription, kOsAll, diff --git a/chromium_edits/120.0.6099.200/chrome/browser/flag-metadata.json.patch b/chromium_edits/120.0.6099.200/chrome/browser/flag-metadata.json.patch deleted file mode 100644 index f7c408d8..00000000 --- a/chromium_edits/120.0.6099.200/chrome/browser/flag-metadata.json.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json -index 400505f9d64e6..320b730d894c6 100644 ---- a/chrome/browser/flag-metadata.json -+++ b/chrome/browser/flag-metadata.json -@@ -2868,6 +2868,11 @@ - "owners": [ "hanxi@chromium.org", "wychen@chromium.org" ], - "expiry_milestone": 130 - }, -+ { -+ "name": "enable-ipfs", -+ "owners": [ "//components/ipfs/OWNERS" ], -+ "expiry_milestone": 150 -+ }, - { - "name": "enable-isolated-sandboxed-iframes", - "owners": [ "wjmaclean@chromium.org", "alexmos@chromium.org", "creis@chromium.org" ], diff --git a/chromium_edits/120.0.6099.200/chrome/browser/flag_descriptions.cc.patch b/chromium_edits/120.0.6099.200/chrome/browser/flag_descriptions.cc.patch deleted file mode 100644 index d021535f..00000000 --- a/chromium_edits/120.0.6099.200/chrome/browser/flag_descriptions.cc.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index f92c5df0fc600..e131baa70cce2 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -248,6 +248,11 @@ const char kEnableBenchmarkingDescription[] = - "after 3 restarts. On the third restart, the flag will appear to be off " - "but the effect is still active."; - -+#if BUILDFLAG(ENABLE_IPFS) -+extern const char kEnableIpfsName[] = "Enable IPFS"; -+extern const char kEnableIpfsDescription[] = "Enable ipfs:// and ipns:// URLs"; -+#endif -+ - const char kPreloadingOnPerformancePageName[] = - "Preloading Settings on Performance Page"; - const char kPreloadingOnPerformancePageDescription[] = diff --git a/chromium_edits/120.0.6099.200/chrome/browser/flag_descriptions.h.patch b/chromium_edits/120.0.6099.200/chrome/browser/flag_descriptions.h.patch deleted file mode 100644 index e7d95550..00000000 --- a/chromium_edits/120.0.6099.200/chrome/browser/flag_descriptions.h.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index 71eae84724eab..a8e4b29ee3cc5 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -22,6 +22,7 @@ - #include "pdf/buildflags.h" - #include "printing/buildflags/buildflags.h" - #include "third_party/blink/public/common/buildflags.h" -+#include "third_party/ipfs_client/ipfs_buildflags.h" - - // This file declares strings used in chrome://flags. These messages are not - // translated, because instead of end-users they target Chromium developers and -@@ -165,6 +166,11 @@ extern const char kDownloadWarningImprovementsDescription[]; - extern const char kEnableBenchmarkingName[]; - extern const char kEnableBenchmarkingDescription[]; - -+#if BUILDFLAG(ENABLE_IPFS) -+extern const char kEnableIpfsName[]; -+extern const char kEnableIpfsDescription[]; -+#endif -+ - #if BUILDFLAG(USE_FONTATIONS_BACKEND) - extern const char kFontationsFontBackendName[]; - extern const char kFontationsFontBackendDescription[]; diff --git a/chromium_edits/120.0.6099.200/chrome/browser/prefs/browser_prefs.cc.patch b/chromium_edits/120.0.6099.200/chrome/browser/prefs/browser_prefs.cc.patch deleted file mode 100644 index 74d8f674..00000000 --- a/chromium_edits/120.0.6099.200/chrome/browser/prefs/browser_prefs.cc.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc -index 0af94fd3059cf..60a20373ed748 100644 ---- a/chrome/browser/prefs/browser_prefs.cc -+++ b/chrome/browser/prefs/browser_prefs.cc -@@ -184,6 +184,7 @@ - #include "printing/buildflags/buildflags.h" - #include "rlz/buildflags/buildflags.h" - #include "third_party/abseil-cpp/absl/types/optional.h" -+#include "third_party/ipfs_client/ipfs_buildflags.h" - - #if BUILDFLAG(ENABLE_BACKGROUND_MODE) - #include "chrome/browser/background/background_mode_manager.h" -@@ -234,6 +235,11 @@ - #include "chrome/browser/pdf/pdf_pref_names.h" - #endif // BUILDFLAG(ENABLE_PDF) - -+#if BUILDFLAG(ENABLE_IPFS) -+#include "components/ipfs/ipfs_features.h" -+#include "components/ipfs/preferences.h" -+#endif -+ - #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) - #include "chrome/browser/screen_ai/pref_names.h" - #endif -@@ -1662,6 +1668,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, - IncognitoModePrefs::RegisterProfilePrefs(registry); - invalidation::PerUserTopicSubscriptionManager::RegisterProfilePrefs(registry); - invalidation::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry); -+#if BUILDFLAG(ENABLE_IPFS) -+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { -+ ipfs::RegisterPreferences(registry); -+ } -+#endif - language::LanguagePrefs::RegisterProfilePrefs(registry); - login_detection::prefs::RegisterProfilePrefs(registry); - lookalikes::RegisterProfilePrefs(registry); diff --git a/chromium_edits/120.0.6099.200/chrome/common/chrome_content_client.cc.patch b/chromium_edits/120.0.6099.200/chrome/common/chrome_content_client.cc.patch deleted file mode 100644 index 5bd09f16..00000000 --- a/chromium_edits/120.0.6099.200/chrome/common/chrome_content_client.cc.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc -index 246ec9c5c911f..5d66d133a7907 100644 ---- a/chrome/common/chrome_content_client.cc -+++ b/chrome/common/chrome_content_client.cc -@@ -296,6 +296,12 @@ void ChromeContentClient::AddAdditionalSchemes(Schemes* schemes) { - #if BUILDFLAG(IS_ANDROID) - schemes->local_schemes.push_back(url::kContentScheme); - #endif -+ for ( const char* ip_s : {"ipfs", "ipns"} ) { -+ schemes->standard_schemes.push_back(ip_s); -+ schemes->cors_enabled_schemes.push_back(ip_s); -+ schemes->secure_schemes.push_back(ip_s); -+ schemes->csp_bypassing_schemes.push_back(ip_s); -+ } - } - - std::u16string ChromeContentClient::GetLocalizedString(int message_id) { diff --git a/chromium_edits/120.0.6099.200/components/cbor/writer.cc.patch b/chromium_edits/120.0.6099.200/components/cbor/writer.cc.patch deleted file mode 100644 index 21fe28ce..00000000 --- a/chromium_edits/120.0.6099.200/components/cbor/writer.cc.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/components/cbor/writer.cc b/components/cbor/writer.cc -index bb22754d36a07..aae4027836377 100644 ---- a/components/cbor/writer.cc -+++ b/components/cbor/writer.cc -@@ -47,6 +47,9 @@ bool Writer::EncodeCBOR(const Value& node, - if (max_nesting_level < 0) - return false; - -+ if (node.has_tag()) { -+ StartItem(Value::Type::TAG, node.GetTag()); -+ } - switch (node.type()) { - case Value::Type::NONE: { - StartItem(Value::Type::BYTE_STRING, 0); diff --git a/chromium_edits/120.0.6099.200/url/url_canon_ipfs.cc b/chromium_edits/120.0.6099.200/url/url_canon_ipfs.cc deleted file mode 100644 index 9511e3f5..00000000 --- a/chromium_edits/120.0.6099.200/url/url_canon_ipfs.cc +++ /dev/null @@ -1,55 +0,0 @@ -#include "url_canon_internal.h" - -#include -#include - -#include - -bool url::CanonicalizeIpfsURL(const char* spec, - int spec_len, - const Parsed& parsed, - SchemeType scheme_type, - CharsetConverter* charset_converter, - CanonOutput* output, - Parsed* output_parsed) { - if ( spec_len < 1 || !spec ) { - return false; - } - if ( parsed.host.len < 1 ) { - return false; - } - std::string_view cid_str{ spec + parsed.host.begin, static_cast(parsed.host.len) }; - auto cid = ipfs::Cid(cid_str); - if ( !cid.valid() ) { - cid = ipfs::id_cid::forText( std::string{cid_str} + " is not a valid CID." ); - } - auto as_str = cid.to_string(); - if ( as_str.empty() ) { - return false; - } - std::string stdurl{ spec, static_cast(parsed.host.begin) }; - stdurl.append( as_str ); - stdurl.append( spec + parsed.host.end(), spec_len - parsed.host.end() ); - spec = stdurl.data(); - spec_len = static_cast(stdurl.size()); - Parsed parsed_input; - ParseStandardURL(spec, spec_len, &parsed_input); - return CanonicalizeStandardURL( - spec, spec_len, - parsed_input, - scheme_type, - charset_converter, - output, output_parsed - ); -} -bool url::CanonicalizeIpfsURL(const char16_t* spec, - int spec_len, - const Parsed& parsed, - SchemeType scheme_type, - CharsetConverter* query_converter, - CanonOutput* output, - Parsed* new_parsed) { - RawCanonOutput<2048> as8; - ConvertUTF16ToUTF8(spec, spec_len, &as8); - return CanonicalizeIpfsURL(as8.data(), as8.length(), parsed, scheme_type, query_converter, output, new_parsed); -} diff --git a/chromium_edits/120.0.6099.200/url/url_util.cc.patch b/chromium_edits/120.0.6099.200/url/url_util.cc.patch deleted file mode 100644 index 0332e847..00000000 --- a/chromium_edits/120.0.6099.200/url/url_util.cc.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/url/url_util.cc b/url/url_util.cc -index 9258cfcfada47..daf10e4c3b741 100644 ---- a/url/url_util.cc -+++ b/url/url_util.cc -@@ -277,6 +277,12 @@ bool DoCanonicalize(const CHAR* spec, - charset_converter, output, - output_parsed); - -+ } else if (DoCompareSchemeComponent(spec, scheme, "ipfs")) { -+ // Switch multibase away from case-sensitive ones before continuing canonicalization. -+ ParseStandardURL(spec, spec_len, &parsed_input); -+ success = CanonicalizeIpfsURL(spec, spec_len, parsed_input, scheme_type, -+ charset_converter, output, output_parsed); -+ - } else if (DoIsStandard(spec, scheme, &scheme_type)) { - // All "normal" URLs. - ParseStandardURL(spec, spec_len, &parsed_input); diff --git a/chromium_edits/121.0.6167.57/chrome/browser/BUILD.gn.patch b/chromium_edits/121.0.6167.57/chrome/browser/BUILD.gn.patch deleted file mode 100644 index 12b16ed8..00000000 --- a/chromium_edits/121.0.6167.57/chrome/browser/BUILD.gn.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 655429c1daa7b..388d452cabc73 100644 ---- a/chrome/browser/BUILD.gn -+++ b/chrome/browser/BUILD.gn -@@ -40,6 +40,7 @@ import("//rlz/buildflags/buildflags.gni") - import("//sandbox/features.gni") - import("//testing/libfuzzer/fuzzer_test.gni") - import("//third_party/blink/public/public_features.gni") -+import("//third_party/ipfs_client/args.gni") - import("//third_party/protobuf/proto_library.gni") - import("//third_party/webrtc/webrtc.gni") - import("//third_party/widevine/cdm/widevine.gni") -@@ -1944,7 +1945,6 @@ static_library("browser") { - "user_education/user_education_service_factory.h", - ] - } -- - configs += [ - "//build/config/compiler:wexit_time_destructors", - "//build/config:precompiled_headers", -@@ -2632,6 +2632,14 @@ static_library("browser") { - ] - } - -+ if (enable_ipfs) { -+ sources += [ -+ "ipfs_extra_parts.cc", -+ "ipfs_extra_parts.h", -+ ] -+ deps += [ "//components/ipfs" ] -+ } -+ - if (is_chromeos_ash) { - deps += [ "//chrome/browser/screen_ai:screen_ai_dlc_installer" ] - } diff --git a/chromium_edits/121.0.6167.57/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch b/chromium_edits/121.0.6167.57/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch deleted file mode 100644 index 4d172311..00000000 --- a/chromium_edits/121.0.6167.57/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff --git a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc -index 4c88614c68c25..f8bb12a3b0c2e 100644 ---- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc -+++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc -@@ -10,6 +10,8 @@ - #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" - #include "chrome/browser/external_protocol/external_protocol_handler.h" - #include "chrome/browser/profiles/profile.h" -+#include "third_party/ipfs_client/ipfs_buildflags.h" -+ - #if BUILDFLAG(IS_ANDROID) - #include "chrome/browser/profiles/profile_android.h" - #endif -@@ -18,6 +20,9 @@ - #include "chrome/browser/ui/android/omnibox/jni_headers/ChromeAutocompleteSchemeClassifier_jni.h" - #endif - #include "components/custom_handlers/protocol_handler_registry.h" -+#if BUILDFLAG(ENABLE_IPFS) -+#include "components/ipfs/ipfs_features.h" -+#endif - #include "content/public/common/url_constants.h" - #include "url/url_util.h" - -@@ -55,12 +60,20 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForScheme( - if (scheme.empty()) { - return metrics::OmniboxInputType::EMPTY; - } -- if (base::IsStringASCII(scheme) && -- (ProfileIOData::IsHandledProtocol(scheme) || -- base::EqualsCaseInsensitiveASCII(scheme, content::kViewSourceScheme) || -- base::EqualsCaseInsensitiveASCII(scheme, url::kJavaScriptScheme) || -- base::EqualsCaseInsensitiveASCII(scheme, url::kDataScheme))) { -- return metrics::OmniboxInputType::URL; -+ if (base::IsStringASCII(scheme)) { -+ if (ProfileIOData::IsHandledProtocol(scheme) || -+ base::EqualsCaseInsensitiveASCII(scheme, content::kViewSourceScheme) || -+ base::EqualsCaseInsensitiveASCII(scheme, url::kJavaScriptScheme) || -+ base::EqualsCaseInsensitiveASCII(scheme, url::kDataScheme)) { -+ return metrics::OmniboxInputType::URL; -+ } -+#if BUILDFLAG(ENABLE_IPFS) -+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs) && -+ (base::EqualsCaseInsensitiveASCII(scheme, "ipfs") || base::EqualsCaseInsensitiveASCII(scheme, "ipns")) -+ ) { -+ return metrics::OmniboxInputType::URL; -+ } -+#endif - } - - // Also check for schemes registered via registerProtocolHandler(), which diff --git a/chromium_edits/121.0.6167.57/chrome/browser/chrome_content_browser_client.cc.patch b/chromium_edits/121.0.6167.57/chrome/browser/chrome_content_browser_client.cc.patch deleted file mode 100644 index aa28ae8f..00000000 --- a/chromium_edits/121.0.6167.57/chrome/browser/chrome_content_browser_client.cc.patch +++ /dev/null @@ -1,78 +0,0 @@ -diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc -index a9b87ac2fcd74..db78adcdce85c 100644 ---- a/chrome/browser/chrome_content_browser_client.cc -+++ b/chrome/browser/chrome_content_browser_client.cc -@@ -377,6 +377,7 @@ - #include "third_party/blink/public/common/switches.h" - #include "third_party/blink/public/mojom/browsing_topics/browsing_topics.mojom.h" - #include "third_party/blink/public/public_buildflags.h" -+#include "third_party/ipfs_client/ipfs_buildflags.h" - #include "third_party/widevine/cdm/buildflags.h" - #include "ui/base/clipboard/clipboard_format_type.h" - #include "ui/base/l10n/l10n_util.h" -@@ -499,6 +500,13 @@ - #include "chrome/browser/fuchsia/chrome_browser_main_parts_fuchsia.h" - #endif - -+#if BUILDFLAG(ENABLE_IPFS) -+#include "chrome/browser/ipfs_extra_parts.h" -+#include "components/ipfs/interceptor.h" -+#include "components/ipfs/ipfs_features.h" -+#include "components/ipfs/url_loader_factory.h" -+#endif -+ - #if BUILDFLAG(IS_CHROMEOS) - #include "base/debug/leak_annotations.h" - #include "chrome/browser/apps/app_service/app_install/app_install_navigation_throttle.h" -@@ -1785,6 +1793,11 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) { - main_parts->AddParts( - std::make_unique()); - -+#if BUILDFLAG(ENABLE_IPFS) -+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { -+ main_parts->AddParts(std::make_unique()); -+ } -+#endif - return main_parts; - } - -@@ -6157,12 +6170,25 @@ void ChromeContentBrowserClient:: - const absl::optional& request_initiator_origin, - NonNetworkURLLoaderFactoryMap* factories) { - #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \ -- !BUILDFLAG(IS_ANDROID) -+ !BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_IPFS) - content::RenderFrameHost* frame_host = - RenderFrameHost::FromID(render_process_id, render_frame_id); - WebContents* web_contents = WebContents::FromRenderFrameHost(frame_host); - #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \ -- // !BUILDFLAG(IS_ANDROID) -+ // !BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_IPFS) -+#if BUILDFLAG(ENABLE_IPFS) -+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { -+ network::mojom::URLLoaderFactory* default_factory = g_browser_process->system_network_context_manager()->GetURLLoaderFactory(); -+ auto* context = web_contents->GetBrowserContext(); -+ ipfs::IpfsURLLoaderFactory::Create( -+ factories, -+ context, -+ default_factory, -+ GetSystemNetworkContext(), -+ Profile::FromBrowserContext(context)->GetPrefs() -+ ); -+ } -+#endif // BUILDFLAG(ENABLE_IPFS) - - #if BUILDFLAG(IS_CHROMEOS_ASH) - if (web_contents) { -@@ -6304,6 +6330,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors( - scoped_refptr navigation_response_task_runner) { - std::vector> - interceptors; -+#if BUILDFLAG(ENABLE_IPFS) -+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { -+ interceptors.push_back(std::make_unique(g_browser_process->system_network_context_manager()->GetURLLoaderFactory(), GetSystemNetworkContext())); -+ } -+#endif - #if BUILDFLAG(ENABLE_OFFLINE_PAGES) - interceptors.push_back( - std::make_unique( diff --git a/chromium_edits/121.0.6167.57/chrome/browser/ipfs_extra_parts.cc b/chromium_edits/121.0.6167.57/chrome/browser/ipfs_extra_parts.cc deleted file mode 100644 index 90d2596f..00000000 --- a/chromium_edits/121.0.6167.57/chrome/browser/ipfs_extra_parts.cc +++ /dev/null @@ -1,10 +0,0 @@ -#include "ipfs_extra_parts.h" - -#include "profiles/profile.h" - -#include - -void IpfsExtraParts::PostProfileInit(Profile* profile, bool /* is_initial_profile */ ) { - DCHECK(profile); - ipfs::InterRequestState::CreateForBrowserContext(profile, profile->GetPrefs()); -} diff --git a/chromium_edits/121.0.6167.57/chrome/browser/ipfs_extra_parts.h b/chromium_edits/121.0.6167.57/chrome/browser/ipfs_extra_parts.h deleted file mode 100644 index 2059c437..00000000 --- a/chromium_edits/121.0.6167.57/chrome/browser/ipfs_extra_parts.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef IPFS_EXTRA_PART_H_ -#define IPFS_EXTRA_PART_H_ - -#include - -class IpfsExtraParts : public ChromeBrowserMainExtraParts { - void PostProfileInit(Profile* profile, bool is_initial_profile) override; -}; - -#endif // IPFS_EXTRA_PART_H_ diff --git a/chromium_edits/121.0.6167.57/components/cbor/reader.cc.patch b/chromium_edits/121.0.6167.57/components/cbor/reader.cc.patch deleted file mode 100644 index aed86452..00000000 --- a/chromium_edits/121.0.6167.57/components/cbor/reader.cc.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/components/cbor/reader.cc b/components/cbor/reader.cc -index 306ba52fa4944..6b13b3a679a65 100644 ---- a/components/cbor/reader.cc -+++ b/components/cbor/reader.cc -@@ -22,7 +22,7 @@ - namespace cbor { - - namespace constants { --const char kUnsupportedMajorType[] = "Unsupported major type."; -+const char kUnsupportedMajorType[] = "Unsupported major type operation."; - } - - namespace { -@@ -156,7 +156,11 @@ absl::optional Reader::DecodeCompleteDataItem(const Config& config, - case Value::Type::FLOAT_VALUE: - // Floating point values also go here since they are also type 7. - return DecodeToSimpleValueOrFloat(*header, config); -- case Value::Type::TAG: // We explicitly don't support TAG. -+ case Value::Type::TAG: -+ if (config.parse_tags) { -+ return ReadTagContent(*header, config, max_nesting_level); -+ } -+ break; - case Value::Type::NONE: - case Value::Type::INVALID_UTF8: - break; -@@ -347,6 +351,17 @@ absl::optional Reader::ReadByteStringContent( - return Value(std::move(cbor_byte_string)); - } - -+absl::optional Reader::ReadTagContent( -+ const Reader::DataItemHeader& header, -+ const Config& config, -+ int max_nesting_level) { -+ auto tagged_content = DecodeCompleteDataItem(config, max_nesting_level); -+ if (tagged_content.has_value()) { -+ tagged_content.value().SetTag(header.value); -+ } -+ return tagged_content; -+} -+ - absl::optional Reader::ReadArrayContent( - const Reader::DataItemHeader& header, - const Config& config, diff --git a/chromium_edits/121.0.6167.57/components/cbor/reader.h.patch b/chromium_edits/121.0.6167.57/components/cbor/reader.h.patch deleted file mode 100644 index fb821165..00000000 --- a/chromium_edits/121.0.6167.57/components/cbor/reader.h.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/components/cbor/reader.h b/components/cbor/reader.h -index f0b43a5517528..a57e277a1bc66 100644 ---- a/components/cbor/reader.h -+++ b/components/cbor/reader.h -@@ -130,6 +130,11 @@ class CBOR_EXPORT Reader { - // during decoding will set raise the `UNSUPPORTED_FLOATING_POINT_VALUE` - // error. - bool allow_floating_point = false; -+ -+ // If the parser encounters a TAG element, should it be parsed out and -+ // the tag value saved (true), or should the entire node and its content -+ // be discarded (false) -+ bool parse_tags = false; - }; - - Reader(const Reader&) = delete; -@@ -204,6 +209,9 @@ class CBOR_EXPORT Reader { - absl::optional ReadMapContent(const DataItemHeader& header, - const Config& config, - int max_nesting_level); -+ absl::optional ReadTagContent(const DataItemHeader& header, -+ const Config& config, -+ int max_nesting_level); - absl::optional ReadByte(); - absl::optional> ReadBytes(uint64_t num_bytes); - bool IsKeyInOrder(const Value& new_key, diff --git a/chromium_edits/121.0.6167.57/components/cbor/reader_unittest.cc.patch b/chromium_edits/121.0.6167.57/components/cbor/reader_unittest.cc.patch deleted file mode 100644 index 3f657dc3..00000000 --- a/chromium_edits/121.0.6167.57/components/cbor/reader_unittest.cc.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/components/cbor/reader_unittest.cc b/components/cbor/reader_unittest.cc -index 83d44a48d6dfa..a6ec5299b3241 100644 ---- a/components/cbor/reader_unittest.cc -+++ b/components/cbor/reader_unittest.cc -@@ -1451,5 +1451,42 @@ TEST(CBORReaderTest, AllowInvalidUTF8) { - EXPECT_FALSE(cbor); - EXPECT_EQ(Reader::DecoderError::INVALID_UTF8, error); - } -+TEST(CBORReaderTest, RejectsTagUnderDefaultConfig) { -+ static const uint8_t kTaggedCbor[] = { -+ 0xd8, 0x2a, 0x58, 0x25, 0x00, 0x01, 0x71, 0x12, 0x20, 0x69, 0xea, 0x07, -+ 0x40, 0xf9, 0x80, 0x7a, 0x28, 0xf4, 0xd9, 0x32, 0xc6, 0x2e, 0x7c, 0x1c, -+ 0x83, 0xbe, 0x05, 0x5e, 0x55, 0x07, 0x2c, 0x90, 0x26, 0x6a, 0xb3, 0xe7, -+ 0x9d, 0xf6, 0x3a, 0x36, 0x5b -+ }; -+ Reader::Config config; -+ absl::optional cbor = Reader::Read(kTaggedCbor, config); -+ EXPECT_FALSE(cbor.has_value()); -+} -+TEST(CBORReaderTest, ReadsTagWhenConfiguredToDoSo) { -+ static const uint8_t kTaggedCbor[] = { -+ 0xd8, 0x2a, 0x58, 0x25, 0x00, 0x01, 0x71, 0x12, 0x20, 0x69, 0xea, 0x07, -+ 0x40, 0xf9, 0x80, 0x7a, 0x28, 0xf4, 0xd9, 0x32, 0xc6, 0x2e, 0x7c, 0x1c, -+ 0x83, 0xbe, 0x05, 0x5e, 0x55, 0x07, 0x2c, 0x90, 0x26, 0x6a, 0xb3, 0xe7, -+ 0x9d, 0xf6, 0x3a, 0x36, 0x5b -+ }; -+ Reader::Config config; -+ config.parse_tags = true; -+ absl::optional cbor = Reader::Read(kTaggedCbor, config); -+ EXPECT_TRUE(cbor.has_value()); -+ auto& v = cbor.value(); -+ EXPECT_TRUE(v.has_tag()); -+ EXPECT_EQ(v.GetTag(),42UL); -+ EXPECT_TRUE(v.is_bytestring()); -+ EXPECT_EQ(v.type(), Value::Type::BYTE_STRING); -+ auto& bytes = v.GetBytestring(); -+ EXPECT_EQ(bytes.size(), 37UL); -+ EXPECT_EQ(bytes.at(0), 0x00);//identity multibase (e.g. not base-encoded, bytes are themselves) -+ EXPECT_EQ(bytes.at(1), 0x01);//CID version 1 -+ EXPECT_EQ(bytes.at(2), 0x71);//codec = dag-cbor -+ EXPECT_EQ(bytes.at(3), 0x12);//multihash = 18 = sha2-256 -+ EXPECT_EQ(bytes.at(4), 0x20);//hash length = 32 bytes -+ EXPECT_EQ(bytes.at(5), 0x69);//first byte of hash digest -+ EXPECT_EQ(bytes.at(36),0x5b);//last byte of hash digest -+} - - } // namespace cbor diff --git a/chromium_edits/121.0.6167.57/components/cbor/values.cc.patch b/chromium_edits/121.0.6167.57/components/cbor/values.cc.patch deleted file mode 100644 index ddbab2b3..00000000 --- a/chromium_edits/121.0.6167.57/components/cbor/values.cc.patch +++ /dev/null @@ -1,145 +0,0 @@ -diff --git a/components/cbor/values.cc b/components/cbor/values.cc -index 02498209c820e..34055aef24cfe 100644 ---- a/components/cbor/values.cc -+++ b/components/cbor/values.cc -@@ -66,32 +66,34 @@ Value::Value(Type type) : type_(type) { - NOTREACHED(); - } - --Value::Value(SimpleValue in_simple) -- : type_(Type::SIMPLE_VALUE), simple_value_(in_simple) { -+Value::Value(SimpleValue in_simple, uint64_t tag) -+ : type_(Type::SIMPLE_VALUE), simple_value_(in_simple), tag_(tag) { - CHECK(static_cast(in_simple) >= 20 && static_cast(in_simple) <= 23); - } - --Value::Value(bool boolean_value) : type_(Type::SIMPLE_VALUE) { -+Value::Value(bool boolean_value, uint64_t tag) : type_(Type::SIMPLE_VALUE), tag_(tag) { - simple_value_ = boolean_value ? Value::SimpleValue::TRUE_VALUE - : Value::SimpleValue::FALSE_VALUE; - } - --Value::Value(double float_value) -- : type_(Type::FLOAT_VALUE), float_value_(float_value) {} -+Value::Value(double float_value, uint64_t tag) -+ : type_(Type::FLOAT_VALUE), float_value_(float_value), tag_(tag) {} - --Value::Value(int integer_value) -- : Value(base::checked_cast(integer_value)) {} -+Value::Value(int integer_value, uint64_t tag) -+ : Value(base::checked_cast(integer_value), tag) {} - --Value::Value(int64_t integer_value) : integer_value_(integer_value) { -+Value::Value(int64_t integer_value, uint64_t tag) : integer_value_(integer_value), tag_(tag) { - type_ = integer_value >= 0 ? Type::UNSIGNED : Type::NEGATIVE; - } - --Value::Value(base::span in_bytes) -+Value::Value(base::span in_bytes, uint64_t tag) - : type_(Type::BYTE_STRING), -- bytestring_value_(in_bytes.begin(), in_bytes.end()) {} -+ bytestring_value_(in_bytes.begin(), in_bytes.end()), -+ tag_(tag) -+ {} - --Value::Value(base::span in_bytes, Type type) -- : type_(type), bytestring_value_(in_bytes.begin(), in_bytes.end()) { -+Value::Value(base::span in_bytes, Type type, uint64_t tag) -+ : type_(type), bytestring_value_(in_bytes.begin(), in_bytes.end()), tag_(tag) { - DCHECK(type_ == Type::BYTE_STRING || type_ == Type::INVALID_UTF8); - } - -@@ -117,7 +119,8 @@ Value::Value(std::string&& in_string, Type type) noexcept : type_(type) { - } - } - --Value::Value(base::StringPiece in_string, Type type) : type_(type) { -+Value::Value(base::StringPiece in_string, Type type, uint64_t tag) -+: type_(type), tag_(tag) { - switch (type_) { - case Type::STRING: - new (&string_value_) std::string(); -@@ -133,16 +136,18 @@ Value::Value(base::StringPiece in_string, Type type) : type_(type) { - } - } - --Value::Value(const ArrayValue& in_array) : type_(Type::ARRAY), array_value_() { -+Value::Value(const ArrayValue& in_array, uint64_t tag) -+: type_(Type::ARRAY), array_value_(), tag_(tag) { - array_value_.reserve(in_array.size()); - for (const auto& val : in_array) - array_value_.emplace_back(val.Clone()); - } - --Value::Value(ArrayValue&& in_array) noexcept -- : type_(Type::ARRAY), array_value_(std::move(in_array)) {} -+Value::Value(ArrayValue&& in_array, uint64_t tag) noexcept -+ : type_(Type::ARRAY), array_value_(std::move(in_array)), tag_(tag) {} - --Value::Value(const MapValue& in_map) : type_(Type::MAP), map_value_() { -+Value::Value(const MapValue& in_map, uint64_t tag) -+: type_(Type::MAP), map_value_(), tag_(tag) { - map_value_.reserve(in_map.size()); - for (const auto& it : in_map) - map_value_.emplace_hint(map_value_.end(), it.first.Clone(), -@@ -168,31 +173,36 @@ Value Value::Clone() const { - case Type::NONE: - return Value(); - case Type::INVALID_UTF8: -- return Value(bytestring_value_, Type::INVALID_UTF8); -+ return Value(bytestring_value_, Type::INVALID_UTF8, tag_); - case Type::UNSIGNED: - case Type::NEGATIVE: -- return Value(integer_value_); -+ return Value(integer_value_, tag_); - case Type::BYTE_STRING: -- return Value(bytestring_value_); -+ return Value(bytestring_value_, tag_); - case Type::STRING: -- return Value(string_value_); -+ return Value(string_value_, Type::STRING, tag_); - case Type::ARRAY: -- return Value(array_value_); -+ return Value(array_value_, tag_); - case Type::MAP: -- return Value(map_value_); -+ return Value(map_value_, tag_); - case Type::TAG: - NOTREACHED() << constants::kUnsupportedMajorType; - return Value(); - case Type::SIMPLE_VALUE: -- return Value(simple_value_); -+ return Value(simple_value_, tag_); - case Type::FLOAT_VALUE: -- return Value(float_value_); -+ return Value(float_value_, tag_); - } - - NOTREACHED(); - return Value(); - } - -+Value& Value::SetTag(uint64_t tag) noexcept { -+ tag_ = tag; -+ return *this; -+} -+ - Value::SimpleValue Value::GetSimpleValue() const { - CHECK(is_simple()); - return simple_value_; -@@ -258,9 +268,14 @@ const Value::BinaryValue& Value::GetInvalidUTF8() const { - return bytestring_value_; - } - -+uint64_t Value::GetTag() const { -+ CHECK(has_tag()); -+ return tag_; -+} -+ - void Value::InternalMoveConstructFrom(Value&& that) { - type_ = that.type_; -- -+ tag_ = that.tag_; - switch (type_) { - case Type::UNSIGNED: - case Type::NEGATIVE: diff --git a/chromium_edits/121.0.6167.57/components/cbor/values.h.patch b/chromium_edits/121.0.6167.57/components/cbor/values.h.patch deleted file mode 100644 index ca39df01..00000000 --- a/chromium_edits/121.0.6167.57/components/cbor/values.h.patch +++ /dev/null @@ -1,79 +0,0 @@ -diff --git a/components/cbor/values.h b/components/cbor/values.h -index d81ef5607c55a..10216a8dcdc57 100644 ---- a/components/cbor/values.h -+++ b/components/cbor/values.h -@@ -127,28 +127,29 @@ class CBOR_EXPORT Value { - - explicit Value(Type type); - -- explicit Value(SimpleValue in_simple); -- explicit Value(bool boolean_value); -- explicit Value(double in_float); -+ explicit Value(SimpleValue in_simple, uint64_t tag = NO_TAG); -+ explicit Value(bool boolean_value, uint64_t tag = NO_TAG); -+ explicit Value(double in_float, uint64_t tag = NO_TAG); - -- explicit Value(int integer_value); -- explicit Value(int64_t integer_value); -+ explicit Value(int integer_value, uint64_t tag = NO_TAG); -+ explicit Value(int64_t integer_value, uint64_t tag = NO_TAG); - explicit Value(uint64_t integer_value) = delete; - -- explicit Value(base::span in_bytes); -+ explicit Value(base::span in_bytes, uint64_t tag = NO_TAG); - explicit Value(BinaryValue&& in_bytes) noexcept; - - explicit Value(const char* in_string, Type type = Type::STRING); - explicit Value(std::string&& in_string, Type type = Type::STRING) noexcept; -- explicit Value(base::StringPiece in_string, Type type = Type::STRING); -+ explicit Value(base::StringPiece in_string, Type type = Type::STRING, uint64_t tag = NO_TAG); - -- explicit Value(const ArrayValue& in_array); -- explicit Value(ArrayValue&& in_array) noexcept; -+ explicit Value(const ArrayValue& in_array, uint64_t tag = NO_TAG); -+ explicit Value(ArrayValue&& in_array, uint64_t tag = NO_TAG) noexcept; - -- explicit Value(const MapValue& in_map); -+ explicit Value(const MapValue& in_map, uint64_t tag = NO_TAG); - explicit Value(MapValue&& in_map) noexcept; - - Value& operator=(Value&& that) noexcept; -+ Value& SetTag(uint64_t) noexcept; - - Value(const Value&) = delete; - Value& operator=(const Value&) = delete; -@@ -179,6 +180,7 @@ class CBOR_EXPORT Value { - bool is_string() const { return type() == Type::STRING; } - bool is_array() const { return type() == Type::ARRAY; } - bool is_map() const { return type() == Type::MAP; } -+ bool has_tag() const { return tag_ != NO_TAG; } - - // These will all fatally assert if the type doesn't match. - SimpleValue GetSimpleValue() const; -@@ -194,12 +196,13 @@ class CBOR_EXPORT Value { - const ArrayValue& GetArray() const; - const MapValue& GetMap() const; - const BinaryValue& GetInvalidUTF8() const; -+ uint64_t GetTag() const; - - private: - friend class Reader; - // This constructor allows INVALID_UTF8 values to be created, which only - // |Reader| and InvalidUTF8StringValueForTesting() may do. -- Value(base::span in_bytes, Type type); -+ Value(base::span in_bytes, Type type, uint64_t tag = NO_TAG); - - Type type_; - -@@ -213,6 +216,11 @@ class CBOR_EXPORT Value { - MapValue map_value_; - }; - -+ //This value specified as Invalid, -+ // used here to represent absence of TAG -+ constexpr static uint64_t NO_TAG = 0xFFFF; -+ uint64_t tag_ = NO_TAG; -+ - void InternalMoveConstructFrom(Value&& that); - void InternalCleanup(); - }; diff --git a/chromium_edits/121.0.6167.57/components/cbor/writer_unittest.cc.patch b/chromium_edits/121.0.6167.57/components/cbor/writer_unittest.cc.patch deleted file mode 100644 index 240fee83..00000000 --- a/chromium_edits/121.0.6167.57/components/cbor/writer_unittest.cc.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/components/cbor/writer_unittest.cc b/components/cbor/writer_unittest.cc -index e3bffe20734bc..0ed569ae164a0 100644 ---- a/components/cbor/writer_unittest.cc -+++ b/components/cbor/writer_unittest.cc -@@ -522,4 +522,31 @@ TEST(CBORWriterTest, OverlyNestedCBOR) { - EXPECT_FALSE(Writer::Write(Value(map), 4).has_value()); - } - -+TEST(CBORWriterTest, CanWriteTag) { -+ std::array content{ -+ 0x00, 0x01, 0x71, 0x12, 0x20, -+ 0x69, 0xea, 0x07, 0x40, 0xf9, -+ 0x80, 0x7a, 0x28, 0xf4, 0xd9, -+ 0x32, 0xc6, 0x2e, 0x7c, 0x1c, -+ 0x83, 0xbe, 0x05, 0x5e, 0x55, -+ 0x07, 0x2c, 0x90, 0x26, 0x6a, -+ 0xb3, 0xe7, 0x9d, 0xf6, 0x3a, -+ 0x36, 0x5b -+ }; -+ Value to_write(content); -+ to_write.SetTag(42); -+ auto result = Writer::Write(to_write); -+ EXPECT_TRUE(result.has_value()); -+ auto& bytes = result.value(); -+ EXPECT_EQ(bytes.size(), 41UL); -+ EXPECT_EQ(bytes.at(0), 0xd8); -+ EXPECT_EQ(bytes.at(1), 0x2a); -+ EXPECT_EQ(bytes.at(2), 0x58); -+ EXPECT_EQ(bytes.at(3), 0x25); -+ for (auto i = 0UL; i < content.size(); ++i) { -+ ASSERT_LT(i + 4UL, bytes.size()); -+ ASSERT_EQ(content.at(i), bytes.at(i+4UL)); -+ } -+} -+ - } // namespace cbor diff --git a/chromium_edits/121.0.6167.57/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch b/chromium_edits/121.0.6167.57/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch deleted file mode 100644 index 891b53df..00000000 --- a/chromium_edits/121.0.6167.57/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/components/open_from_clipboard/clipboard_recent_content_generic.cc b/components/open_from_clipboard/clipboard_recent_content_generic.cc -index 4dcafecbc66c6..d205209c08162 100644 ---- a/components/open_from_clipboard/clipboard_recent_content_generic.cc -+++ b/components/open_from_clipboard/clipboard_recent_content_generic.cc -@@ -20,7 +20,7 @@ - namespace { - // Schemes appropriate for suggestion by ClipboardRecentContent. - const char* kAuthorizedSchemes[] = { -- url::kAboutScheme, url::kDataScheme, url::kHttpScheme, url::kHttpsScheme, -+ url::kAboutScheme, url::kDataScheme, url::kHttpScheme, url::kHttpsScheme, "ipfs", "ipns" - // TODO(mpearson): add support for chrome:// URLs. Right now the scheme - // for that lives in content and is accessible via - // GetEmbedderRepresentationOfAboutScheme() or content::kChromeUIScheme diff --git a/chromium_edits/121.0.6167.57/net/dns/dns_config_service_linux.cc.patch b/chromium_edits/121.0.6167.57/net/dns/dns_config_service_linux.cc.patch deleted file mode 100644 index a5e9863f..00000000 --- a/chromium_edits/121.0.6167.57/net/dns/dns_config_service_linux.cc.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/net/dns/dns_config_service_linux.cc b/net/dns/dns_config_service_linux.cc -index 5273da5190277..12b28b86a4c00 100644 ---- a/net/dns/dns_config_service_linux.cc -+++ b/net/dns/dns_config_service_linux.cc -@@ -272,11 +272,11 @@ bool IsNsswitchConfigCompatible( - // Ignore any entries after `kDns` because Chrome will fallback to the - // system resolver if a result was not found in DNS. - return true; -- -+ case NsswitchReader::Service::kResolve: -+ break; - case NsswitchReader::Service::kMdns: - case NsswitchReader::Service::kMdns4: - case NsswitchReader::Service::kMdns6: -- case NsswitchReader::Service::kResolve: - case NsswitchReader::Service::kNis: - RecordIncompatibleNsswitchReason( - IncompatibleNsswitchReason::kIncompatibleService, diff --git a/chromium_edits/121.0.6167.57/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch b/chromium_edits/121.0.6167.57/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch deleted file mode 100644 index 119d72b2..00000000 --- a/chromium_edits/121.0.6167.57/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/third_party/blink/renderer/platform/weborigin/scheme_registry.cc b/third_party/blink/renderer/platform/weborigin/scheme_registry.cc -index 4eadf46ea0c24..d62fc7fb14e01 100644 ---- a/third_party/blink/renderer/platform/weborigin/scheme_registry.cc -+++ b/third_party/blink/renderer/platform/weborigin/scheme_registry.cc -@@ -67,7 +67,7 @@ class URLSchemesRegistry final { - // is considered secure. Additional checks are performed to ensure that - // other http pages are filtered out. - service_worker_schemes({"http", "https"}), -- fetch_api_schemes({"http", "https"}), -+ fetch_api_schemes({"http", "https", "ipfs", "ipns"}), - allowed_in_referrer_schemes({"http", "https"}) { - for (auto& scheme : url::GetCorsEnabledSchemes()) - cors_enabled_schemes.insert(scheme.c_str()); diff --git a/chromium_edits/121.0.6167.57/url/BUILD.gn.patch b/chromium_edits/121.0.6167.57/url/BUILD.gn.patch deleted file mode 100644 index 63fb8f8b..00000000 --- a/chromium_edits/121.0.6167.57/url/BUILD.gn.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/url/BUILD.gn b/url/BUILD.gn -index c525c166979d6..ce2b1ae43c0a7 100644 ---- a/url/BUILD.gn -+++ b/url/BUILD.gn -@@ -5,6 +5,7 @@ - import("//build/buildflag_header.gni") - import("//testing/libfuzzer/fuzzer_test.gni") - import("//testing/test.gni") -+import("//third_party/ipfs_client/args.gni") - import("features.gni") - - import("//build/config/cronet/config.gni") -@@ -67,6 +68,7 @@ component("url") { - public_deps = [ - "//base", - "//build:robolectric_buildflags", -+ "//third_party/ipfs_client:ipfs_buildflags", - ] - - configs += [ "//build/config/compiler:wexit_time_destructors" ] -@@ -89,6 +91,11 @@ component("url") { - public_configs = [ "//third_party/jdk" ] - } - -+ if (enable_ipfs) { -+ sources += [ "url_canon_ipfs.cc" ] -+ deps += [ "//third_party/ipfs_client:ipfs_client" ] -+ } -+ - if (is_win) { - # Don't conflict with Windows' "url.dll". - output_name = "url_lib" diff --git a/chromium_edits/121.0.6167.57/url/url_canon.h.patch b/chromium_edits/121.0.6167.57/url/url_canon.h.patch deleted file mode 100644 index 24ae1ba4..00000000 --- a/chromium_edits/121.0.6167.57/url/url_canon.h.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/url/url_canon.h b/url/url_canon.h -index d3a7fabf09fa8..06db17242248f 100644 ---- a/url/url_canon.h -+++ b/url/url_canon.h -@@ -697,6 +697,23 @@ bool CanonicalizeMailtoURL(const char16_t* spec, - CanonOutput* output, - Parsed* new_parsed); - -+COMPONENT_EXPORT(URL) -+bool CanonicalizeIpfsURL(const char* spec, -+ int spec_len, -+ const Parsed& parsed, -+ SchemeType scheme_type, -+ CharsetConverter* query_converter, -+ CanonOutput* output, -+ Parsed* new_parsed); -+COMPONENT_EXPORT(URL) -+bool CanonicalizeIpfsURL(const char16_t* spec, -+ int spec_len, -+ const Parsed& parsed, -+ SchemeType scheme_type, -+ CharsetConverter* query_converter, -+ CanonOutput* output, -+ Parsed* new_parsed); -+ - // Part replacer -------------------------------------------------------------- - - // Internal structure used for storing separate strings for each component. diff --git a/chromium_edits/121.0.6167.57/url/url_util.cc.patch b/chromium_edits/121.0.6167.57/url/url_util.cc.patch deleted file mode 100644 index 0332e847..00000000 --- a/chromium_edits/121.0.6167.57/url/url_util.cc.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/url/url_util.cc b/url/url_util.cc -index 9258cfcfada47..daf10e4c3b741 100644 ---- a/url/url_util.cc -+++ b/url/url_util.cc -@@ -277,6 +277,12 @@ bool DoCanonicalize(const CHAR* spec, - charset_converter, output, - output_parsed); - -+ } else if (DoCompareSchemeComponent(spec, scheme, "ipfs")) { -+ // Switch multibase away from case-sensitive ones before continuing canonicalization. -+ ParseStandardURL(spec, spec_len, &parsed_input); -+ success = CanonicalizeIpfsURL(spec, spec_len, parsed_input, scheme_type, -+ charset_converter, output, output_parsed); -+ - } else if (DoIsStandard(spec, scheme, &scheme_type)) { - // All "normal" URLs. - ParseStandardURL(spec, spec_len, &parsed_input); diff --git a/chromium_edits/124.0.6315.2/components/cbor/reader_unittest.cc.patch b/chromium_edits/124.0.6315.2/components/cbor/reader_unittest.cc.patch index 85daa02b..1566f783 100644 --- a/chromium_edits/124.0.6315.2/components/cbor/reader_unittest.cc.patch +++ b/chromium_edits/124.0.6315.2/components/cbor/reader_unittest.cc.patch @@ -14,7 +14,7 @@ index e5c02ceea3402..07168e636d6bd 100644 + 0x9d, 0xf6, 0x3a, 0x36, 0x5b + }; + Reader::Config config; -+ absl::optional cbor = Reader::Read(kTaggedCbor, config); ++ auto cbor = Reader::Read(kTaggedCbor, config); + EXPECT_FALSE(cbor.has_value()); +} +TEST(CBORReaderTest, ReadsTagWhenConfiguredToDoSo) { @@ -26,7 +26,7 @@ index e5c02ceea3402..07168e636d6bd 100644 + }; + Reader::Config config; + config.parse_tags = true; -+ absl::optional cbor = Reader::Read(kTaggedCbor, config); ++ auto cbor = Reader::Read(kTaggedCbor, config); + EXPECT_TRUE(cbor.has_value()); + auto& v = cbor.value(); + EXPECT_TRUE(v.has_tag()); diff --git a/chromium_edits/124.0.6323.0/components/cbor/reader_unittest.cc.patch b/chromium_edits/124.0.6323.0/components/cbor/reader_unittest.cc.patch index 85daa02b..1566f783 100644 --- a/chromium_edits/124.0.6323.0/components/cbor/reader_unittest.cc.patch +++ b/chromium_edits/124.0.6323.0/components/cbor/reader_unittest.cc.patch @@ -14,7 +14,7 @@ index e5c02ceea3402..07168e636d6bd 100644 + 0x9d, 0xf6, 0x3a, 0x36, 0x5b + }; + Reader::Config config; -+ absl::optional cbor = Reader::Read(kTaggedCbor, config); ++ auto cbor = Reader::Read(kTaggedCbor, config); + EXPECT_FALSE(cbor.has_value()); +} +TEST(CBORReaderTest, ReadsTagWhenConfiguredToDoSo) { @@ -26,7 +26,7 @@ index e5c02ceea3402..07168e636d6bd 100644 + }; + Reader::Config config; + config.parse_tags = true; -+ absl::optional cbor = Reader::Read(kTaggedCbor, config); ++ auto cbor = Reader::Read(kTaggedCbor, config); + EXPECT_TRUE(cbor.has_value()); + auto& v = cbor.value(); + EXPECT_TRUE(v.has_tag()); diff --git a/chromium_edits/120.0.6099.200/chrome/browser/BUILD.gn.patch b/chromium_edits/124.0.6329.0/chrome/browser/BUILD.gn.patch similarity index 77% rename from chromium_edits/120.0.6099.200/chrome/browser/BUILD.gn.patch rename to chromium_edits/124.0.6329.0/chrome/browser/BUILD.gn.patch index 1c014908..9c134da3 100644 --- a/chromium_edits/120.0.6099.200/chrome/browser/BUILD.gn.patch +++ b/chromium_edits/124.0.6329.0/chrome/browser/BUILD.gn.patch @@ -1,16 +1,16 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 44d3b5e543101..35bbe5da7daf8 100644 +index 78087b873bd28..f33f72a86d7f1 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -40,6 +40,7 @@ import("//rlz/buildflags/buildflags.gni") - import("//sandbox/features.gni") +@@ -39,6 +39,7 @@ import("//sandbox/features.gni") + import("//services/screen_ai/buildflags/features.gni") import("//testing/libfuzzer/fuzzer_test.gni") import("//third_party/blink/public/public_features.gni") +import("//third_party/ipfs_client/args.gni") import("//third_party/protobuf/proto_library.gni") import("//third_party/webrtc/webrtc.gni") import("//third_party/widevine/cdm/widevine.gni") -@@ -2660,6 +2661,14 @@ static_library("browser") { +@@ -2644,6 +2645,14 @@ static_library("browser") { ] } diff --git a/chromium_edits/121.0.6167.57/chrome/browser/about_flags.cc.patch b/chromium_edits/124.0.6329.0/chrome/browser/about_flags.cc.patch similarity index 88% rename from chromium_edits/121.0.6167.57/chrome/browser/about_flags.cc.patch rename to chromium_edits/124.0.6329.0/chrome/browser/about_flags.cc.patch index 128ac4f5..37631693 100644 --- a/chromium_edits/121.0.6167.57/chrome/browser/about_flags.cc.patch +++ b/chromium_edits/124.0.6329.0/chrome/browser/about_flags.cc.patch @@ -1,16 +1,16 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index ae88943acc26f..d1550497d6659 100644 +index f5761878e4373..e6cbc9e9719db 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -213,6 +213,7 @@ +@@ -214,6 +214,7 @@ #include "third_party/blink/public/common/features_generated.h" #include "third_party/blink/public/common/forcedark/forcedark_switches.h" #include "third_party/blink/public/common/switches.h" +#include "third_party/ipfs_client/ipfs_buildflags.h" #include "ui/accessibility/accessibility_features.h" #include "ui/accessibility/accessibility_switches.h" - #include "ui/base/ui_base_features.h" -@@ -313,6 +314,10 @@ + #include "ui/base/ozone_buildflags.h" +@@ -308,6 +309,10 @@ #include "extensions/common/switches.h" #endif // BUILDFLAG(ENABLE_EXTENSIONS) @@ -21,7 +21,7 @@ index ae88943acc26f..d1550497d6659 100644 #if BUILDFLAG(ENABLE_PDF) #include "pdf/pdf_features.h" #endif -@@ -9869,6 +9874,14 @@ const FeatureEntry kFeatureEntries[] = { +@@ -9480,6 +9485,14 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kOmitCorsClientCertDescription, kOsAll, FEATURE_VALUE_TYPE(network::features::kOmitCorsClientCert)}, diff --git a/chromium_edits/120.0.6099.200/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch b/chromium_edits/124.0.6329.0/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch similarity index 100% rename from chromium_edits/120.0.6099.200/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch rename to chromium_edits/124.0.6329.0/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch diff --git a/chromium_edits/120.0.6099.200/chrome/browser/chrome_content_browser_client.cc.patch b/chromium_edits/124.0.6329.0/chrome/browser/chrome_content_browser_client.cc.patch similarity index 85% rename from chromium_edits/120.0.6099.200/chrome/browser/chrome_content_browser_client.cc.patch rename to chromium_edits/124.0.6329.0/chrome/browser/chrome_content_browser_client.cc.patch index fcd5a818..6d2a2881 100644 --- a/chromium_edits/120.0.6099.200/chrome/browser/chrome_content_browser_client.cc.patch +++ b/chromium_edits/124.0.6329.0/chrome/browser/chrome_content_browser_client.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc -index d9c675c8aca73..8fbea741919d8 100644 +index 10240bdcbc380..b9e82dac849c7 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc -@@ -364,6 +364,7 @@ +@@ -379,6 +379,7 @@ #include "third_party/blink/public/common/switches.h" #include "third_party/blink/public/mojom/browsing_topics/browsing_topics.mojom.h" #include "third_party/blink/public/public_buildflags.h" @@ -10,7 +10,7 @@ index d9c675c8aca73..8fbea741919d8 100644 #include "third_party/widevine/cdm/buildflags.h" #include "ui/base/clipboard/clipboard_format_type.h" #include "ui/base/l10n/l10n_util.h" -@@ -487,6 +488,13 @@ +@@ -500,6 +501,13 @@ #include "chrome/browser/fuchsia/chrome_browser_main_parts_fuchsia.h" #endif @@ -21,10 +21,10 @@ index d9c675c8aca73..8fbea741919d8 100644 +#include "components/ipfs/url_loader_factory.h" +#endif + - #if BUILDFLAG(IS_CHROMEOS) - #include "base/debug/leak_annotations.h" - #include "chrome/browser/apps/intent_helper/chromeos_disabled_apps_throttle.h" -@@ -1816,6 +1824,11 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) { + #if !BUILDFLAG(IS_ANDROID) + #include "chrome/browser/preloading/preview/preview_navigation_throttle.h" + #endif // !BUILDFLAG(IS_ANDROID) +@@ -1691,6 +1699,11 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) { main_parts->AddParts( std::make_unique()); @@ -36,8 +36,8 @@ index d9c675c8aca73..8fbea741919d8 100644 return main_parts; } -@@ -6180,12 +6193,25 @@ void ChromeContentBrowserClient:: - const absl::optional& request_initiator_origin, +@@ -6076,12 +6089,25 @@ void ChromeContentBrowserClient:: + const std::optional& request_initiator_origin, NonNetworkURLLoaderFactoryMap* factories) { #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \ - !BUILDFLAG(IS_ANDROID) @@ -64,7 +64,7 @@ index d9c675c8aca73..8fbea741919d8 100644 #if BUILDFLAG(IS_CHROMEOS_ASH) if (web_contents) { -@@ -6327,6 +6353,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors( +@@ -6218,6 +6244,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors( scoped_refptr navigation_response_task_runner) { std::vector> interceptors; diff --git a/chromium_edits/121.0.6167.57/chrome/browser/flag-metadata.json.patch b/chromium_edits/124.0.6329.0/chrome/browser/flag-metadata.json.patch similarity index 76% rename from chromium_edits/121.0.6167.57/chrome/browser/flag-metadata.json.patch rename to chromium_edits/124.0.6329.0/chrome/browser/flag-metadata.json.patch index d5e31c6f..4357b1d3 100644 --- a/chromium_edits/121.0.6167.57/chrome/browser/flag-metadata.json.patch +++ b/chromium_edits/124.0.6329.0/chrome/browser/flag-metadata.json.patch @@ -1,9 +1,9 @@ diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json -index 34def551f4809..d79463d5f1647 100644 +index 5d16c3affafb9..b8b25c386a3fc 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json -@@ -2954,6 +2954,11 @@ - "owners": [ "hanxi@chromium.org", "wychen@chromium.org" ], +@@ -3022,6 +3022,11 @@ + "owners": [ "adamta@google.com", "chrome-feed-fundamentals@google.com" ], "expiry_milestone": 130 }, + { diff --git a/chromium_edits/121.0.6167.57/chrome/browser/flag_descriptions.cc.patch b/chromium_edits/124.0.6329.0/chrome/browser/flag_descriptions.cc.patch similarity index 67% rename from chromium_edits/121.0.6167.57/chrome/browser/flag_descriptions.cc.patch rename to chromium_edits/124.0.6329.0/chrome/browser/flag_descriptions.cc.patch index 7d181e2f..99c74538 100644 --- a/chromium_edits/121.0.6167.57/chrome/browser/flag_descriptions.cc.patch +++ b/chromium_edits/124.0.6329.0/chrome/browser/flag_descriptions.cc.patch @@ -1,10 +1,10 @@ diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 96296f3fc19ba..248436db82f5e 100644 +index 9ac6c5b7fee08..127145c7e22dd 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc -@@ -294,6 +294,11 @@ const char kEnableBenchmarkingDescription[] = - "after 3 restarts. On the third restart, the flag will appear to be off " - "but the effect is still active."; +@@ -297,6 +297,11 @@ const char kEnableBenchmarkingChoiceDefaultFeatureStates[] = + const char kEnableBenchmarkingChoiceMatchFieldTrialTestingConfig[] = + "Match Field Trial Testing Config"; +#if BUILDFLAG(ENABLE_IPFS) +extern const char kEnableIpfsName[] = "Enable IPFS"; diff --git a/chromium_edits/121.0.6167.57/chrome/browser/flag_descriptions.h.patch b/chromium_edits/124.0.6329.0/chrome/browser/flag_descriptions.h.patch similarity index 75% rename from chromium_edits/121.0.6167.57/chrome/browser/flag_descriptions.h.patch rename to chromium_edits/124.0.6329.0/chrome/browser/flag_descriptions.h.patch index cb57bcfe..e950f3bb 100644 --- a/chromium_edits/121.0.6167.57/chrome/browser/flag_descriptions.h.patch +++ b/chromium_edits/124.0.6329.0/chrome/browser/flag_descriptions.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index db57d73eef1a4..c09e291a54494 100644 +index 61be8f64d42fd..c48ed1e54d4ed 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h @@ -23,6 +23,7 @@ @@ -10,9 +10,9 @@ index db57d73eef1a4..c09e291a54494 100644 // This file declares strings used in chrome://flags. These messages are not // translated, because instead of end-users they target Chromium developers and -@@ -182,6 +183,11 @@ extern const char kDownloadWarningImprovementsDescription[]; - extern const char kEnableBenchmarkingName[]; - extern const char kEnableBenchmarkingDescription[]; +@@ -182,6 +183,11 @@ extern const char kEnableBenchmarkingChoiceDisabled[]; + extern const char kEnableBenchmarkingChoiceDefaultFeatureStates[]; + extern const char kEnableBenchmarkingChoiceMatchFieldTrialTestingConfig[]; +#if BUILDFLAG(ENABLE_IPFS) +extern const char kEnableIpfsName[]; diff --git a/chromium_edits/120.0.6099.200/chrome/browser/ipfs_extra_parts.cc b/chromium_edits/124.0.6329.0/chrome/browser/ipfs_extra_parts.cc similarity index 100% rename from chromium_edits/120.0.6099.200/chrome/browser/ipfs_extra_parts.cc rename to chromium_edits/124.0.6329.0/chrome/browser/ipfs_extra_parts.cc diff --git a/chromium_edits/120.0.6099.200/chrome/browser/ipfs_extra_parts.h b/chromium_edits/124.0.6329.0/chrome/browser/ipfs_extra_parts.h similarity index 100% rename from chromium_edits/120.0.6099.200/chrome/browser/ipfs_extra_parts.h rename to chromium_edits/124.0.6329.0/chrome/browser/ipfs_extra_parts.h diff --git a/chromium_edits/121.0.6167.57/chrome/browser/prefs/browser_prefs.cc.patch b/chromium_edits/124.0.6329.0/chrome/browser/prefs/browser_prefs.cc.patch similarity index 86% rename from chromium_edits/121.0.6167.57/chrome/browser/prefs/browser_prefs.cc.patch rename to chromium_edits/124.0.6329.0/chrome/browser/prefs/browser_prefs.cc.patch index 866c36ad..c43d86bf 100644 --- a/chromium_edits/121.0.6167.57/chrome/browser/prefs/browser_prefs.cc.patch +++ b/chromium_edits/124.0.6329.0/chrome/browser/prefs/browser_prefs.cc.patch @@ -1,16 +1,17 @@ diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc -index 2c9e95b07c762..bb7affe8bdb66 100644 +index ead26a869cfe0..a979df933cd2f 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc -@@ -190,6 +190,7 @@ +@@ -192,6 +192,8 @@ #include "printing/buildflags/buildflags.h" #include "rlz/buildflags/buildflags.h" - #include "third_party/abseil-cpp/absl/types/optional.h" + #include "services/screen_ai/buildflags/buildflags.h" +#include "third_party/ipfs_client/ipfs_buildflags.h" ++ #if BUILDFLAG(ENABLE_BACKGROUND_MODE) #include "chrome/browser/background/background_mode_manager.h" -@@ -241,6 +242,11 @@ +@@ -236,6 +238,11 @@ #include "chrome/browser/pdf/pdf_pref_names.h" #endif // BUILDFLAG(ENABLE_PDF) @@ -22,7 +23,7 @@ index 2c9e95b07c762..bb7affe8bdb66 100644 #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) #include "chrome/browser/screen_ai/pref_names.h" #endif -@@ -1728,6 +1734,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, +@@ -1775,6 +1782,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, IncognitoModePrefs::RegisterProfilePrefs(registry); invalidation::PerUserTopicSubscriptionManager::RegisterProfilePrefs(registry); invalidation::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry); diff --git a/chromium_edits/121.0.6167.57/chrome/common/chrome_content_client.cc.patch b/chromium_edits/124.0.6329.0/chrome/common/chrome_content_client.cc.patch similarity index 94% rename from chromium_edits/121.0.6167.57/chrome/common/chrome_content_client.cc.patch rename to chromium_edits/124.0.6329.0/chrome/common/chrome_content_client.cc.patch index 5bd09f16..8e7677e6 100644 --- a/chromium_edits/121.0.6167.57/chrome/common/chrome_content_client.cc.patch +++ b/chromium_edits/124.0.6329.0/chrome/common/chrome_content_client.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc -index 246ec9c5c911f..5d66d133a7907 100644 +index 76a5e7ea40232..60ae61f15612e 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -296,6 +296,12 @@ void ChromeContentClient::AddAdditionalSchemes(Schemes* schemes) { diff --git a/chromium_edits/120.0.6099.200/components/cbor/reader.cc.patch b/chromium_edits/124.0.6329.0/components/cbor/reader.cc.patch similarity index 80% rename from chromium_edits/120.0.6099.200/components/cbor/reader.cc.patch rename to chromium_edits/124.0.6329.0/components/cbor/reader.cc.patch index aed86452..a9c4a7b3 100644 --- a/chromium_edits/120.0.6099.200/components/cbor/reader.cc.patch +++ b/chromium_edits/124.0.6329.0/components/cbor/reader.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/cbor/reader.cc b/components/cbor/reader.cc -index 306ba52fa4944..6b13b3a679a65 100644 +index 3c31e3d05e5d3..5ad0dbb183884 100644 --- a/components/cbor/reader.cc +++ b/components/cbor/reader.cc @@ -22,7 +22,7 @@ @@ -11,7 +11,7 @@ index 306ba52fa4944..6b13b3a679a65 100644 } namespace { -@@ -156,7 +156,11 @@ absl::optional Reader::DecodeCompleteDataItem(const Config& config, +@@ -156,7 +156,11 @@ std::optional Reader::DecodeCompleteDataItem(const Config& config, case Value::Type::FLOAT_VALUE: // Floating point values also go here since they are also type 7. return DecodeToSimpleValueOrFloat(*header, config); @@ -24,11 +24,11 @@ index 306ba52fa4944..6b13b3a679a65 100644 case Value::Type::NONE: case Value::Type::INVALID_UTF8: break; -@@ -347,6 +351,17 @@ absl::optional Reader::ReadByteStringContent( +@@ -347,6 +351,17 @@ std::optional Reader::ReadByteStringContent( return Value(std::move(cbor_byte_string)); } -+absl::optional Reader::ReadTagContent( ++std::optional Reader::ReadTagContent( + const Reader::DataItemHeader& header, + const Config& config, + int max_nesting_level) { @@ -39,6 +39,6 @@ index 306ba52fa4944..6b13b3a679a65 100644 + return tagged_content; +} + - absl::optional Reader::ReadArrayContent( + std::optional Reader::ReadArrayContent( const Reader::DataItemHeader& header, const Config& config, diff --git a/chromium_edits/120.0.6099.200/components/cbor/reader.h.patch b/chromium_edits/124.0.6329.0/components/cbor/reader.h.patch similarity index 64% rename from chromium_edits/120.0.6099.200/components/cbor/reader.h.patch rename to chromium_edits/124.0.6329.0/components/cbor/reader.h.patch index fb821165..cd7d9eb0 100644 --- a/chromium_edits/120.0.6099.200/components/cbor/reader.h.patch +++ b/chromium_edits/124.0.6329.0/components/cbor/reader.h.patch @@ -1,5 +1,5 @@ diff --git a/components/cbor/reader.h b/components/cbor/reader.h -index f0b43a5517528..a57e277a1bc66 100644 +index 73c5dcb23e555..a933768608d73 100644 --- a/components/cbor/reader.h +++ b/components/cbor/reader.h @@ -130,6 +130,11 @@ class CBOR_EXPORT Reader { @@ -15,12 +15,12 @@ index f0b43a5517528..a57e277a1bc66 100644 Reader(const Reader&) = delete; @@ -204,6 +209,9 @@ class CBOR_EXPORT Reader { - absl::optional ReadMapContent(const DataItemHeader& header, - const Config& config, - int max_nesting_level); -+ absl::optional ReadTagContent(const DataItemHeader& header, + std::optional ReadMapContent(const DataItemHeader& header, + const Config& config, + int max_nesting_level); ++ std::optional ReadTagContent(const DataItemHeader& header, + const Config& config, + int max_nesting_level); - absl::optional ReadByte(); - absl::optional> ReadBytes(uint64_t num_bytes); + std::optional ReadByte(); + std::optional> ReadBytes(uint64_t num_bytes); bool IsKeyInOrder(const Value& new_key, diff --git a/chromium_edits/120.0.6099.200/components/cbor/reader_unittest.cc.patch b/chromium_edits/124.0.6329.0/components/cbor/reader_unittest.cc.patch similarity index 88% rename from chromium_edits/120.0.6099.200/components/cbor/reader_unittest.cc.patch rename to chromium_edits/124.0.6329.0/components/cbor/reader_unittest.cc.patch index 3f657dc3..150e0c73 100644 --- a/chromium_edits/120.0.6099.200/components/cbor/reader_unittest.cc.patch +++ b/chromium_edits/124.0.6329.0/components/cbor/reader_unittest.cc.patch @@ -1,8 +1,8 @@ diff --git a/components/cbor/reader_unittest.cc b/components/cbor/reader_unittest.cc -index 83d44a48d6dfa..a6ec5299b3241 100644 +index e5c02ceea3402..f26b8e77f6da3 100644 --- a/components/cbor/reader_unittest.cc +++ b/components/cbor/reader_unittest.cc -@@ -1451,5 +1451,42 @@ TEST(CBORReaderTest, AllowInvalidUTF8) { +@@ -1449,5 +1449,42 @@ TEST(CBORReaderTest, AllowInvalidUTF8) { EXPECT_FALSE(cbor); EXPECT_EQ(Reader::DecoderError::INVALID_UTF8, error); } @@ -14,7 +14,7 @@ index 83d44a48d6dfa..a6ec5299b3241 100644 + 0x9d, 0xf6, 0x3a, 0x36, 0x5b + }; + Reader::Config config; -+ absl::optional cbor = Reader::Read(kTaggedCbor, config); ++ auto cbor = Reader::Read(kTaggedCbor, config); + EXPECT_FALSE(cbor.has_value()); +} +TEST(CBORReaderTest, ReadsTagWhenConfiguredToDoSo) { @@ -26,7 +26,7 @@ index 83d44a48d6dfa..a6ec5299b3241 100644 + }; + Reader::Config config; + config.parse_tags = true; -+ absl::optional cbor = Reader::Read(kTaggedCbor, config); ++ auto cbor = Reader::Read(kTaggedCbor, config); + EXPECT_TRUE(cbor.has_value()); + auto& v = cbor.value(); + EXPECT_TRUE(v.has_tag()); diff --git a/chromium_edits/120.0.6099.200/components/cbor/values.cc.patch b/chromium_edits/124.0.6329.0/components/cbor/values.cc.patch similarity index 100% rename from chromium_edits/120.0.6099.200/components/cbor/values.cc.patch rename to chromium_edits/124.0.6329.0/components/cbor/values.cc.patch diff --git a/chromium_edits/120.0.6099.200/components/cbor/values.h.patch b/chromium_edits/124.0.6329.0/components/cbor/values.h.patch similarity index 100% rename from chromium_edits/120.0.6099.200/components/cbor/values.h.patch rename to chromium_edits/124.0.6329.0/components/cbor/values.h.patch diff --git a/chromium_edits/121.0.6167.57/components/cbor/writer.cc.patch b/chromium_edits/124.0.6329.0/components/cbor/writer.cc.patch similarity index 91% rename from chromium_edits/121.0.6167.57/components/cbor/writer.cc.patch rename to chromium_edits/124.0.6329.0/components/cbor/writer.cc.patch index 21fe28ce..bb89c1e6 100644 --- a/chromium_edits/121.0.6167.57/components/cbor/writer.cc.patch +++ b/chromium_edits/124.0.6329.0/components/cbor/writer.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/cbor/writer.cc b/components/cbor/writer.cc -index bb22754d36a07..aae4027836377 100644 +index f400a65e7b66a..fcdebb8f3b458 100644 --- a/components/cbor/writer.cc +++ b/components/cbor/writer.cc @@ -47,6 +47,9 @@ bool Writer::EncodeCBOR(const Value& node, diff --git a/chromium_edits/120.0.6099.200/components/cbor/writer_unittest.cc.patch b/chromium_edits/124.0.6329.0/components/cbor/writer_unittest.cc.patch similarity index 100% rename from chromium_edits/120.0.6099.200/components/cbor/writer_unittest.cc.patch rename to chromium_edits/124.0.6329.0/components/cbor/writer_unittest.cc.patch diff --git a/chromium_edits/120.0.6099.200/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch b/chromium_edits/124.0.6329.0/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch similarity index 95% rename from chromium_edits/120.0.6099.200/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch rename to chromium_edits/124.0.6329.0/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch index 891b53df..291d84f1 100644 --- a/chromium_edits/120.0.6099.200/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch +++ b/chromium_edits/124.0.6329.0/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/open_from_clipboard/clipboard_recent_content_generic.cc b/components/open_from_clipboard/clipboard_recent_content_generic.cc -index 4dcafecbc66c6..d205209c08162 100644 +index 32c4138ec358c..e9c62d51bf59b 100644 --- a/components/open_from_clipboard/clipboard_recent_content_generic.cc +++ b/components/open_from_clipboard/clipboard_recent_content_generic.cc @@ -20,7 +20,7 @@ diff --git a/chromium_edits/120.0.6099.200/net/dns/dns_config_service_linux.cc.patch b/chromium_edits/124.0.6329.0/net/dns/dns_config_service_linux.cc.patch similarity index 88% rename from chromium_edits/120.0.6099.200/net/dns/dns_config_service_linux.cc.patch rename to chromium_edits/124.0.6329.0/net/dns/dns_config_service_linux.cc.patch index a5e9863f..3b042d33 100644 --- a/chromium_edits/120.0.6099.200/net/dns/dns_config_service_linux.cc.patch +++ b/chromium_edits/124.0.6329.0/net/dns/dns_config_service_linux.cc.patch @@ -1,8 +1,8 @@ diff --git a/net/dns/dns_config_service_linux.cc b/net/dns/dns_config_service_linux.cc -index 5273da5190277..12b28b86a4c00 100644 +index f909f127ba3e1..31d7f9d58c0af 100644 --- a/net/dns/dns_config_service_linux.cc +++ b/net/dns/dns_config_service_linux.cc -@@ -272,11 +272,11 @@ bool IsNsswitchConfigCompatible( +@@ -271,11 +271,11 @@ bool IsNsswitchConfigCompatible( // Ignore any entries after `kDns` because Chrome will fallback to the // system resolver if a result was not found in DNS. return true; diff --git a/chromium_edits/120.0.6099.200/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch b/chromium_edits/124.0.6329.0/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch similarity index 100% rename from chromium_edits/120.0.6099.200/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch rename to chromium_edits/124.0.6329.0/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch diff --git a/chromium_edits/120.0.6099.200/url/BUILD.gn.patch b/chromium_edits/124.0.6329.0/url/BUILD.gn.patch similarity index 87% rename from chromium_edits/120.0.6099.200/url/BUILD.gn.patch rename to chromium_edits/124.0.6329.0/url/BUILD.gn.patch index 63fb8f8b..cc358ad4 100644 --- a/chromium_edits/120.0.6099.200/url/BUILD.gn.patch +++ b/chromium_edits/124.0.6329.0/url/BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/url/BUILD.gn b/url/BUILD.gn -index c525c166979d6..ce2b1ae43c0a7 100644 +index b5edb89f7698f..d299856674d7d 100644 --- a/url/BUILD.gn +++ b/url/BUILD.gn @@ -5,6 +5,7 @@ @@ -10,7 +10,7 @@ index c525c166979d6..ce2b1ae43c0a7 100644 import("features.gni") import("//build/config/cronet/config.gni") -@@ -67,6 +68,7 @@ component("url") { +@@ -68,6 +69,7 @@ component("url") { public_deps = [ "//base", "//build:robolectric_buildflags", @@ -18,7 +18,7 @@ index c525c166979d6..ce2b1ae43c0a7 100644 ] configs += [ "//build/config/compiler:wexit_time_destructors" ] -@@ -89,6 +91,11 @@ component("url") { +@@ -90,6 +92,11 @@ component("url") { public_configs = [ "//third_party/jdk" ] } diff --git a/chromium_edits/120.0.6099.200/url/url_canon.h.patch b/chromium_edits/124.0.6329.0/url/url_canon.h.patch similarity index 91% rename from chromium_edits/120.0.6099.200/url/url_canon.h.patch rename to chromium_edits/124.0.6329.0/url/url_canon.h.patch index 24ae1ba4..9f47d9c8 100644 --- a/chromium_edits/120.0.6099.200/url/url_canon.h.patch +++ b/chromium_edits/124.0.6329.0/url/url_canon.h.patch @@ -1,8 +1,8 @@ diff --git a/url/url_canon.h b/url/url_canon.h -index d3a7fabf09fa8..06db17242248f 100644 +index e8778694a9c46..b0bf281e557db 100644 --- a/url/url_canon.h +++ b/url/url_canon.h -@@ -697,6 +697,23 @@ bool CanonicalizeMailtoURL(const char16_t* spec, +@@ -804,6 +804,23 @@ bool CanonicalizeMailtoURL(const char16_t* spec, CanonOutput* output, Parsed* new_parsed); diff --git a/chromium_edits/121.0.6167.57/url/url_canon_ipfs.cc b/chromium_edits/124.0.6329.0/url/url_canon_ipfs.cc similarity index 98% rename from chromium_edits/121.0.6167.57/url/url_canon_ipfs.cc rename to chromium_edits/124.0.6329.0/url/url_canon_ipfs.cc index 9511e3f5..d7c9fdc7 100644 --- a/chromium_edits/121.0.6167.57/url/url_canon_ipfs.cc +++ b/chromium_edits/124.0.6329.0/url/url_canon_ipfs.cc @@ -35,7 +35,7 @@ bool url::CanonicalizeIpfsURL(const char* spec, Parsed parsed_input; ParseStandardURL(spec, spec_len, &parsed_input); return CanonicalizeStandardURL( - spec, spec_len, + spec, parsed_input, scheme_type, charset_converter, diff --git a/chromium_edits/124.0.6329.0/url/url_util.cc.patch b/chromium_edits/124.0.6329.0/url/url_util.cc.patch new file mode 100644 index 00000000..caa001ee --- /dev/null +++ b/chromium_edits/124.0.6329.0/url/url_util.cc.patch @@ -0,0 +1,22 @@ +diff --git a/url/url_util.cc b/url/url_util.cc +index 16875957448d2..b6ddd7a6c075c 100644 +--- a/url/url_util.cc ++++ b/url/url_util.cc +@@ -274,8 +274,15 @@ bool DoCanonicalize(const CHAR* spec, + } else if (DoCompareSchemeComponent(spec, scheme, url::kFileSystemScheme)) { + // Filesystem URLs are special. + ParseFileSystemURL(spec, spec_len, &parsed_input); +- success = CanonicalizeFileSystemURL(spec, parsed_input, charset_converter, +- output, output_parsed); ++ success = CanonicalizeFileSystemURL(spec, parsed_input, ++ charset_converter, output, ++ output_parsed); ++ ++ } else if (DoCompareSchemeComponent(spec, scheme, "ipfs")) { ++ // Switch multibase away from case-sensitive ones before continuing canonicalization. ++ ParseStandardURL(spec, spec_len, &parsed_input); ++ success = CanonicalizeIpfsURL(spec, spec_len, parsed_input, scheme_type, ++ charset_converter, output, output_parsed); + + } else if (DoIsStandard(spec, scheme, &scheme_type)) { + // All "normal" URLs. diff --git a/cmake/inc_link.py b/cmake/inc_link.py index 0396c71d..172fa6cc 100755 --- a/cmake/inc_link.py +++ b/cmake/inc_link.py @@ -199,6 +199,8 @@ def flesh_out() -> bool: t = readlink(f) existing_dir_map.add( (dirname(f), dirname(t)) ) for t, f in existing_dir_map: + if not isdir(f): + continue for entry in listdir(f): source = join(f,entry) target = join(t,entry) diff --git a/cmake/patch.py b/cmake/patch.py index 25475c0a..88639824 100755 --- a/cmake/patch.py +++ b/cmake/patch.py @@ -297,16 +297,24 @@ def out_of_date(self, p): dir_path = f'{self.edir}/{p}' if not isdir(dir_path): return True + file_path = join(dir_path,'components/cbor/reader_unittest.cc.patch') + if not isfile(file_path): + return True + with open(file_path) as f: + lines = list(map(lambda x: x.strip(), f.readlines())) + if '+ absl::optional cbor = Reader::Read(kTaggedCbor, config);' in lines: + verbose(p, 'Still relying on absl::optional in unit tests', file_path) + return True file_path = f'{self.pdir}/{p}.patch' if not isfile(file_path): return False with open(file_path) as f: - lines = f.readlines() + lines = list(map(lambda x: x.strip(), f.readlines())) if not Patcher.has_file_line(lines, 'chrome/browser/flag-metadata.json', '+ "name": "enable-ipfs",'): - verbose(p, 'does not have enable-ipfs in flag-metadata.json', file_path, file=sys.stderr) + verbose(p, 'does not have enable-ipfs in flag-metadata.json', file_path) return True if not Patcher.has_file_line(lines, 'chrome/browser/chrome_content_browser_client.cc', '+ main_parts->AddParts(std::make_unique());'): - verbose(p, 'does not have enable-ipfs in flag-metadata.json', file_path, file=sys.stderr) + verbose(p, 'does not have enable-ipfs in flag-metadata.json', file_path) return True return False @@ -332,14 +340,14 @@ def list_ood(self, to_check: list[str], sense: bool): oldest = self.oldest() verbose(f'Oldest supportable version: {oldest}') for p in to_check: - if (as_int(p) < oldest[0]) == sense: - print(p) - elif self.out_of_date(p) == sense: + if (as_int(p) < oldest[0] or self.out_of_date(p)) == sense: print(p) if __name__ == '__main__': - if argv[1] == 'apply': + if len(argv) < 2: + print('Give an argument to indicate what you\'d like to do.') + elif argv[1] == 'apply': Patcher('/mnt/big/lbl/code/chromium/src', 'git', 'Debug').apply() elif argv[1] == 'rec': print(osname()) diff --git a/component/README.md b/component/README.md index 1333ed77..dd42c780 100644 --- a/component/README.md +++ b/component/README.md @@ -1 +1,3 @@ -TODO +This directory becomes //components/ipfs inside of a Chromium source tree. + +It's the primary spot for Chromium-specific code involved in integrating trustless IPFS client functionality. diff --git a/component/chromium_dns_txt_lookup.cc b/component/chromium_dns_txt_lookup.cc index 6a59af1b..2b3074d5 100644 --- a/component/chromium_dns_txt_lookup.cc +++ b/component/chromium_dns_txt_lookup.cc @@ -9,7 +9,7 @@ void Self::SendDnsTextRequest(std::string host, DnsTextCompleteCallback don) { if (dns_reqs_.find(host) != dns_reqs_.end()) { // TODO: do combine two or delay this one. Don't drop the first one!! - VLOG(1) << "Requested resolution of DNSLink host " << host + VLOG(2) << "Requested resolution of DNSLink host " << host << " multiple times."; } auto don_wrap = [don, this, host]() { diff --git a/component/inter_request_state.cc b/component/inter_request_state.cc index 37424034..398b344b 100644 --- a/component/inter_request_state.cc +++ b/component/inter_request_state.cc @@ -21,7 +21,7 @@ constexpr char user_data_key[] = "ipfs_request_userdata"; void Self::CreateForBrowserContext(content::BrowserContext* c, PrefService* p) { DCHECK(c); DCHECK(p); - VLOG(1) << "Creating new IPFS state for this browser context."; + VLOG(2) << "Creating new IPFS state for this browser context."; auto owned = std::make_unique(c->GetPath(), p); c->SetUserData(user_data_key, std::move(owned)); } diff --git a/component/interceptor.cc b/component/interceptor.cc index a13abe9b..d07d0af2 100644 --- a/component/interceptor.cc +++ b/component/interceptor.cc @@ -31,7 +31,7 @@ void Interceptor::MaybeCreateLoader(network::ResourceRequest const& req, .Run(base::BindOnce(&ipfs::IpfsUrlLoader::StartRequest, loader)); } else { - LOG(INFO) << "Not intercepting " << req.url.spec(); + VLOG(2) << "Not intercepting " << req.url.spec(); std::move(loader_callback).Run({}); // SEP } } diff --git a/component/preferences.cc b/component/preferences.cc index 4dbc0af1..f9d03efc 100644 --- a/component/preferences.cc +++ b/component/preferences.cc @@ -8,7 +8,14 @@ #include namespace { -std::string const kRateLimit{"ipfs.gateways.rate_limits"}; +std::string const kGateway{"ipfs.gateway"}; +// std::string const kRateLimits{"ipfs.gateways.rate_limits"}; +std::string const kDiscoveryRate{"ipfs.discovery.rate"}; +std::string const kDiscoveryOfUnencrypted{"ipfs.discovery.http"}; + +std::string const kRateKey{"max_requests_per_minute"}; + +base::Value::Dict AsJson(ipfs::GatewaySpec const&); } void ipfs::RegisterPreferences(PrefRegistrySimple* service) { @@ -20,83 +27,152 @@ void ipfs::RegisterPreferences(PrefRegistrySimple* service) { if (!gw) { break; } - vals.Set(gw->prefix, static_cast(gw->rate)); - } - VLOG(2) << "Registering ipfs.gateways preference with a default value " - "that contains " - << vals.size() << " entries."; - for (auto [k, v] : vals) { - DCHECK(v.is_int()); + DCHECK(!(gw->prefix.empty())); + // vals.Set(gw->prefix, static_cast(gw->rate)); + vals.Set(gw->prefix, AsJson(*gw)); } - service->RegisterDictionaryPref(kRateLimit, std::move(vals)); + service->RegisterDictionaryPref(kGateway, std::move(vals)); + service->RegisterIntegerPref(kDiscoveryRate, 120); + service->RegisterBooleanPref(kDiscoveryOfUnencrypted, true); } using Self = ipfs::ChromiumIpfsGatewayConfig; Self::ChromiumIpfsGatewayConfig(PrefService* prefs) : prefs_{prefs} { if (prefs) { - last_ = prefs->GetDict(kRateLimit).Clone(); - for (auto [k, v] : last_) { - auto i = v.GetInt(); - curr_.Set(k, std::max(i, 1)); + last_ = prefs->GetDict(kGateway).Clone(); + curr_ = last_.Clone(); + for (auto [k, v] : curr_) { + DCHECK(!k.empty()); } - VLOG(1) << "Initialized with " << curr_.size() << " gateways."; } else { LOG(ERROR) << "Reading preferences without a preferences service is not great."; } } - -std::pair Self::at(std::size_t index) const { - if (index >= curr_.size()) { - return {nullptr, 0U}; - } - auto it = std::next(curr_.cbegin(), index); - auto* p_k = &(it->first); - auto v = static_cast(std::max(0, it->second.GetInt())); - return {p_k, v}; -} unsigned Self::GetGatewayRate(std::string_view k) { - auto i = std::max(0, curr_.FindInt(k).value_or(0)); - return static_cast(i); + if (auto* d = curr_.FindDict(k)) { + auto i = d->FindInt(kRateKey).value_or(0); + return static_cast(i); + } + return 0U; } void Self::SetGatewayRate(std::string_view k, unsigned val) { + DCHECK(!k.empty()); + auto* d = curr_.FindDict(k); + if (!d) { + LOG(ERROR) << "Don't set a rate for a not-yet-added gateway."; + AddGateway(k, val); + return; + } auto i = static_cast(std::min(val, static_cast(INT_MAX))); - auto old = curr_.contains(k); - curr_.Set(k, i); - if (!old) { - LOG(INFO) << "Added new gateway: " << k << '@' << val; - save(); - } else if (++changes > update_thresh) { - VLOG(2) << "Changing rate for gateway " << k << " to " << val; - auto d = delta(); - if (d > update_thresh) { + d->Set(kRateKey, i); + VLOG(1) << "Changing rate for gateway " << k << " to " << val; + if (++changes > update_thresh) { + auto delt = delta(); + if (delt > update_thresh) { save(); } else { - changes = d / 2; + changes = delt / 2; + LOG(INFO) << "Rate changes total (delta) " << delt; } } } -void Self::AddGateway(std::string_view k) { - SetGatewayRate(k, 120); +void Self::AddGateway(std::string_view k, unsigned r) { + DCHECK(!k.empty()); + if (auto* d = curr_.FindDict(k)) { + d->Set(kRateKey, d->FindInt(kRateKey).value_or(r) + 1); + } else { + auto j = AsJson(GatewaySpec{k, r}); + LOG(INFO) << static_cast(this) << " Adding " << k << " @ " << r + << " = " << j; + curr_.Set(k, std::move(j)); + } } auto Self::GetGateway(std::size_t index) const -> std::optional { - auto [k, r] = at(index); - if (k) { - return GatewaySpec{*k, r}; + if (index >= curr_.size()) { + return std::nullopt; + } + auto it = std::next(curr_.cbegin(), index); + auto* p_k = &(it->first); + DCHECK(!(p_k->empty())); + auto* vals = it->second.GetIfDict(); + if (!vals) { + LOG(WARNING) << "Gateway values were not Dict!!"; + return std::nullopt; + } + auto i = std::max(0, vals->FindInt(kRateKey).value_or(0)); + GatewaySpec result{*p_k, static_cast(i)}; + DCHECK_EQ(result.prefix, *p_k); + for (auto [k, v] : *vals) { + if (auto t = gw::from_name(k)) { + auto idx = static_cast(*t); + if (idx < static_cast(result.request_type_affinity.size())) { + result.request_type_affinity[idx] = v.GetInt(); + } + } } - return std::nullopt; + return result; } std::size_t Self::delta() const { std::size_t rv = 0; for (auto [k, v] : curr_) { - auto d = std::abs(v.GetInt() - last_.FindInt(k).value_or(0)); - rv += static_cast(d); + int c = 0; + int p = 0; + if (auto* curr_dict = v.GetIfDict()) { + c = curr_dict->FindInt(kRateKey).value_or(0); + } + if (auto* prev_dict = last_.FindDict(k)) { + p = prev_dict->FindInt(kRateKey).value_or(0); + } + auto off = std::abs(c - p); + if (off) { + VLOG(1) << k << " : " << p << " to " << c << " : absdiff=" << off; + rv += static_cast(off); + } } return rv; } void Self::save() { + VLOG(1) << "Saving preferences. Threshold: " << update_thresh; // Should be called on UI thread changes = 0; last_ = curr_.Clone(); update_thresh++; - prefs_->SetDict(kRateLimit, last_.Clone()); + prefs_->SetDict(kGateway, last_.Clone()); +} +unsigned Self::RoutingApiDiscoveryDefaultRate() const { + auto i = prefs_->GetInteger(kDiscoveryRate); + VLOG(2) << "RoutingApiDiscoveryDefaultRate=" << i; + return static_cast(i); +} +bool Self::RoutingApiDiscoveryOfUnencryptedGateways() const { + return prefs_->GetBoolean(kDiscoveryOfUnencrypted); +} +int Self::GetTypeAffinity(std::string_view url_prefix, + gw::GatewayRequestType typ) const { + if (auto* d = curr_.FindDict(url_prefix)) { + return d->FindInt(name(typ)).value_or(0); + } + return 0; +} +void Self::SetTypeAffinity(std::string_view url_prefix, + gw::GatewayRequestType typ, + int val) { + auto nm = name(typ); + VLOG(1) << "SetTypeAff(" << url_prefix << ',' << nm << ',' << val << ')'; + if (auto* d = curr_.FindDict(url_prefix)) { + d->Set(nm, val); + } +} + +namespace { +base::Value::Dict AsJson(ipfs::GatewaySpec const& s) { + base::Value::Dict d; + auto r = std::max(0U, s.rate); + d.Set(kRateKey, static_cast(r)); + for (auto i = 0U; i < s.request_type_affinity.size(); ++i) { + auto n = name(static_cast(i)); + d.Set(n, s.request_type_affinity[i]); + } + return d; } +} // namespace diff --git a/component/preferences.h b/component/preferences.h index e8b7c2d8..596be319 100644 --- a/component/preferences.h +++ b/component/preferences.h @@ -31,8 +31,15 @@ class ChromiumIpfsGatewayConfig final : public ipfs::ctx::GatewayConfig { unsigned GetGatewayRate(std::string_view) override; void SetGatewayRate(std::string_view, unsigned) override; std::optional GetGateway(std::size_t index) const override; - void AddGateway(std::string_view) override; - std::pair at(std::size_t index) const; + void AddGateway(std::string_view, unsigned) override; + // std::pair at(std::size_t index) const; + unsigned RoutingApiDiscoveryDefaultRate() const override; + bool RoutingApiDiscoveryOfUnencryptedGateways() const override; + int GetTypeAffinity(std::string_view url_prefix, + gw::GatewayRequestType) const override; + void SetTypeAffinity(std::string_view url_prefix, + gw::GatewayRequestType, + int) override; }; } diff --git a/library/include/ipfs_client/ctx/gateway_config.h b/library/include/ipfs_client/ctx/gateway_config.h index 42ac7273..4c20f461 100644 --- a/library/include/ipfs_client/ctx/gateway_config.h +++ b/library/include/ipfs_client/ctx/gateway_config.h @@ -12,9 +12,22 @@ class GatewayConfig { public: virtual ~GatewayConfig() noexcept {} virtual std::optional GetGateway(std::size_t index) const = 0; - virtual unsigned GetGatewayRate(std::string_view) = 0; - virtual void SetGatewayRate(std::string_view, unsigned) = 0; - virtual void AddGateway(std::string_view) = 0; + virtual unsigned GetGatewayRate(std::string_view url_prefix) = 0; + virtual int GetTypeAffinity(std::string_view url_prefix, + gw::GatewayRequestType) const = 0; + virtual void SetTypeAffinity(std::string_view url_prefix, + gw::GatewayRequestType, + int) = 0; + + // These 2 calls are similar, but AddGateway will ignore rpm if the gw is + // already present, + // while SetGatewayRate will override it, as that's its primary purpose. + virtual void SetGatewayRate(std::string_view url_prefix, unsigned rpm) = 0; + virtual void AddGateway(std::string_view url_prefix, unsigned rpm) = 0; + + // 0 implies off i.e. don't do this discovery + virtual unsigned RoutingApiDiscoveryDefaultRate() const = 0; + virtual bool RoutingApiDiscoveryOfUnencryptedGateways() const = 0; }; } // namespace ipfs::ctx diff --git a/library/include/ipfs_client/ctx/transitory_gateway_config.h b/library/include/ipfs_client/ctx/transitory_gateway_config.h index a2849f09..f5aa129e 100644 --- a/library/include/ipfs_client/ctx/transitory_gateway_config.h +++ b/library/include/ipfs_client/ctx/transitory_gateway_config.h @@ -15,7 +15,14 @@ class TransitoryGatewayConfig : public GatewayConfig { std::optional GetGateway(std::size_t index) const override; unsigned GetGatewayRate(std::string_view) override; void SetGatewayRate(std::string_view, unsigned) override; - void AddGateway(std::string_view) override; + void AddGateway(std::string_view, unsigned) override; + unsigned RoutingApiDiscoveryDefaultRate() const override; + bool RoutingApiDiscoveryOfUnencryptedGateways() const override; + int GetTypeAffinity(std::string_view url_prefix, + gw::GatewayRequestType) const override; + void SetTypeAffinity(std::string_view url_prefix, + gw::GatewayRequestType, + int) override; TransitoryGatewayConfig(); }; diff --git a/library/include/ipfs_client/gateway_spec.h b/library/include/ipfs_client/gateway_spec.h index 159e68d4..1333d22e 100644 --- a/library/include/ipfs_client/gateway_spec.h +++ b/library/include/ipfs_client/gateway_spec.h @@ -1,18 +1,26 @@ #ifndef IPFS_GATEWAY_SPEC_H_ #define IPFS_GATEWAY_SPEC_H_ +#include +#include #include namespace ipfs { struct GatewaySpec { std::string prefix; unsigned rate; + std::array request_type_affinity; + bool operator<(GatewaySpec const& r) const { if (rate == r.rate) { return prefix < r.prefix; } return rate > r.rate; } + explicit GatewaySpec(std::string_view pre, unsigned r) + : prefix{pre}, rate{r} { + request_type_affinity.fill(0); + } }; } // namespace ipfs diff --git a/library/include/ipfs_client/gw/gateway_request.h b/library/include/ipfs_client/gw/gateway_request.h index a5a5939e..f6607b0e 100644 --- a/library/include/ipfs_client/gw/gateway_request.h +++ b/library/include/ipfs_client/gw/gateway_request.h @@ -11,6 +11,7 @@ #include #include #include +#include "gateway_request_type.h" namespace ipfs { class IpfsRequest; @@ -23,16 +24,7 @@ class DagNode; namespace ipfs::gw { class Requestor; -enum class Type : char { - Block, - Car, - Ipns, - DnsLink, - Providers, - Identity, - Zombie -}; -std::string_view name(Type); +std::string_view name(GatewayRequestType); constexpr std::size_t BLOCK_RESPONSE_BUFFER_SIZE = 2 * 1024 * 1024; @@ -43,7 +35,7 @@ class GatewayRequest { void ParseNodes(std::string_view, Client* api); public: - Type type = Type::Zombie; + GatewayRequestType type = GatewayRequestType::Zombie; std::string main_param; ///< CID, IPNS name, hostname std::string path; ///< For CAR requests std::shared_ptr dependent; @@ -76,7 +68,8 @@ class GatewayRequest { } // namespace ipfs::gw -inline std::ostream& operator<<(std::ostream& s, ipfs::gw::Type t) { +inline std::ostream& operator<<(std::ostream& s, + ipfs::gw::GatewayRequestType t) { return s << name(t); } diff --git a/library/include/ipfs_client/gw/gateway_request_type.h b/library/include/ipfs_client/gw/gateway_request_type.h new file mode 100644 index 00000000..f825b7d3 --- /dev/null +++ b/library/include/ipfs_client/gw/gateway_request_type.h @@ -0,0 +1,24 @@ +#ifndef IPFS_CHROMIUM_GATEWAY_REQUEST_TYPE_H +#define IPFS_CHROMIUM_GATEWAY_REQUEST_TYPE_H + +#include +#include + +namespace ipfs::gw { +enum class GatewayRequestType : char { + Block, + Car, + Ipns, + DnsLink, + Providers, + Identity, + Zombie +}; +std::string_view name(GatewayRequestType t); +std::optional from_name(std::string_view); +constexpr std::size_t RequestTypeCount = + static_cast(gw::GatewayRequestType::Zombie); + +} // namespace ipfs::gw + +#endif // IPFS_CHROMIUM_GATEWAY_REQUEST_TYPE_H diff --git a/library/include/ipfs_client/gw/requestor.h b/library/include/ipfs_client/gw/requestor.h index 6c1d86f3..f00a14f1 100644 --- a/library/include/ipfs_client/gw/requestor.h +++ b/library/include/ipfs_client/gw/requestor.h @@ -44,7 +44,7 @@ class Requestor : public std::enable_shared_from_this { virtual ~Requestor() noexcept {} void request(std::shared_ptr); Requestor& or_else(std::shared_ptr p); - void api(std::shared_ptr); + Requestor& api(std::shared_ptr); void TestAccess(void*); diff --git a/library/src/ipfs_client/client.cc b/library/src/ipfs_client/client.cc index c50de381..9d5bc75f 100644 --- a/library/src/ipfs_client/client.cc +++ b/library/src/ipfs_client/client.cc @@ -73,7 +73,7 @@ std::string Self::UnescapeUrlComponent(std::string_view url_comp) { auto Self::partition(std::string key) -> std::shared_ptr { auto& part = partitions_[key]; if (!part) { - LOG(INFO) << "New partition for key '" << key << "'."; + VLOG(1) << "New partition for key '" << key << "'."; part = std::make_shared(requestor(), shared_from_this()); } return part; diff --git a/library/src/ipfs_client/ctx/default_gateways.cc b/library/src/ipfs_client/ctx/default_gateways.cc index 31118d40..d5d2f09d 100644 --- a/library/src/ipfs_client/ctx/default_gateways.cc +++ b/library/src/ipfs_client/ctx/default_gateways.cc @@ -13,6 +13,7 @@ bool ctx::LoadGatewaysFromEnvironmentVariable(ipfs::ctx::GatewayConfig& cfg) { } std::istringstream user_override{ovr}; std::string gw; + bool at_least_one = false; while (user_override >> gw) { if (gw.empty()) { continue; @@ -20,40 +21,41 @@ bool ctx::LoadGatewaysFromEnvironmentVariable(ipfs::ctx::GatewayConfig& cfg) { if (gw.back() != '/') { gw.push_back('/'); } - cfg.AddGateway(gw); + cfg.AddGateway(gw, 300U); + at_least_one = true; } - return true; + return at_least_one; } void ctx::LoadStaticGatewayList(ipfs::ctx::GatewayConfig& cfg) { auto static_list = { - std::pair{"http://localhost:8080/", 12'100}, - {"https://ipfs.io/", 751}, - {"https://dag.w3s.link/", 213}, - {"https://gateway.ipfs.io/", 589}, - {"https://jcsl.hopto.org/", 695}, - {"https://ipfs.runfission.com/", 119}, - {"https://delegated-ipfs.dev/", 75}, - {"https://human.mypinata.cloud/", 305}, - {"https://cesginc.com/", 50}, - {"https://permaweb.eu.org/", 54}, - {"https://dweb.link/", 53}, - {"https://http.f02620.devtty.eu/", 50}, - {"https://f010479.twinquasar.io/", 36}, - {"https://ipfs.joaoleitao.org/", 34}, - {"https://gateway.pinata.cloud/", 15}, - {"http://f02095132.datasetcreators.com/", 13}, - {"https://nftstorage.link/", 7}, - {"https://ipfs.omnicloudstorage.com:9443/", 6}, - {"https://ipfs.fleek.co/", 5}, + std::pair{"http://127.0.0.1:8080/", 12'070}, + {"https://ipfs.io/", 649}, + {"https://jcsl.hopto.org/", 600}, + {"https://gateway.ipfs.io/", 499}, + {"https://delegated-ipfs.dev/", 308}, + {"https://human.mypinata.cloud/", 176}, + {"https://ipfs.joaoleitao.org/", 134}, + {"https://dag.w3s.link/", 50}, + {"https://ipfs.eth.aragon.network/", 19}, + {"https://cloudflare-ipfs.com/", 16}, + {"https://cf-ipfs.com/", 15}, + {"https://ipfs.runfission.com/", 14}, + {"https://nftstorage.link/", 13}, + {"https://permaweb.eu.org/", 12}, + {"https://ipfs.fleek.co/", 11}, + {"https://dweb.link/", 10}, + {"https://trustless-gateway.link/", 9}, + {"https://4everland.io/", 8}, + {"https://cesginc.com/", 7}, + {"https://f010479.twinquasar.io/", 6}, + {"https://hardbin.com/", 5}, {"https://data.filstorage.io/", 4}, {"https://w3s.link/", 3}, - {"https://hardbin.com/", 2}, - {"https://ipfs.jpu.jp/", 1}, - {"https://jorropo.net/", 0}, - }; + {"https://ipfs.omnicloudstorage.com:9443/", 2}, + {"https://http.f02620.devtty.eu/", 1}, + {"https://gateway.pinata.cloud/", 0}}; for (auto [gw, rt] : static_list) { - cfg.AddGateway(gw); - cfg.SetGatewayRate(gw, rt); + cfg.AddGateway(gw, rt); } } diff --git a/library/src/ipfs_client/ctx/transitory_gateway_config.cc b/library/src/ipfs_client/ctx/transitory_gateway_config.cc index 1eeeb272..e34fe6d2 100644 --- a/library/src/ipfs_client/ctx/transitory_gateway_config.cc +++ b/library/src/ipfs_client/ctx/transitory_gateway_config.cc @@ -21,15 +21,12 @@ std::optional Self::GetGateway(std::size_t index) const { } return std::nullopt; } -void Self::AddGateway(std::string_view prefix) { +void Self::AddGateway(std::string_view prefix, unsigned at_rate) { auto it = FindGateway(prefix); if (gateways_.end() != it && it->prefix == prefix) { it->rate++; - VLOG(1) << "Re-found existing gateway. Bumping it: " << prefix << '=' - << it->rate; } else { - VLOG(1) << "Adding new gateway:" << prefix; - gateways_.insert(it, GatewaySpec{std::string{prefix}, 60U}); + gateways_.insert(it, GatewaySpec{std::string{prefix}, at_rate}); DCHECK( std::is_sorted(gateways_.begin(), gateways_.end(), [](auto& a, auto& b) { return a.prefix < b.prefix; })); @@ -53,4 +50,14 @@ auto Self::FindGateway(std::string_view prefix) -> std::vector::iterator { auto cmp = [](auto& g, std::string_view p) { return g.prefix < p; }; return std::lower_bound(gateways_.begin(), gateways_.end(), prefix, cmp); -} \ No newline at end of file +} +unsigned Self::RoutingApiDiscoveryDefaultRate() const { + return 60U; +} +bool Self::RoutingApiDiscoveryOfUnencryptedGateways() const { + return false; +} +int Self::GetTypeAffinity(std::string_view, gw::GatewayRequestType) const { + return 9; +} +void Self::SetTypeAffinity(std::string_view, gw::GatewayRequestType, int) {} diff --git a/library/src/ipfs_client/gw/block_request_splitter.cc b/library/src/ipfs_client/gw/block_request_splitter.cc index 85914a75..dffa342c 100644 --- a/library/src/ipfs_client/gw/block_request_splitter.cc +++ b/library/src/ipfs_client/gw/block_request_splitter.cc @@ -1,6 +1,9 @@ #include #include +#include + +#include "log_macros.h" #include @@ -10,26 +13,33 @@ std::string_view Self::name() const { return "BlockRequestSplitter"; } auto Self::handle(ipfs::gw::RequestPtr r) -> HandleOutcome { - if (r->type != Type::Car) { + if (r->type != GatewayRequestType::Car) { return HandleOutcome::NOT_HANDLED; } { auto br = std::make_shared(*r); - br->type = Type::Block; + br->type = GatewayRequestType::Block; br->path.clear(); forward(br); } - auto it = std::find(recent_provider_requests.begin(), - recent_provider_requests.end(), r->affinity); - if (recent_provider_requests.end() == it) { - auto i = old_provider_request % recent_provider_requests.size(); - recent_provider_requests[i] = r->affinity; - ++old_provider_request; - auto pr = std::make_shared(*r); - pr->type = Type::Providers; - pr->path.clear(); - pr->affinity.clear(); - forward(pr); + if (api_ && api_->gw_cfg().RoutingApiDiscoveryDefaultRate()) { + auto it = std::find(recent_provider_requests.begin(), + recent_provider_requests.end(), r->affinity); + if (recent_provider_requests.end() == it) { + auto i = old_provider_request % recent_provider_requests.size(); + recent_provider_requests[i] = r->affinity; + ++old_provider_request; + auto pr = std::make_shared(*r); + pr->type = GatewayRequestType::Providers; + pr->path.clear(); + pr->affinity.clear(); + LOG(INFO) << "Forwarding providers' split: " << pr->affinity; + forward(pr); + } else { + VLOG(1) << "Not re-requesting providers for '" << r->affinity << "'."; + } + } else if (++old_provider_request == 1UL) { + LOG(INFO) << "Routing requests disabled."; } return HandleOutcome::NOT_HANDLED; -} \ No newline at end of file +} diff --git a/library/src/ipfs_client/gw/block_request_splitter_unittest.cc b/library/src/ipfs_client/gw/block_request_splitter_unittest.cc index 08bff298..39cba001 100644 --- a/library/src/ipfs_client/gw/block_request_splitter_unittest.cc +++ b/library/src/ipfs_client/gw/block_request_splitter_unittest.cc @@ -1,9 +1,10 @@ #include -#include +#include #include #include +#include "ipfs_client/gw/gateway_request_type.h" namespace g = ipfs::gw; @@ -23,10 +24,11 @@ struct Recording : public g::Requestor { TEST(BlockRequestSplitterTest, split2three) { Tested tested; + tested.api(std::make_shared()); auto rec = std::make_shared(); tested.or_else(rec); auto req = std::make_shared(); - req->type = g::Type::Car; + req->type = RT::Car; req->main_param = "cid"; req->path = "path"; req->parallel = 123; @@ -34,17 +36,17 @@ TEST(BlockRequestSplitterTest, split2three) { req->dependent = std::make_shared("", [](auto&, auto&) {}); tested.request(req); EXPECT_EQ(rec->requests_received.size(), 3U); - EXPECT_TRUE(rec->requests_received.at(0)->type == g::Type::Block) << -static_cast(rec->requests_received.at(0)->type); + EXPECT_TRUE(rec->requests_received.at(0)->type == RT::Block) + << static_cast(rec->requests_received.at(0)->type); EXPECT_EQ(rec->requests_received.at(0)->main_param, "cid"); EXPECT_EQ(rec->requests_received.at(0)->path, ""); - EXPECT_TRUE(rec->requests_received.at(1)->type == g::Type::Providers) + EXPECT_TRUE(rec->requests_received.at(1)->type == RT::Providers) << static_cast(rec->requests_received.at(2)->type); EXPECT_EQ(rec->requests_received.at(1)->main_param, "cid"); EXPECT_EQ(rec->requests_received.at(1)->path, ""); - EXPECT_TRUE(rec->requests_received.at(2)->type == g::Type::Car) + EXPECT_TRUE(rec->requests_received.at(2)->type == RT::Car) << static_cast(rec->requests_received.at(2)->type); EXPECT_EQ(rec->requests_received.at(2)->main_param, "cid"); EXPECT_EQ(rec->requests_received.at(2)->path, "path"); diff --git a/library/src/ipfs_client/gw/default_requestor.cc b/library/src/ipfs_client/gw/default_requestor.cc index 30e316ee..be2976e7 100644 --- a/library/src/ipfs_client/gw/default_requestor.cc +++ b/library/src/ipfs_client/gw/default_requestor.cc @@ -10,10 +10,9 @@ auto ipfs::gw::default_requestor(std::shared_ptr early, std::shared_ptr api) -> std::shared_ptr { auto result = std::make_shared(); - result->or_else(std::make_shared()); + result->api(api).or_else(std::make_shared()); if (early) { result->or_else(early); - early->api(api); } result->or_else(std::make_shared(api)) .or_else(std::make_shared()) diff --git a/library/src/ipfs_client/gw/dnslink_requestor.cc b/library/src/ipfs_client/gw/dnslink_requestor.cc index d44c35a5..0db2a4ce 100644 --- a/library/src/ipfs_client/gw/dnslink_requestor.cc +++ b/library/src/ipfs_client/gw/dnslink_requestor.cc @@ -9,6 +9,7 @@ #include #include +#include "ipfs_client/gw/gateway_request_type.h" #include "log_macros.h" #include @@ -28,7 +29,7 @@ bool parse_results(ipfs::gw::RequestPtr req, std::shared_ptr const&); } auto Self::handle(ipfs::gw::RequestPtr req) -> HandleOutcome { - if (req->type != Type::DnsLink) { + if (req->type != GatewayRequestType::DnsLink) { return HandleOutcome::NOT_HANDLED; } // std::function requires target be copy-constructible @@ -56,7 +57,7 @@ bool parse_results(ipfs::gw::RequestPtr req, << req->main_param << " looking for dnslink..."; for (auto& result : results) { if (starts_with(result, prefix)) { - VLOG(1) << "DNSLink result=" << result; + VLOG(2) << "DNSLink result=" << result; req->RespondSuccessfully(result.substr(prefix.size()), api); return true; } else { diff --git a/library/src/ipfs_client/gw/gateway_request.cc b/library/src/ipfs_client/gw/gateway_request.cc index bf54180f..4ca7c933 100644 --- a/library/src/ipfs_client/gw/gateway_request.cc +++ b/library/src/ipfs_client/gw/gateway_request.cc @@ -39,17 +39,18 @@ std::shared_ptr Self::fromIpfsPath(ipfs::SlashDelimited p) { return {}; } if (r->cid.value().hash_type() == HashType::IDENTITY) { - r->type = Type::Identity; + r->type = GatewayRequestType::Identity; } else { r->path = p.pop_all(); - r->type = r->path.empty() ? Type::Block : Type::Car; + r->type = + r->path.empty() ? GatewayRequestType::Block : GatewayRequestType::Car; } } else if (name_space == "ipns") { r->path = p.pop_all(); if (Cid(r->main_param).valid()) { - r->type = Type::Ipns; + r->type = GatewayRequestType::Ipns; } else { - r->type = Type::DnsLink; + r->type = GatewayRequestType::DnsLink; } } else { LOG(FATAL) << "Unsupported namespace in ipfs path: /" << name_space << '/' @@ -60,22 +61,22 @@ std::shared_ptr Self::fromIpfsPath(ipfs::SlashDelimited p) { std::string Self::url_suffix() const { switch (type) { - case Type::Block: + case GatewayRequestType::Block: return "/ipfs/" + main_param; - case Type::Car: + case GatewayRequestType::Car: return "/ipfs/" + main_param + "/" + path + "?dag-scope=entity"; - case Type::Ipns: + case GatewayRequestType::Ipns: return "/ipns/" + main_param; - case Type::Providers: + case GatewayRequestType::Providers: return "/routing/v1/providers/" + main_param; - case Type::DnsLink: + case GatewayRequestType::DnsLink: LOG(FATAL) << "Don't try to use HTTP(s) for DNS TXT records."; #ifdef __clang__ #pragma clang diagnostic ignored "-Wunreachable-code-return" #endif return {}; - case Type::Identity: - case Type::Zombie: + case GatewayRequestType::Identity: + case GatewayRequestType::Zombie: return {}; } LOG(FATAL) << "Unhandled gateway request type: " << static_cast(type); @@ -83,15 +84,15 @@ std::string Self::url_suffix() const { } std::string_view Self::accept() const { switch (type) { - case Type::Block: + case GatewayRequestType::Block: return "application/vnd.ipld.raw"sv; - case Type::Ipns: + case GatewayRequestType::Ipns: return "application/vnd.ipfs.ipns-record"sv; - case Type::Car: + case GatewayRequestType::Car: return "application/vnd.ipld.car"sv; - case Type::Providers: + case GatewayRequestType::Providers: return "application/json"sv; - case Type::DnsLink: + case GatewayRequestType::DnsLink: // TODO : not sure this advice is 100% good, actually. // If the user's system setup allows for text records to actually work, // it would be good to respect their autonomy and try to follow the @@ -101,8 +102,8 @@ std::string_view Self::accept() const { // DNSLink capability. LOG(FATAL) << "Don't try to use HTTP(s) for DNS TXT records."; return {}; - case Type::Identity: - case Type::Zombie: + case GatewayRequestType::Identity: + case GatewayRequestType::Zombie: return {}; } LOG(FATAL) << "Invalid gateway request type: " << static_cast(type); @@ -110,18 +111,18 @@ std::string_view Self::accept() const { } short Self::timeout_seconds() const { switch (type) { - case Type::DnsLink: - return 4; - case Type::Block: + case GatewayRequestType::DnsLink: return 8; - case Type::Providers: + case GatewayRequestType::Providers: return 16; - case Type::Car: + case GatewayRequestType::Block: return 32; - case Type::Ipns: + case GatewayRequestType::Car: return 64; - case Type::Identity: - case Type::Zombie: + case GatewayRequestType::Ipns: + return 128; + case GatewayRequestType::Identity: + case GatewayRequestType::Zombie: return 0; } LOG(FATAL) << "timeout_seconds() called for unsupported gateway request type " @@ -130,7 +131,7 @@ short Self::timeout_seconds() const { } auto Self::identity_data() const -> std::string_view { - if (type != Type::Identity) { + if (type != GatewayRequestType::Identity) { return ""; } auto hash = cid.value().hash(); @@ -140,14 +141,14 @@ auto Self::identity_data() const -> std::string_view { bool Self::is_http() const { switch (type) { - case Type::Ipns: - case Type::Car: - case Type::Block: - case Type::Providers: + case GatewayRequestType::Ipns: + case GatewayRequestType::Car: + case GatewayRequestType::Block: + case GatewayRequestType::Providers: return true; - case Type::Identity: - case Type::DnsLink: - case Type::Zombie: + case GatewayRequestType::Identity: + case GatewayRequestType::DnsLink: + case GatewayRequestType::Zombie: return false; } return true; @@ -169,15 +170,15 @@ auto Self::describe_http(std::string_view prefix) const } std::optional Self::max_response_size() const { switch (type) { - case Type::Identity: + case GatewayRequestType::Identity: return 0; - case Type::DnsLink: + case GatewayRequestType::DnsLink: return std::nullopt; - case Type::Ipns: + case GatewayRequestType::Ipns: return MAX_IPNS_PB_SERIALIZED_SIZE; - case Type::Block: + case GatewayRequestType::Block: return BLOCK_RESPONSE_BUFFER_SIZE; - case Type::Car: { + case GatewayRequestType::Car: { // There could be an unlimited number of blocks in the CAR // The _floor_ is the number of path components. // But one path component could be a HAMT sharded directory that we may @@ -186,9 +187,9 @@ std::optional Self::max_response_size() const { // number of blocks in it. return std::nullopt; } - case Type::Zombie: + case GatewayRequestType::Zombie: return 0; - case Type::Providers: + case GatewayRequestType::Providers: // This one's tricky. // One could easily guess a practical limit to the size of a Peer's // json, and the spec says it SHOULD be limited to 100 peers. @@ -201,40 +202,18 @@ std::optional Self::max_response_size() const { LOG(ERROR) << "Invalid gateway request type " << static_cast(type); return std::nullopt; } -std::string_view ipfs::gw::name(ipfs::gw::Type t) { - using ipfs::gw::Type; - switch (t) { - case Type::Block: - return "Block"; - case Type::Car: - return "Car"; - case Type::Ipns: - return "Ipns"; - case Type::DnsLink: - return "DnsLink"; - case Type::Providers: - return "Providers"; - case Type::Identity: - return "Identity"; - case Type::Zombie: - return "CompletedRequest"; - } - static std::array buf; - std::sprintf(buf.data(), "InvalidType %d", static_cast(t)); - return buf.data(); -} bool Self::cachable() const { - using ipfs::gw::Type; + using ipfs::gw::GatewayRequestType; switch (type) { - case Type::Car: + case GatewayRequestType::Car: return path.find("/ipns/") == std::string::npos; - case Type::Block: - case Type::Ipns: + case GatewayRequestType::Block: + case GatewayRequestType::Ipns: return true; - case Type::DnsLink: - case Type::Providers: - case Type::Identity: - case Type::Zombie: + case GatewayRequestType::DnsLink: + case GatewayRequestType::Providers: + case GatewayRequestType::Identity: + case GatewayRequestType::Zombie: return false; } LOG(ERROR) << "Unhandled request type: " << debug_string(); @@ -266,7 +245,7 @@ bool Self::RespondSuccessfully(std::string_view bytes, *valid = false; } switch (type) { - case Type::Block: { + case GatewayRequestType::Block: { DCHECK(cid.has_value()); if (!cid.has_value()) { LOG(ERROR) << "Your CID doesn't even have a value!"; @@ -281,14 +260,14 @@ bool Self::RespondSuccessfully(std::string_view bytes, } success = orchestrator_->add_node(main_param, node); } break; - case Type::Identity: + case GatewayRequestType::Identity: success = orchestrator_->add_node( main_param, std::make_shared(std::string{bytes})); if (valid) { *valid = true; } break; - case Type::Ipns: + case GatewayRequestType::Ipns: if (cid.has_value()) { DCHECK(api); auto byte_ptr = reinterpret_cast(bytes.data()); @@ -299,8 +278,8 @@ bool Self::RespondSuccessfully(std::string_view bytes, success = orchestrator_->add_node(main_param, node); if (valid) { *valid = !node->expired(); - LOG(INFO) << "IPNS node created " << main_param << ' ' << success - << " vs. " << *valid; + VLOG(1) << "IPNS node created " << main_param << ' ' << success + << " vs. " << *valid; } } else { LOG(ERROR) << "IPNS record failed to validate!"; @@ -308,8 +287,8 @@ bool Self::RespondSuccessfully(std::string_view bytes, } } break; - case Type::DnsLink: { - VLOG(1) << "Resolved " << debug_string() << " to " << bytes; + case GatewayRequestType::DnsLink: { + VLOG(2) << "Resolved " << debug_string() << " to " << bytes; auto node = std::make_shared(bytes); if (orchestrator_) { success = orchestrator_->add_node(main_param, node); @@ -320,7 +299,7 @@ bool Self::RespondSuccessfully(std::string_view bytes, *valid = !node->expired(); } } break; - case Type::Car: { + case GatewayRequestType::Car: { DCHECK(api); Car car(as_bytes(bytes), *api); while (auto block = car.NextBlock()) { @@ -339,13 +318,13 @@ bool Self::RespondSuccessfully(std::string_view bytes, } break; } - case Type::Providers: + case GatewayRequestType::Providers: success = providers::ProcessResponse(bytes, *api); if (valid) { *valid = success; } break; - case Type::Zombie: + case GatewayRequestType::Zombie: LOG(WARNING) << "Responding to a zombie is ill-advised."; break; default: @@ -357,7 +336,7 @@ bool Self::RespondSuccessfully(std::string_view bytes, } bytes_received_hooks.clear(); orchestrator_->build_response(dependent); - type = Type::Zombie; + type = GatewayRequestType::Zombie; } return success; } @@ -377,5 +356,11 @@ bool Self::PartiallyRedundant() const { return orchestrator_->has_key(main_param); } bool Self::Finished() const { - return type == Type::Zombie || !dependent || dependent->done(); + if (type == GatewayRequestType::Zombie) { + return true; + } + if (type == GatewayRequestType::Providers) { + return false; + } + return !dependent || dependent->done(); } diff --git a/library/src/ipfs_client/gw/gateway_request_type.cc b/library/src/ipfs_client/gw/gateway_request_type.cc new file mode 100644 index 00000000..10492cf6 --- /dev/null +++ b/library/src/ipfs_client/gw/gateway_request_type.cc @@ -0,0 +1,55 @@ +#include + +#include +#include + +#include + +auto ipfs::gw::from_name(std::string_view name) + -> std::optional { + using T = GatewayRequestType; + if (name == "Block") { + return T::Block; + } + if (name == "Car") { + return T::Car; + } + if (name == "Ipns") { + return T::Ipns; + } + if (name == "DnsLink") { + return T::DnsLink; + } + if (name == "Providers") { + return T::Providers; + } + if (name == "Identity") { + return T::Identity; + } + if (name == "CompletedRequest") { + return T::Zombie; + } + return std::nullopt; +} +std::string_view ipfs::gw::name(GatewayRequestType t) { + using ipfs::gw::GatewayRequestType; + switch (t) { + case GatewayRequestType::Block: + return "Block"; + case GatewayRequestType::Car: + return "Car"; + case GatewayRequestType::Ipns: + return "Ipns"; + case GatewayRequestType::DnsLink: + return "DnsLink"; + case GatewayRequestType::Providers: + return "Providers"; + case GatewayRequestType::Identity: + return "Identity"; + case GatewayRequestType::Zombie: + return "CompletedRequest"; + } + static std::array buf; + std::sprintf(buf.data(), "InvalidType %d", static_cast(t)); + return buf.data(); +} diff --git a/library/src/ipfs_client/gw/gateway_request_unittest.cc b/library/src/ipfs_client/gw/gateway_request_unittest.cc index 0f11dfcd..8792c052 100644 --- a/library/src/ipfs_client/gw/gateway_request_unittest.cc +++ b/library/src/ipfs_client/gw/gateway_request_unittest.cc @@ -3,6 +3,7 @@ #include #include +#include "ipfs_client/gw/gateway_request_type.h" using T = ig::GatewayRequest; @@ -65,7 +66,7 @@ struct GatewayRequestTest : public testing::Test { TEST_F(GatewayRequestTest, RespondsToCar) { t_.cid = i::Cid{"bafybeibwfakyszctcz54dungqay7jae35agjjhokltvvtboospgo6napxy"}; - t_.type = ig::Type::Car; + t_.type = RT::Car; auto p = reinterpret_cast(a_car.data()); EXPECT_FALSE(orc->has_key( "bafkreidxbzqhmjgwretfzjwejccnbad5tmcu2i6eopaqnrzl5hparnzxnq")); @@ -82,26 +83,26 @@ TEST_F(GatewayRequestTest, RespondsToCar) { "bafybeibwfakyszctcz54dungqay7jae35agjjhokltvvtboospgo6napxy")); } TEST_F(GatewayRequestTest, suffices) { - t_.type = ig::Type::Car; + t_.type = RT::Car; EXPECT_EQ(t_.url_suffix(), "/ipfs/main/?dag-scope=entity"); - t_.type = ig::Type::Ipns; + t_.type = RT::Ipns; EXPECT_EQ(t_.url_suffix(), "/ipns/main"); - t_.type = ig::Type::Providers; + t_.type = RT::Providers; EXPECT_EQ(t_.url_suffix(), "/routing/v1/providers/main"); - t_.type = ig::Type::Identity; + t_.type = RT::Identity; EXPECT_EQ(t_.url_suffix(), ""); - t_.type = ig::Type::Zombie; + t_.type = RT::Zombie; EXPECT_EQ(t_.url_suffix(), ""); } TEST_F(GatewayRequestTest, accept_param) { - t_.type = ig::Type::Car; + t_.type = RT::Car; EXPECT_EQ(t_.accept(), "application/vnd.ipld.car"); - t_.type = ig::Type::Ipns; + t_.type = RT::Ipns; EXPECT_EQ(t_.accept(), "application/vnd.ipfs.ipns-record"); - t_.type = ig::Type::Providers; + t_.type = RT::Providers; EXPECT_EQ(t_.accept(), "application/json"); - t_.type = ig::Type::Identity; + t_.type = RT::Identity; EXPECT_EQ(t_.accept(), ""); - t_.type = ig::Type::Zombie; + t_.type = RT::Zombie; EXPECT_EQ(t_.accept(), ""); } diff --git a/library/src/ipfs_client/gw/gateway_state.cc b/library/src/ipfs_client/gw/gateway_state.cc index 8064960b..7bd677d9 100644 --- a/library/src/ipfs_client/gw/gateway_state.cc +++ b/library/src/ipfs_client/gw/gateway_state.cc @@ -6,23 +6,27 @@ using Self = ipfs::gw::GatewayState; -Self::GatewayState() { - request_type_success.fill(0L); +Self::GatewayState(std::string_view prefix, std::shared_ptr api) + : prefix_{prefix}, api_{api} { + DCHECK(!prefix_.empty()); last_hist_update = std::time({}); sent_counts.fill(0U); } long Self::score(GatewayRequest const& req, unsigned baseline) const { auto result = static_cast(baseline); - result += 2 * request_type_success.at(static_cast(req.type)); + result += 4L * cfg().GetTypeAffinity(prefix_, req.type); auto i = affinity_success.find(req.affinity); if (i != affinity_success.end()) { - result += 3 * i->second; + result += 3L * i->second; } return result; } bool Self::over_rate(unsigned req_per_min) { return total_sent + current_bucket() > req_per_min * MinutesTracked; } +bool Self::over_rate() { + return over_rate(cfg().GetGatewayRate(prefix_)); +} bool Self::bored() const { return total_sent == 0UL; } @@ -40,15 +44,55 @@ unsigned int& Self::current_bucket() { } return sent_counts[last_hist_update % sent_counts.size()]; } -void Self::hit(GatewayRequest const& req) { - request_type_success.at(static_cast(req.type))++; +void Self::hit(GatewayRequestType grt, GatewayRequest const& req) { + auto& c = cfg(); + auto aff = c.GetTypeAffinity(prefix_, grt); + c.SetTypeAffinity(prefix_, grt, ++aff); affinity_success[req.affinity]++; + auto rpm = c.GetGatewayRate(prefix_); + if (!over_rate(rpm++ / 4)) { + return; + } + if (over_rate(rpm++ / 3)) { + ++rpm; + } + if (over_rate(rpm++ / 2)) { + ++rpm; + } + if (over_rate(rpm++)) { + ++rpm; + } + c.SetGatewayRate(prefix_, rpm); } -bool Self::miss(GatewayRequest const& req) { - request_type_success.at(static_cast(req.type))--; - slowness++; +bool Self::miss(GatewayRequestType grt, GatewayRequest const& req) { + auto& c = cfg(); + auto aff = c.GetTypeAffinity(prefix_, grt); + if (aff > std::numeric_limits::min()) { + c.SetTypeAffinity(prefix_, grt, --aff); + } + auto rpm = c.GetGatewayRate(prefix_); + if (rpm && !over_rate(rpm)) { + c.SetGatewayRate(prefix_, rpm - 1); + } return affinity_success[req.affinity]-- >= 0; } void Self::timed_out() { slowness += 10; + auto& c = cfg(); + auto rpm = c.GetGatewayRate(prefix_); + if (over_rate(rpm)) { + return; + } + if (--rpm && !over_rate(rpm / 2)) { + --rpm; + } + c.SetGatewayRate(prefix_, rpm); +} +auto Self::cfg() -> ctx::GatewayConfig& { + DCHECK(api_); + return api_->gw_cfg(); +} +auto Self::cfg() const -> ctx::GatewayConfig const& { + DCHECK(api_); + return api_->gw_cfg(); } \ No newline at end of file diff --git a/library/src/ipfs_client/gw/gateway_state.h b/library/src/ipfs_client/gw/gateway_state.h index 4d21c909..75f00d76 100644 --- a/library/src/ipfs_client/gw/gateway_state.h +++ b/library/src/ipfs_client/gw/gateway_state.h @@ -1,34 +1,49 @@ #ifndef IPFS_GATEWAY_STATE_H_ #define IPFS_GATEWAY_STATE_H_ +#include #include #include #include +#include #include +namespace ipfs { +class Client; + +namespace ctx { +class GatewayConfig; +} +} // namespace ipfs + namespace ipfs::gw { class GatewayRequest; class GatewayState { + std::string prefix_; + std::shared_ptr api_; flat_map affinity_success; - std::array request_type_success; static constexpr short MinutesTracked = 4; std::array sent_counts; std::size_t total_sent = 0UL; std::time_t last_hist_update; unsigned& current_bucket(); long slowness = 0; + bool over_rate(unsigned req_per_min); + + ctx::GatewayConfig& cfg(); + ctx::GatewayConfig const& cfg() const; public: - GatewayState(); + GatewayState(std::string_view prefix, std::shared_ptr); long score(GatewayRequest const&, unsigned) const; - bool over_rate(unsigned req_per_min); bool bored() const; + bool over_rate(); void just_sent_one(); - void hit(GatewayRequest const&); - bool miss(GatewayRequest const&); + void hit(GatewayRequestType, GatewayRequest const&); + bool miss(GatewayRequestType, GatewayRequest const&); void timed_out(); long extra_ms() { return slowness; } }; diff --git a/library/src/ipfs_client/gw/gateway_state_unittest.cc b/library/src/ipfs_client/gw/gateway_state_unittest.cc index 705ead8d..5f5ac6e0 100644 --- a/library/src/ipfs_client/gw/gateway_state_unittest.cc +++ b/library/src/ipfs_client/gw/gateway_state_unittest.cc @@ -1,6 +1,6 @@ #include "gateway_state.h" -#include +#include #include @@ -10,11 +10,11 @@ using T = ig::GatewayState; using R = ig::GatewayRequest; TEST(GatewayStateTest, InitialValues) { - T t; + T t{"pre", std::make_shared()}; R req; EXPECT_TRUE(t.bored()); for (auto r = 0U; r < 99U; ++r) { - EXPECT_FALSE(t.over_rate(r)); + // EXPECT_FALSE(t.over_rate(r)); EXPECT_EQ(t.score(req, r), r); } } \ No newline at end of file diff --git a/library/src/ipfs_client/gw/inline_request_handler.cc b/library/src/ipfs_client/gw/inline_request_handler.cc index c40ca738..bf164c9a 100644 --- a/library/src/ipfs_client/gw/inline_request_handler.cc +++ b/library/src/ipfs_client/gw/inline_request_handler.cc @@ -4,6 +4,7 @@ #include #include +#include "ipfs_client/gw/gateway_request_type.h" #include "log_macros.h" using Self = ipfs::gw::InlineRequestHandler; @@ -12,7 +13,7 @@ std::string_view Self::name() const { return "InlineRequestHandler"; } auto Self::handle(ipfs::gw::RequestPtr req) -> HandleOutcome { - if (req->type != gw::Type::Identity) { + if (req->type != GatewayRequestType::Identity) { return HandleOutcome::NOT_HANDLED; } std::string data{req->identity_data()}; diff --git a/library/src/ipfs_client/gw/inline_request_handler_unittest.cc b/library/src/ipfs_client/gw/inline_request_handler_unittest.cc index 55a4e8e6..0eee916b 100644 --- a/library/src/ipfs_client/gw/inline_request_handler_unittest.cc +++ b/library/src/ipfs_client/gw/inline_request_handler_unittest.cc @@ -5,12 +5,15 @@ #include #include #include +#include "ipfs_client/gw/gateway_request_type.h" namespace i = ipfs; namespace ig = i::gw; namespace pm = libp2p::multi; using namespace std::literals; using T = ig::InlineRequestHandler; +using RT = ig::GatewayRequestType; + using ipfs::Cid; TEST(InlineRequestHanlder, bluesky) { @@ -19,7 +22,7 @@ TEST(InlineRequestHanlder, bluesky) { auto rtor = std::make_shared(); auto orc = api->with(rtor).partition({}); auto r = std::make_shared(); - r->type = ig::Type::Identity; + r->type = RT::Identity; r->orchestrator(orc); i::MultiHash h(i::HashType::IDENTITY, i::as_bytes("abc"sv)); r->cid = Cid(i::MultiCodec::RAW, h); diff --git a/library/src/ipfs_client/gw/multi_gateway_requestor.cc b/library/src/ipfs_client/gw/multi_gateway_requestor.cc index 11c2395f..4d24b988 100644 --- a/library/src/ipfs_client/gw/multi_gateway_requestor.cc +++ b/library/src/ipfs_client/gw/multi_gateway_requestor.cc @@ -2,6 +2,7 @@ #include +#include "ipfs_client/gw/gateway_request_type.h" #include "log_macros.h" #include @@ -34,7 +35,9 @@ void Self::Next() { } } bool Self::Process(RequestPtr const& req) { - LOG(INFO) << "Process(" << req->debug_string() << ")"; + if (req->type == GatewayRequestType::Providers) { + VLOG(1) << "Process(" << req->debug_string() << ")"; + } if (!req->is_http()) { return false; } @@ -50,7 +53,8 @@ bool Self::Process(RequestPtr const& req) { VLOG(2) << "A new gateway has entered the chat: " << gw->prefix << '=' << gw->rate; // One can insert like this because state_ is std::map w/ stable iterators - state_iter = state_.insert({gw->prefix, GatewayState{}}).first; + state_iter = + state_.insert({gw->prefix, GatewayState{gw->prefix, api_}}).first; candidates.emplace_back(LONG_MAX, gw->prefix, &(state_iter->second)); } else if (state_iter->first < gw->prefix) { LOG(INFO) << "Gateway has disappeared: " << state_iter->first @@ -62,7 +66,7 @@ bool Self::Process(RequestPtr const& req) { // state_.erase(to_rm); continue; } else if (req->failures.contains(gw->prefix)) { - } else if (state_iter->second.over_rate(gw->rate)) { + } else if (state_iter->second.over_rate()) { auto score = state_iter->second.score(*req, gw->rate); if (std::get<0>(over_rate) <= score) { over_rate = std::make_tuple(score, gw->prefix, &(state_iter->second)); @@ -84,10 +88,11 @@ bool Self::Process(RequestPtr const& req) { forward(req); return false; } - auto min_plel = req->type == Type::Block ? 4UL : 1UL; + auto min_plel = req->type == GatewayRequestType::Block ? 4UL : 1UL; auto to_send = std::max(bored / 2UL, min_plel); std::sort(candidates.begin(), candidates.end(), std::greater{}); for (auto& [score, prefix, state] : candidates) { + DCHECK(!prefix.empty()); DoSend(req, prefix, *state); if (!--to_send) { return true; @@ -97,6 +102,7 @@ bool Self::Process(RequestPtr const& req) { return false; } void Self::DoSend(RequestPtr req, std::string const& gw, GatewayState& state) { + DCHECK(!gw.empty()); auto desc = req->describe_http(gw); if (!desc.has_value()) { LOG(ERROR) << "A request that has no HTTP description got pretty far " @@ -119,6 +125,10 @@ void Self::DoSend(RequestPtr req, std::string const& gw, GatewayState& state) { }; state.just_sent_one(); api_->http().SendHttpRequest(*desc, cb); + if (req->type == GatewayRequestType::Providers) { + VLOG(1) << "Just sent " << req->debug_string() << " as " + << desc.value().url; + } } void Self::HandleResponse(HttpRequestDescription const& desc, RequestPtr req, @@ -127,13 +137,15 @@ void Self::HandleResponse(HttpRequestDescription const& desc, std::string_view body, HeaderAccess hdrs, bool timed_out) { - LOG(INFO) << "HandleResponse(" << req->debug_string() << ")"; + auto req_type = req->type; + if (req_type == GatewayRequestType::Providers) { + VLOG(1) << "Received response to " << req->debug_string() << " from " << gw << " status=" << status; + } if (req->Finished() || - (req->PartiallyRedundant() && req->type == Type::Block)) { + (req->PartiallyRedundant() && req_type == GatewayRequestType::Block)) { return; } auto i = state_.find(gw); - auto& gws = api_->gw_cfg(); if (status == 200) { auto ct = hdrs("content-type"); std::transform(ct.begin(), ct.end(), ct.begin(), ::tolower); @@ -144,7 +156,7 @@ void Self::HandleResponse(HttpRequestDescription const& desc, VLOG(2) << "Requested with Accept: " << desc.accept << " but received response with content-type: " << ct; if (state_.end() != i) { - i->second.miss(*req); + i->second.miss(req_type, *req); } Next(); return; @@ -156,44 +168,22 @@ void Self::HandleResponse(HttpRequestDescription const& desc, VLOG(2) << "Response from " << gw << " to " << req->debug_string() << " was successful & useful - progress made."; if (state_.end() != i) { - i->second.hit(*req); + i->second.hit(req_type, *req); } - auto rpm = gws.GetGatewayRate(gw); - VLOG(2) << "Rate for " << gw << " _WAS_ " << rpm - << " and is about to go up."; - if (rpm < 15) { - rpm *= 2; - } - rpm += 2; - gws.SetGatewayRate(gw, rpm); Next(); return; } } - auto rpm = gws.GetGatewayRate(gw); - auto old_rpm = rpm; + i->second.miss(req_type, *req); + req->failures.insert(gw); if (status == 408 || status == 504 || status == 429 || status == 110 || timed_out) { VLOG(2) << gw << " timed out on request " << req->debug_string(); - if (req->type == Type::Block) { + if (req->type == GatewayRequestType::Block) { if (state_.end() != i) { i->second.timed_out(); } - if (rpm > 60U) { - rpm -= 9; - } else if (rpm) { - --rpm; - } } - } else { - req->failures.insert(gw); - } - if (state_.end() != i && i->second.miss(*req) && rpm && - req->type == Type::Block) { - --rpm; - } - if (old_rpm != rpm) { - gws.SetGatewayRate(gw, rpm); } Process(req); } diff --git a/library/src/ipfs_client/gw/multi_gateway_requestor_unittest.cc b/library/src/ipfs_client/gw/multi_gateway_requestor_unittest.cc index c57140db..ffd933fc 100644 --- a/library/src/ipfs_client/gw/multi_gateway_requestor_unittest.cc +++ b/library/src/ipfs_client/gw/multi_gateway_requestor_unittest.cc @@ -1,4 +1,5 @@ #include "multi_gateway_requestor.h" +#include "ipfs_client/gw/gateway_request_type.h" #include @@ -7,7 +8,7 @@ namespace { ig::RequestPtr block_req() { auto rv = std::make_shared(); - rv->type = ig::Type::Block; + rv->type = RT::Block; rv->main_param = "bafybeid4dzlxm6h4r6kfvx6jp6vj4nteplmbve224lx2s3lgjubyufsuo4"; return rv; diff --git a/library/src/ipfs_client/gw/providers_response.cc b/library/src/ipfs_client/gw/providers_response.cc index 15c7a62e..3f71b0e4 100644 --- a/library/src/ipfs_client/gw/providers_response.cc +++ b/library/src/ipfs_client/gw/providers_response.cc @@ -24,7 +24,7 @@ bool default_port(std::string_view scheme, std::string_view port) { return false; } } -std::string MultiaddrToGatewayPrefix(ipfs::SlashDelimited ma) { +std::string MultiaddrToGatewayPrefix(ipfs::SlashDelimited ma, bool http) { auto addr_proto = ma.pop(); VLOG(2) << "Protocol expected to be one of ip4|ip6|dnsaddr|dns|dns4|dns6 , is:" @@ -34,6 +34,10 @@ std::string MultiaddrToGatewayPrefix(ipfs::SlashDelimited ma) { DCHECK_EQ(tcp, "tcp"); auto port = ma.pop(); auto app_proto = ma.pop(); + if (app_proto == "http" && !http) { + LOG(INFO) << "Rejecting http:// gateway discovery due to config."; + return ""; + } DCHECK_EQ(app_proto.substr(0, 4), "http"); std::string rv{app_proto}; rv.append("://").append(host); @@ -68,10 +72,15 @@ bool ParseProvider(ipfs::DagJsonValue const& provider, ipfs::Client& api) { bool rv = false; auto handle_addr = [&api, &rv](ipfs::DagJsonValue const& addr) { if (auto s = addr.get_if_string()) { - auto gw_pre = MultiaddrToGatewayPrefix(ipfs::SlashDelimited{s.value()}); - LOG(INFO) << "'" << *s << "' -> '" << gw_pre << "'."; - api.gw_cfg().AddGateway(gw_pre); - rv = true; + auto& c = api.gw_cfg(); + auto http = c.RoutingApiDiscoveryOfUnencryptedGateways(); + ipfs::SlashDelimited sd{s.value()}; + auto gw_pre = MultiaddrToGatewayPrefix(sd, http); + if (gw_pre.size()) { + LOG(INFO) << "'" << *s << "' -> '" << gw_pre << "'."; + c.AddGateway(gw_pre, c.RoutingApiDiscoveryDefaultRate()); + rv = true; + } } else { LOG(ERROR) << ".Providers[x].Addrs[x] is not a string"; } diff --git a/library/src/ipfs_client/gw/requestor.cc b/library/src/ipfs_client/gw/requestor.cc index 4e93070d..c6016569 100644 --- a/library/src/ipfs_client/gw/requestor.cc +++ b/library/src/ipfs_client/gw/requestor.cc @@ -64,6 +64,7 @@ void Self::forward(ipfs::gw::RequestPtr req) const { next_->request(req); } } -void Self::api(std::shared_ptr a) { +Self& Self::api(std::shared_ptr a) { api_ = a; + return *this; } \ No newline at end of file diff --git a/library/src/ipfs_client/gw/requestor_unittest.cc b/library/src/ipfs_client/gw/requestor_unittest.cc index f1f5eb69..8dc7c51c 100644 --- a/library/src/ipfs_client/gw/requestor_unittest.cc +++ b/library/src/ipfs_client/gw/requestor_unittest.cc @@ -3,10 +3,12 @@ #include #include +#include #include namespace g = ipfs::gw; using T = g::Requestor; +using RT = g::GatewayRequestType; namespace { struct TestRequestor : public g::Requestor { @@ -29,7 +31,7 @@ struct RequestorTest : public ::testing::Test { std::shared_ptr req_ = std::make_shared(); RequestorTest() { - req_->type = g::Type::Block; + req_->type = RT::Block; req_->dependent = std::make_shared("", [](auto&, auto&) {}); } diff --git a/library/src/ipfs_client/gw/terminating_requestor.cc b/library/src/ipfs_client/gw/terminating_requestor.cc index dd809b12..f23c3426 100644 --- a/library/src/ipfs_client/gw/terminating_requestor.cc +++ b/library/src/ipfs_client/gw/terminating_requestor.cc @@ -2,6 +2,7 @@ #include +#include "ipfs_client/gw/gateway_request_type.h" #include "log_macros.h" using Self = ipfs::gw::TerminatingRequestor; @@ -18,7 +19,7 @@ auto Self::handle(ipfs::gw::RequestPtr r) -> HandleOutcome { LOG(ERROR) << "Out of options, giving up on gateway request " << r->debug_string(); definitive_failure(r); - r->type = Type::Zombie; + r->type = GatewayRequestType::Zombie; return HandleOutcome::DONE; } } diff --git a/library/src/ipfs_client/gw/terminating_requestor_unittest.cc b/library/src/ipfs_client/gw/terminating_requestor_unittest.cc index 207d1b21..2cefa76f 100644 --- a/library/src/ipfs_client/gw/terminating_requestor_unittest.cc +++ b/library/src/ipfs_client/gw/terminating_requestor_unittest.cc @@ -4,20 +4,22 @@ #include #include +#include "ipfs_client/gw/gateway_request_type.h" namespace i = ipfs; namespace ig = i::gw; using T = ig::TerminatingRequestor; +using RT = ig::GatewayRequestType; TEST(TerminatingRequestorTest, ZombieIsDone) { auto req = std::make_shared(); - req->type = ig::Type::Zombie; + req->type = RT::Zombie; T tested; EXPECT_TRUE(tested.handle(req) == T::HandleOutcome::DONE); } TEST(TerminatingRequestorTest, BeingHandledInParallel) { auto req = std::make_shared(); - req->type = ig::Type::Block; + req->type = RT::Block; req->dependent = std::make_shared("", [](auto&, auto&) {}); req->parallel = 9; T tested; diff --git a/library/src/ipfs_client/partition.cc b/library/src/ipfs_client/partition.cc index 81dd94ea..b6a70f8f 100644 --- a/library/src/ipfs_client/partition.cc +++ b/library/src/ipfs_client/partition.cc @@ -26,6 +26,7 @@ void Self::build_response(std::shared_ptr req) { auto req_path = req->path(); req_path.pop(); // discard namespace ipfs or ipns std::string affinity{req_path.pop()}; + VLOG(1) << req->path().to_string() << " Affinity: " << affinity; auto it = dags_.find(affinity); if (dags_.end() == it) { if (gw_request(req, req->path(), affinity)) { diff --git a/library/src/ipfs_client/partition_unittest.cc b/library/src/ipfs_client/partition_unittest.cc index 945db828..174b4ee3 100644 --- a/library/src/ipfs_client/partition_unittest.cc +++ b/library/src/ipfs_client/partition_unittest.cc @@ -4,13 +4,12 @@ #include #include +#include #include #include #include #include -#include "ipld/dnslink_name.h" - #include #include @@ -76,7 +75,7 @@ struct TestRequestor final : public ig::Requestor { base_dir = base_dir.parent_path(); } switch (r->type) { - case i::gw::Type::Ipns: { + case i::gw::GatewayRequestType::Ipns: { auto dir = base_dir / "test_data" / "names"; auto f = dir / cid; EXPECT_TRUE(is_regular_file(f)) << cid << " missing"; @@ -106,10 +105,10 @@ struct TestRequestor final : public ig::Requestor { buf.resize(buf.size() - 1); r->RespondSuccessfully(buf, api); } break; - case i::gw::Type::Car: - r->type = i::gw::Type::Block; + case i::gw::GatewayRequestType::Car: + r->type = i::gw::GatewayRequestType::Block; [[fallthrough]]; - case i::gw::Type::Block: { + case i::gw::GatewayRequestType::Block: { auto blocs_dir = base_dir / "test_data" / "blocks"; EXPECT_TRUE(is_directory(blocs_dir)); auto f = blocs_dir / cid; @@ -133,7 +132,7 @@ struct TestRequestor final : public ig::Requestor { return HandleOutcome::DONE; } } break; - case i::gw::Type::DnsLink: { + case i::gw::GatewayRequestType::DnsLink: { auto dir = base_dir / "test_data" / "names"; auto f = dir / cid; EXPECT_TRUE(is_regular_file(f)) << cid << " missing"; diff --git a/test_data/blocks/QmWsfMQfetXXzHKxRrC8vTJ1xJgAbvH9VtGoLKpeD2yxKQ b/test_data/blocks/QmWsfMQfetXXzHKxRrC8vTJ1xJgAbvH9VtGoLKpeD2yxKQ deleted file mode 100644 index 0ee3c5dc..00000000 --- a/test_data/blocks/QmWsfMQfetXXzHKxRrC8vTJ1xJgAbvH9VtGoLKpeD2yxKQ +++ /dev/null @@ -1,2 +0,0 @@ - -˜Pu4 Pu5 Pu6 Pu7 Pu8 Pu9 Pv0 Pv1 Pv2 Pv3 Pv4 Pv5 Pv6 Pv7 Pv8 Pv9 Pw0 Pw1 Pw2 Pw3 Pw4 Pw5 Pw6 Pw7 Pw8 Pw9 Px0 Px1 Px2 Px3 Px4 Px5 Px6 Px7 Px8 Px9  \ No newline at end of file diff --git a/test_data/blocks/QmWtiuvcx9rAGLddvRedV32sVPHegWR1uLGoiL7XhbmYaC b/test_data/blocks/QmWtiuvcx9rAGLddvRedV32sVPHegWR1uLGoiL7XhbmYaC deleted file mode 100644 index b1a5535d..00000000 --- a/test_data/blocks/QmWtiuvcx9rAGLddvRedV32sVPHegWR1uLGoiL7XhbmYaC +++ /dev/null @@ -1,2 +0,0 @@ - -˜Zq0 Zq1 Zq2 Zq3 Zq4 Zq5 Zq6 Zq7 Zq8 Zq9 Zr0 Zr1 Zr2 Zr3 Zr4 Zr5 Zr6 Zr7 Zr8 Zr9 Zs0 Zs1 Zs2 Zs3 Zs4 Zs5 Zs6 Zs7 Zs8 Zs9 Zt0 Zt1 Zt2 Zt3 Zt4 Zt5  \ No newline at end of file diff --git a/test_data/blocks/QmX5mFLVQs5zfHHYTyyUznhwtEc39DMjLKTY7NLoJh6FXP b/test_data/blocks/QmX5mFLVQs5zfHHYTyyUznhwtEc39DMjLKTY7NLoJh6FXP deleted file mode 100644 index 23cc8b69..00000000 --- a/test_data/blocks/QmX5mFLVQs5zfHHYTyyUznhwtEc39DMjLKTY7NLoJh6FXP +++ /dev/null @@ -1,2 +0,0 @@ - -˜Av6 Av7 Av8 Av9 Aw0 Aw1 Aw2 Aw3 Aw4 Aw5 Aw6 Aw7 Aw8 Aw9 Ax0 Ax1 Ax2 Ax3 Ax4 Ax5 Ax6 Ax7 Ax8 Ax9 Ay0 Ay1 Ay2 Ay3 Ay4 Ay5 Ay6 Ay7 Ay8 Ay9 Az0 Az1  \ No newline at end of file diff --git a/test_data/blocks/QmXFVT4XPH5XcjrjizWe9FkARGjRCnsNvhRiLafsJK4S34 b/test_data/blocks/QmXFVT4XPH5XcjrjizWe9FkARGjRCnsNvhRiLafsJK4S34 deleted file mode 100644 index 6f2f99a8..00000000 --- a/test_data/blocks/QmXFVT4XPH5XcjrjizWe9FkARGjRCnsNvhRiLafsJK4S34 +++ /dev/null @@ -1,2 +0,0 @@ - -˜Ea4 Ea5 Ea6 Ea7 Ea8 Ea9 Eb0 Eb1 Eb2 Eb3 Eb4 Eb5 Eb6 Eb7 Eb8 Eb9 Ec0 Ec1 Ec2 Ec3 Ec4 Ec5 Ec6 Ec7 Ec8 Ec9 Ed0 Ed1 Ed2 Ed3 Ed4 Ed5 Ed6 Ed7 Ed8 Ed9  \ No newline at end of file diff --git a/test_data/blocks/QmXLTWoGMNCzw7PSDi2xaPt9nhY4XWQ8KXeZzsVjCd9mAS b/test_data/blocks/QmXLTWoGMNCzw7PSDi2xaPt9nhY4XWQ8KXeZzsVjCd9mAS deleted file mode 100644 index 721ad75e..00000000 --- a/test_data/blocks/QmXLTWoGMNCzw7PSDi2xaPt9nhY4XWQ8KXeZzsVjCd9mAS +++ /dev/null @@ -1,2 +0,0 @@ - -˜Hq0 Hq1 Hq2 Hq3 Hq4 Hq5 Hq6 Hq7 Hq8 Hq9 Hr0 Hr1 Hr2 Hr3 Hr4 Hr5 Hr6 Hr7 Hr8 Hr9 Hs0 Hs1 Hs2 Hs3 Hs4 Hs5 Hs6 Hs7 Hs8 Hs9 Ht0 Ht1 Ht2 Ht3 Ht4 Ht5  \ No newline at end of file diff --git a/test_data/blocks/QmXNNS1UGZA2G6mnUdcqHLEhqXup65s4ChwDvPLCrHDNrZ b/test_data/blocks/QmXNNS1UGZA2G6mnUdcqHLEhqXup65s4ChwDvPLCrHDNrZ deleted file mode 100644 index 43d662c8..00000000 --- a/test_data/blocks/QmXNNS1UGZA2G6mnUdcqHLEhqXup65s4ChwDvPLCrHDNrZ +++ /dev/null @@ -1,2 +0,0 @@ - -˜Qi8 Qi9 Qj0 Qj1 Qj2 Qj3 Qj4 Qj5 Qj6 Qj7 Qj8 Qj9 Qk0 Qk1 Qk2 Qk3 Qk4 Qk5 Qk6 Qk7 Qk8 Qk9 Ql0 Ql1 Ql2 Ql3 Ql4 Ql5 Ql6 Ql7 Ql8 Ql9 Qm0 Qm1 Qm2 Qm3  \ No newline at end of file diff --git a/test_data/blocks/QmXRhLdYTzkAasaeoY6UuT8Vac6z5gwh6AXqKJU4ZT9Ya3 b/test_data/blocks/QmXRhLdYTzkAasaeoY6UuT8Vac6z5gwh6AXqKJU4ZT9Ya3 deleted file mode 100644 index a6e50bd1..00000000 --- a/test_data/blocks/QmXRhLdYTzkAasaeoY6UuT8Vac6z5gwh6AXqKJU4ZT9Ya3 +++ /dev/null @@ -1,2 +0,0 @@ - -˜Cu0 Cu1 Cu2 Cu3 Cu4 Cu5 Cu6 Cu7 Cu8 Cu9 Cv0 Cv1 Cv2 Cv3 Cv4 Cv5 Cv6 Cv7 Cv8 Cv9 Cw0 Cw1 Cw2 Cw3 Cw4 Cw5 Cw6 Cw7 Cw8 Cw9 Cx0 Cx1 Cx2 Cx3 Cx4 Cx5  \ No newline at end of file diff --git a/test_data/blocks/QmXRpP235kTDzk8BsspxWBkUubufmqyuw9rcqLjv5YjU7t b/test_data/blocks/QmXRpP235kTDzk8BsspxWBkUubufmqyuw9rcqLjv5YjU7t deleted file mode 100644 index 24c46376..00000000 --- a/test_data/blocks/QmXRpP235kTDzk8BsspxWBkUubufmqyuw9rcqLjv5YjU7t +++ /dev/null @@ -1,2 +0,0 @@ - -˜Xg8 Xg9 Xh0 Xh1 Xh2 Xh3 Xh4 Xh5 Xh6 Xh7 Xh8 Xh9 Xi0 Xi1 Xi2 Xi3 Xi4 Xi5 Xi6 Xi7 Xi8 Xi9 Xj0 Xj1 Xj2 Xj3 Xj4 Xj5 Xj6 Xj7 Xj8 Xj9 Xk0 Xk1 Xk2 Xk3  \ No newline at end of file diff --git a/test_data/blocks/QmXXBTt9LwuSWaxauCbCwH9w48xWQGZZbmyHtBkaMj8Scf b/test_data/blocks/QmXXBTt9LwuSWaxauCbCwH9w48xWQGZZbmyHtBkaMj8Scf deleted file mode 100644 index c0d0293a..00000000 --- a/test_data/blocks/QmXXBTt9LwuSWaxauCbCwH9w48xWQGZZbmyHtBkaMj8Scf +++ /dev/null @@ -1,2 +0,0 @@ - -˜Qf2 Qf3 Qf4 Qf5 Qf6 Qf7 Qf8 Qf9 Qg0 Qg1 Qg2 Qg3 Qg4 Qg5 Qg6 Qg7 Qg8 Qg9 Qh0 Qh1 Qh2 Qh3 Qh4 Qh5 Qh6 Qh7 Qh8 Qh9 Qi0 Qi1 Qi2 Qi3 Qi4 Qi5 Qi6 Qi7  \ No newline at end of file diff --git a/test_data/blocks/QmXYu3S8gaTfRvrztrGxm1H28obp5Y48JkXLu4GnFwFdbB b/test_data/blocks/QmXYu3S8gaTfRvrztrGxm1H28obp5Y48JkXLu4GnFwFdbB deleted file mode 100644 index 2f28771f..00000000 --- a/test_data/blocks/QmXYu3S8gaTfRvrztrGxm1H28obp5Y48JkXLu4GnFwFdbB +++ /dev/null @@ -1,2 +0,0 @@ - -˜Qb6 Qb7 Qb8 Qb9 Qc0 Qc1 Qc2 Qc3 Qc4 Qc5 Qc6 Qc7 Qc8 Qc9 Qd0 Qd1 Qd2 Qd3 Qd4 Qd5 Qd6 Qd7 Qd8 Qd9 Qe0 Qe1 Qe2 Qe3 Qe4 Qe5 Qe6 Qe7 Qe8 Qe9 Qf0 Qf1  \ No newline at end of file diff --git a/test_data/blocks/bafkreidnuq5zitsjj2ef42npaipzhrwzgmohrkrcqcchcfbjcyffxpivwu b/test_data/blocks/bafkreidnuq5zitsjj2ef42npaipzhrwzgmohrkrcqcchcfbjcyffxpivwu deleted file mode 100644 index 22aac29b..00000000 --- a/test_data/blocks/bafkreidnuq5zitsjj2ef42npaipzhrwzgmohrkrcqcchcfbjcyffxpivwu +++ /dev/null @@ -1 +0,0 @@ -J \ No newline at end of file diff --git a/test_data/blocks/bafkreids37h3brdqvqsvzxud7oh6hdpiueubrdqd5jn2lmvjhln6uedc7i b/test_data/blocks/bafkreids37h3brdqvqsvzxud7oh6hdpiueubrdqd5jn2lmvjhln6uedc7i deleted file mode 100644 index 083b700b..00000000 --- a/test_data/blocks/bafkreids37h3brdqvqsvzxud7oh6hdpiueubrdqd5jn2lmvjhln6uedc7i +++ /dev/null @@ -1 +0,0 @@ -L \ No newline at end of file diff --git a/test_data/blocks/bafkreidzajuzxzbmrkhen653iuaxezix5bvsfrlkdcpxmjng3jeqqgzeke b/test_data/blocks/bafkreidzajuzxzbmrkhen653iuaxezix5bvsfrlkdcpxmjng3jeqqgzeke deleted file mode 100644 index c7930257..00000000 --- a/test_data/blocks/bafkreidzajuzxzbmrkhen653iuaxezix5bvsfrlkdcpxmjng3jeqqgzeke +++ /dev/null @@ -1 +0,0 @@ -7 \ No newline at end of file diff --git a/test_data/blocks/bafkreiecktbstkjikd3nkoo5g5xuqfxoe5sfc7nf4arvkffpimywisanpi b/test_data/blocks/bafkreiecktbstkjikd3nkoo5g5xuqfxoe5sfc7nf4arvkffpimywisanpi deleted file mode 100644 index 23fa7d31..00000000 --- a/test_data/blocks/bafkreiecktbstkjikd3nkoo5g5xuqfxoe5sfc7nf4arvkffpimywisanpi +++ /dev/null @@ -1 +0,0 @@ -k \ No newline at end of file diff --git a/test_data/blocks/bafkreiegx2nfk5rngfvdajwcqnwqit27y5xdjwqq4g2f73xf6gf6p3nro4 b/test_data/blocks/bafkreiegx2nfk5rngfvdajwcqnwqit27y5xdjwqq4g2f73xf6gf6p3nro4 deleted file mode 100644 index 449e49ef..00000000 --- a/test_data/blocks/bafkreiegx2nfk5rngfvdajwcqnwqit27y5xdjwqq4g2f73xf6gf6p3nro4 +++ /dev/null @@ -1 +0,0 @@ -K \ No newline at end of file diff --git a/test_data/include/mock_api.h b/test_data/include/mock_api.h index 0a2849c5..97cce3dd 100644 --- a/test_data/include/mock_api.h +++ b/test_data/include/mock_api.h @@ -16,6 +16,7 @@ class GatewayRequest; namespace i = ipfs; namespace ig = i::gw; namespace ic = i::ctx; +using RT = ig::GatewayRequestType; using namespace std::literals; diff --git a/test_data/include/mock_gw_cfg.h b/test_data/include/mock_gw_cfg.h index 662d8496..8eed3266 100644 --- a/test_data/include/mock_gw_cfg.h +++ b/test_data/include/mock_gw_cfg.h @@ -4,17 +4,31 @@ #include namespace i = ipfs; +namespace ig = i::gw; namespace { -struct MockGwCfg : public ipfs::ctx::GatewayConfig { +struct MockGwCfg final : public ipfs::ctx::GatewayConfig { std::optional GetGateway(std::size_t) const { return std::nullopt; } unsigned GetGatewayRate(std::string_view) { return 120U; } std::vector gateways_added; void AddGateway(std::string_view g) { gateways_added.emplace_back(g); } + void AddGateway(std::string_view g, unsigned) { + gateways_added.emplace_back(g); + } void SetGatewayRate(std::string_view, unsigned int) override {} + unsigned RoutingApiDiscoveryDefaultRate() const { return 9; } virtual ~MockGwCfg() noexcept override {} + bool http_disc_ = true; + bool RoutingApiDiscoveryOfUnencryptedGateways() const { return http_disc_; } + int GetTypeAffinity(std::string_view url_prefix, + ig::GatewayRequestType) const { + return 0; + } + void SetTypeAffinity(std::string_view url_prefix, + ig::GatewayRequestType, + int) {} }; } // namespace