<commit_before>var EventEmitter = require('events').EventEmitter,
    inherits = require('util').inherits;

var StreamSearch = require('streamsearch');

var B_DCRLF = new Buffer('\r\n\r\n'),
    RE_CRLF = /\r\n/g,
    RE_HDR = /^([^:]+):[ \t]?(.+)?$/;

function HeaderParser() {
  EventEmitter.call(this);

  var self = this;
  this.buffer = '';
  this.header = {};
  this.finished = false;
  this.ss = new StreamSearch(B_DCRLF);
  this.ss.on('info', function(isMatch, data, start, end) {
    if (data) {
      self.buffer += data.toString('ascii', start, end);
      if (RE_CRLF.test(self.buffer))
        self._parseHeader();
    }
    if (isMatch) {
      if (self.buffer)<commit_msg>HeaderParser: do not perform early header parsing<commit_after>var EventEmitter = require('events').EventEmitter,
    inherits = require('util').inherits;

var StreamSearch = require('streamsearch');

var B_DCRLF = new Buffer('\r\n\r\n'),
    RE_CRLF = /\r\n/g,
    RE_HDR = /^([^:]+):[ \t]?(.+)?$/;

function HeaderParser() {
  EventEmitter.call(this);

  var self = this;
  this.buffer = '';
  this.header = {};
  this.finished = false;
  this.ss = new StreamSearch(B_DCRLF);
  this.ss.on('info', function(isMatch, data, start, end) {
    if (data)
      self.buffer += data.toString('ascii', start, end);
    if (isMatch) {
      if (self.buffer)
{'fraction_non_alphanumeric': 0.18937125748502995, 'fraction_numerical': 0.0, 'mean_word_length': 3.4125412541254128, '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': '1159286', 'n_tokens_mistral': 489, 'n_tokens_neox': 481, 'n_words': 96}