<commit_before>﻿using System.Net;
using System.Security.Cryptography.X509Certificates;

namespace SandRibbon.Providers
{
    public class LaxCertificatePolicy : ICertificatePolicy {
        public bool CheckValidationResult(ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, WebRequest request, int certificateProblem)
        {
            return true;
        }
    }
    public class HttpResourceProvider
    {
        private static WebClient client()
        {
            var wc = new WebClient { Credentials = new NetworkCredential("exampleUsername", "examplePassword") };
            return wc;
        }
        private static bool bypassAllCertificateStuff(object sender, X509Certificate cert, X509Chain chain, System.Net.Security.SslPolicyErrors error)
        {
            return true;
        }
        public static string secureGetString(string resource)
        {
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(bypassAllCertificateStuff);
            return client().DownloadString(resource);
        }
        public static string insecureGetString(string resource)
        {
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(bypassAllCertificateStuff);
            return new WebClient().DownloadString(resource);
        }
        public static string securePutData(string uri, byte[] data)
        {
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(bypassAllCertificateStuff);
            return decode(client().UploadData(uri, data));
        }
        public static byte[] secureGetData(string resource)
        {
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(bypassAllCertificateStuff);
            return client().DownloadData(resource);
        }
        public static string securePutFile(string uri, string filename)
        {
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(bypassAllCertificateStuff);
            return decode(client().UploadFile(uri, filename));
        }
        private static string decode(byte[] bytes)
        {<commit_msg>fixed a memory leak in HttpResourceProvider<commit_after>﻿using System.Net;
using System.Security.Cryptography.X509Certificates;

namespace SandRibbon.Providers
{
    public class LaxCertificatePolicy : ICertificatePolicy {
        public bool CheckValidationResult(ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, WebRequest request, int certificateProblem)
        {
            return true;
        }
    }
    public class HttpResourceProvider
    {
        private static bool firstRun = true;
        private static WebClient client()
        {
            if (firstRun)
            {
                ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(bypassAllCertificateStuff);
                ServicePointManager.DefaultConnectionLimit = 10;
                firstRun = false;
            }
            return new WebClient { Credentials = new NetworkCredential("exampleUsername", "examplePassword") };
        }
        private static bool bypassAllCertificateStuff(object sender, X509Certificate cert, X509Chain chain, System.Net.Security.SslPolicyErrors error)
        {
            if (cert.Subject == "E=<EMAIL>, CN=localhost, OU=Janitorial section, O=Hyber Inc., L=Yawstown, S=Gondwanaland, C=se"
                && cert.Issuer == "E=<EMAIL>, CN=localhost, OU=Janitorial section, O=Hyber Inc., L=Yawstown, S=Gondwanaland, C=se")
                return true;
            return false;
        }
        public static string secureGetString(string resource)
        {
            return client().DownloadString(resource);
        }
        public static string insecureGetString(string resource)
        {
            return client().DownloadString(resource);
        }
        public static string securePutData(string uri, byte[] data)
        {
            return decode(client().UploadData(uri, data));
        }
        public static byte[] secureGetData(string resource)
        {
            return client().DownloadData(resource);
        }
        public static string securePutFile(string uri, string filename)
        {
            return decode(client().UploadFile(uri, filename));
        }
        private static string decode(byte[] bytes)
        {
{'fraction_non_alphanumeric': 0.07524836186852674, 'fraction_numerical': 0.006763897696047347, 'mean_word_length': 2.8534201954397393, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '10819', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1087, 'n_words': 251}