<commit_before>#include <smooth/application/network/http/HTTPPacket.h>

#include <string>
#include <unordered_map>
#include <algorithm>

namespace smooth
{
    namespace application
    {
        namespace network
        {
            namespace http
            {
                HTTPPacket::HTTPPacket(ResponseCode code, const std::string& version,
                                       const std::unordered_map<std::string, std::string>& new_headers,
                                       std::vector<uint8_t>& response_content)
                {
                    append("HTTP/");
                    append(version);
                    append(" ");
                    append(std::to_string(static_cast<int>(code)));
                    append(" ");
                    append(response_code_to_text.at(code));
                    append("\r\n");

                    for (const auto& header : new_headers)
                    {
                        const auto& key = header.first;
                        const auto& value = header.second;

                        add_header(key, value);
                    }

                    add_header("Content-Length", std::to_string(response_content.size()));

                    // Add required ending CRLF
                    append("\r\n");

                    if (!response_content.empty())
                    {
                        std::copy(response_content.begin(), response_content.end(), std::back_inserter(content));
                    }
                }

                void HTTPPacket::append(const std::string& s)
                {
                    std::copy(s.begin(), s.end(), std::back_inserter(content));
                }
<commit_msg>#19 - Don't add content-length.<commit_after>#include <smooth/application/network/http/HTTPPacket.h>

#include <string>
#include <unordered_map>
#include <algorithm>

namespace smooth
{
    namespace application
    {
        namespace network
        {
            namespace http
            {
                HTTPPacket::HTTPPacket(ResponseCode code, const std::string& version,
                                       const std::unordered_map<std::string, std::string>& new_headers,
                                       std::vector<uint8_t>& response_content)
                {
                    append("HTTP/");
                    append(version);
                    append(" ");
                    append(std::to_string(static_cast<int>(code)));
                    append(" ");
                    append(response_code_to_text.at(code));
                    append("\r\n");

                    for (const auto& header : new_headers)
                    {
                        const auto& key = header.first;
                        const auto& value = header.second;

                        add_header(key, value);
                    }

                    // Add required ending CRLF
                    append("\r\n");

                    if (!response_content.empty())
                    {
                        std::copy(response_content.begin(), response_content.end(), std::back_inserter(content));
                    }
                }

                void HTTPPacket::append(const std::string& s)
                {
                    std::copy(s.begin(), s.end(), std::back_inserter(content));
                }

{'fraction_non_alphanumeric': 0.10784313725490197, 'fraction_numerical': 0.0011883541295306002, 'mean_word_length': 1.1992161985630307, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3428643', 'n_tokens_mistral': 823, 'n_tokens_neox': 764, 'n_words': 137}