<commit_before><?php
namespace HomoChecker\Model;

use mpyw\Co\Co;
use mpyw\Co\CURLException;
use HomoChecker\Model\Validator\HeaderValidator;
use HomoChecker\Model\Validator\DOMValidator;
use HomoChecker\Model\Validator\URLValidator;

class Check
{
    const TIMEOUT = 5000;

    public function __construct()
    {
        $this->validators = [
            new HeaderValidator,
            new DOMValidator,
            new URLValidator,
        ];
    }

    public function initialize(string $url, bool $body)
    {
        $ch = curl_init($url);
        curl_setopt_array($ch, [
            CURLINFO_HEADER_OUT       => true,
            CURLOPT_AUTOREFERER       => true,
            CURLOPT_CONNECTTIMEOUT_MS => self::TIMEOUT,
            CURLOPT_FOLLOWLOCATION    => true,
            CURLOPT_MAXCONNECTS       => 16,
            CURLOPT_MAXREDIRS         => 5,
            CURLOPT_NOBODY            => !$body,
            CURLOPT_RETURNTRANSFER    => true,
            CURLOPT_SSL_VERIFYPEER    => false,<commit_msg>Use CURLOPT_TCP_FASTOPEN when not using SSL/TLS https://twitter.com/mpyw/status/752131102806904832<commit_after><?php
namespace HomoChecker\Model;

use mpyw\Co\Co;
use mpyw\Co\CURLException;
use HomoChecker\Model\Validator\HeaderValidator;
use HomoChecker\Model\Validator\DOMValidator;
use HomoChecker\Model\Validator\URLValidator;

class Check
{
    const TIMEOUT = 5000;

    public function __construct()
    {
        $this->validators = [
            new HeaderValidator,
            new DOMValidator,
            new URLValidator,
        ];
    }

    public function initialize(string $url, bool $body)
    {
        $ssl = strpos($url, 'https://') === 0;
        $ch = curl_init($url);
        curl_setopt_array($ch, [
            CURLINFO_HEADER_OUT       => true,
            CURLOPT_AUTOREFERER       => true,
            CURLOPT_CONNECTTIMEOUT_MS => self::TIMEOUT,
            CURLOPT_FOLLOWLOCATION    => true,
            CURLOPT_MAXCONNECTS       => 16,
            CURLOPT_MAXREDIRS         => 5,
            CURLOPT_NOBODY            => !$body,
            CURLOPT_RETURNTRANSFER    => true,
            CURLOPT_SSL_VERIFYPEER    => false,
            CURLOPT_TCP_FASTOPEN      => !$ssl,
{'fraction_non_alphanumeric': 0.09237668161434978, 'fraction_numerical': 0.014798206278026907, 'mean_word_length': 2.0730027548209367, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 2, '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': '1841461', 'n_tokens_mistral': 727, 'n_tokens_neox': 689, 'n_words': 121}