<commit_before>module MarkTemplateStreaming
  def render_to_body(options={})
    @streaming_template = true if options[:stream]
    super
  end

  # credit to https://stackoverflow.com/questions/7986150/http-streaming-in-rails-not-working-when-using-rackdeflater/10596123#10596123
  def _process_options(options)
    stream = options.delete(:stream)
    super
    if stream && request.version != "HTTP/1.0"
      # Same as org implmenation except don't set the transfer-encoding header
      # The Rack::Chunked middleware will handle it
      headers["Cache-Control"] ||= "no-cache"
      headers.delete('Content-Length')
      options[:stream] = stream
    end
  end
<commit_msg>add last-modified header for template streaming<commit_after>module MarkTemplateStreaming
  def render_to_body(options={})
    @streaming_template = true if options[:stream]
    super
  end

  # credit to https://stackoverflow.com/questions/7986150/http-streaming-in-rails-not-working-when-using-rackdeflater/10596123#10596123
  def _process_options(options)
    stream = options.delete(:stream)
    super
    if stream && request.version != "HTTP/1.0"
      # Same as org implmenation except don't set the transfer-encoding header
      # The Rack::Chunked middleware will handle it
      headers["Cache-Control"] ||= "no-cache"
      headers["Last-Modified"] ||= Time.now.httpdate
      headers.delete('Content-Length')
      options[:stream] = stream
    end
  end

{'fraction_non_alphanumeric': 0.10973084886128365, 'fraction_numerical': 0.03450655624568668, 'mean_word_length': 3.7540983606557377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2481040', 'n_tokens_mistral': 468, 'n_tokens_neox': 429, 'n_words': 97}