MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / getProxyConfigForURL

Method getProxyConfigForURL

src/extension/extension.cpp:240–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240std::optional<ExtensionProxyConfig> ExtensionUtils::getProxyConfigForURL(const std::string& url) {
241 auto targetURL = parseURL(url);
242 if (targetURL.host.empty()) {
243 return std::nullopt;
244 }
245 auto noProxy = getProxyEnv({"LADYBUG_NO_PROXY", "no_proxy", "NO_PROXY"});
246 if (!noProxy.empty() && noProxyMatches(noProxy, targetURL)) {
247 return std::nullopt;
248 }
249 std::string proxyURL;
250 if (targetURL.scheme == "https") {
251 proxyURL = getProxyEnv({"LADYBUG_HTTPS_PROXY", "https_proxy", "HTTPS_PROXY"});
252 } else {
253 proxyURL = getProxyEnv({"LADYBUG_HTTP_PROXY", "http_proxy", "HTTP_PROXY"});
254 }
255 if (proxyURL.empty()) {
256 proxyURL = getProxyEnv({"LADYBUG_ALL_PROXY", "all_proxy", "ALL_PROXY"});
257 }
258 return proxyURL.empty() ? std::nullopt : parseProxyConfig(proxyURL);
259}
260
261std::string ExtensionUtils::getExtensionFileName(const std::string& name) {
262 return std::format(EXTENSION_FILE_NAME, common::StringUtils::getLower(name),

Callers

nothing calls this directly

Calls 4

parseURLFunction · 0.85
getProxyEnvFunction · 0.85
noProxyMatchesFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected