mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 10:41:30 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
38
Libraries/LibWeb/Loader/ProxyMappings.cpp
Normal file
38
Libraries/LibWeb/Loader/ProxyMappings.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "ProxyMappings.h"
|
||||
|
||||
Web::ProxyMappings& Web::ProxyMappings::the()
|
||||
{
|
||||
static ProxyMappings instance {};
|
||||
return instance;
|
||||
}
|
||||
|
||||
Core::ProxyData Web::ProxyMappings::proxy_for_url(URL::URL const& url) const
|
||||
{
|
||||
auto url_string = url.to_byte_string();
|
||||
for (auto& it : m_mappings) {
|
||||
if (url_string.matches(it.key)) {
|
||||
auto result = Core::ProxyData::parse_url(m_proxies[it.value]);
|
||||
if (result.is_error()) {
|
||||
dbgln("Failed to parse proxy URL: {}", m_proxies[it.value]);
|
||||
continue;
|
||||
}
|
||||
return result.release_value();
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Web::ProxyMappings::set_mappings(Vector<ByteString> proxies, OrderedHashMap<ByteString, size_t> mappings)
|
||||
{
|
||||
m_proxies = move(proxies);
|
||||
m_mappings = move(mappings);
|
||||
|
||||
dbgln("Proxy mappings updated: proxies: {}", m_proxies);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue