<commit_before>#include <stdlib.h>
#include <string.h>

#include "bagride2.h"
#include "mmtrace.h"
#include "qdirty.h"
#include "sub0.h"

QD_DECL_STR(html);
QD_DECL_STR(js);
QD_DECL_STR(ico);

static const br_http_type_item_t http_hrsr_items[] = {
    {
        .id = QD_STR(html),
        .response_type = "text/html"
    },
    {
        .id = QD_STR(js),
        .response_type = "text/javascript"
    },
    {
        .id = QD_STR(ico),
        .response_type = "text/html" /* TODO */
    },
};

static void on_http_close(uv_handle_t* handle_) {
    br_http_cli_t* cli = (br_http_cli_t*) handle_->data;
    MM_INFO("(%5d) connection closed ", cli->m_request_num);
    free(cli->m_resbuf.base);
    free(cli);
}

static void on_http_after_write(uv_write_t* req_, int status_) {
    MM_ASSERT(status_ >= 0);
    uv_close((uv_handle_t*) req_->handle, on_http_close);
}

static int on_headers_complete(http_parser* parser) {
    br_http_cli_t* cli = (br_http_cli_t*) parser->data;
    MM_INFO("(%5d) http message parsed", cli->m_request_num);

    br_http_srv_parser_cb response_cb = (br_http_srv_parser_cb) cli->m_srv->m_gen_response_cb;
    MM_ASSERT(0 == response_cb(cli));

    uv_write(
            &cli->m_write_req,
            (uv_stream_t*) & cli->m_handle,<commit_msg>bug with binary files send<commit_after>#include <stdlib.h>
#include <string.h>

#include "bagride2.h"
#include "mmtrace.h"
#include "qdirty.h"
#include "sub0.h"

QD_DECL_STR(html);
QD_DECL_STR(js);
QD_DECL_STR(ico);
QD_DECL_STR(png);

static const br_http_type_item_t http_hrsr_items[] = {
    {
        .id = QD_STR(html),
        .response_type = "text/html"
    },
    {
        .id = QD_STR(js),
        .response_type = "text/javascript"
    },
    {
        .id = QD_STR(ico),
        .response_type = "image/x-icon"
    },
    {
        .id = QD_STR(png),
        .response_type = "image/png"
    },    
};

static void on_http_close(uv_handle_t* handle_) {
    br_http_cli_t* cli = (br_http_cli_t*) handle_->data;
    MM_INFO("(%5d) connection closed ", cli->m_request_num);
    free(cli->m_resbuf.base);
    free(cli);
}

static void on_http_after_write(uv_write_t* req_, int status_) {
    MM_ASSERT(status_ >= 0);
    uv_close((uv_handle_t*) req_->handle, on_http_close);
}

static int on_headers_complete(http_parser* parser) {
    br_http_cli_t* cli = (br_http_cli_t*) parser->data;
    MM_INFO("(%5d) http message parsed", cli->m_request_num);

    br_http_srv_parser_cb response_cb = (br_http_srv_parser_cb) cli->m_srv->m_gen_response_cb;
    MM_ASSERT(0 == response_cb(cli));

    uv_write(
            &cli->m_write_req,
            (uv_stream_t*) & cli->m_handle,
{'fraction_non_alphanumeric': 0.1462406015037594, 'fraction_numerical': 0.004511278195488722, 'mean_word_length': 3.3694581280788176, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, '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': '2594618', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1074, 'n_words': 167}