Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
blob bcf1dbac6b5129ba1a10bc4bb395eb2bb45e73ad 675 bytes (raw)
name: lib/rainbows/http_parser.rb 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
# -*- encoding: binary -*-
# :enddoc:
# avoid modifying Unicorn::HttpParser
class Rainbows::HttpParser < Unicorn::HttpParser
  @keepalive_requests = 100
  class << self
    attr_accessor :keepalive_requests
  end

  def initialize(*args)
    @keepalive_requests = self.class.keepalive_requests
    super
  end

  def next?
    return false if (@keepalive_requests -= 1) <= 0
    super
  end

  def hijack_setup(io)
    @hijack_io = io
    env['rack.hijack'] = self # avoid allocating a new proc this way
  end

  def call # for rack.hijack
    env['rack.hijack_io'] = @hijack_io
  end

  def self.quit
    alias_method :next?, :never!
  end

  def never!
    false
  end
end

debug log:

solving bcf1dba ...
found bcf1dba in https://yhbt.net/rainbows.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).