| 238 | } |
| 239 | |
| 240 | std::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 | |
| 261 | std::string ExtensionUtils::getExtensionFileName(const std::string& name) { |
| 262 | return std::format(EXTENSION_FILE_NAME, common::StringUtils::getLower(name), |
nothing calls this directly
no test coverage detected