<commit_before>package org.helioviewer.jhv.base;

import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;

import org.helioviewer.jhv.Settings;

public class ProxySettings {

    public static final Proxy proxy;

    static {
        String[] httpVars = { "http.proxyHost", "http.proxyPort", "http.proxyUser", "http.proxyPassword" };
        String[] socksVars = { "socksProxyHost", "socksProxyPort", "java.net.socks.username", "java.net.socks.password" };

        Proxy _proxy = detectProxy(httpVars[0], httpVars[1], Proxy.Type.HTTP);
        if (_proxy == null)
            _proxy = detectProxy(socksVars[0], socksVars[1], Proxy.Type.SOCKS);
        if (_proxy == null)
            _proxy = Proxy.NO_PROXY;

        proxy = _proxy;

        if (proxy != Proxy.NO_PROXY) {
            Authenticator.setDefault(new Authenticator() {
                @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                    if (getRequestorType() == RequestorType.PROXY) {
                        String[] vars = proxy.type().equals(Proxy.Type.HTTP) ? httpVars : socksVars;
                        String host = System.getProperty(vars[0]);
                        String port = System.getProperty(vars[1]);
                        String user = System.getProperty(vars[2]);
                        String pass = System.getProperty(vars[3]);

                        if (user == null || pass == null) {
                            user = Settings.getSingletonInstance().getProperty("default.proxyUsername");
                            pass = Settings.getSingletonInstance().getProperty("default.proxyPassword");
                        }

                        if (user != null && pass != null && getRequestingHost().equalsIgnoreCase(host) && Integer.toString(getRequestingPort()).equals(port)) {
                            return new PasswordAuthentication(user, pass.toCharArray());
                        }
                    }
                    return null;
                }<commit_msg>Check against server name not type<commit_after>package org.helioviewer.jhv.base;

import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;

import org.helioviewer.jhv.Settings;

public class ProxySettings {

    public static final Proxy proxy;

    static {
        String[] httpVars = { "http.proxyHost", "http.proxyPort", "http.proxyUser", "http.proxyPassword" };
        String[] socksVars = { "socksProxyHost", "socksProxyPort", "java.net.socks.username", "java.net.socks.password" };

        Proxy _proxy = detectProxy(httpVars[0], httpVars[1], Proxy.Type.HTTP);
        if (_proxy == null)
            _proxy = detectProxy(socksVars[0], socksVars[1], Proxy.Type.SOCKS);
        if (_proxy == null)
            _proxy = Proxy.NO_PROXY;

        proxy = _proxy;

        if (proxy != Proxy.NO_PROXY) {
            Authenticator.setDefault(new Authenticator() {
                @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                    String[] vars = proxy.type().equals(Proxy.Type.HTTP) ? httpVars : socksVars;
                    String host = System.getProperty(vars[0]);
                    if (getRequestingHost().equalsIgnoreCase(host)) {
                    // if (getRequestorType() == RequestorType.PROXY) {
                        String port = System.getProperty(vars[1]);
                        String user = System.getProperty(vars[2]);
                        String pass = System.getProperty(vars[3]);

                        if (user == null || pass == null) {
                            user = Settings.getSingletonInstance().getProperty("default.proxyUsername");
                            pass = Settings.getSingletonInstance().getProperty("default.proxyPassword");
                        }

                        if (user != null && pass != null && Integer.toString(getRequestingPort()).equals(port)) {
                            return new PasswordAuthentication(user, pass.toCharArray());
                        }
                    }
                    return null;
                }
{'fraction_non_alphanumeric': 0.11401034320639399, 'fraction_numerical': 0.0037611659614480487, 'mean_word_length': 1.9385359116022098, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4260613', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1087, 'n_words': 212}