Rainbows! Rack HTTP server user/dev discussion
 help / color / Atom feed
57c917325633db0f62fd58bb4caaab9159940a9a blob 1138 bytes (raw)

 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
37
38
 
# -*- encoding: binary -*-
# :enddoc:
module Rainbows::Error

  # if we get any error, try to write something back to the client
  # assuming we haven't closed the socket, but don't get hung up
  # if the socket is already closed or broken.  We'll always ensure
  # the socket is closed at the end of this function
  def self.write(io, e)
    msg = response(e) and Kgio.trywrite(io, msg)
  rescue
  end

  def self.app(e)
    Unicorn.log_error(Rainbows.server.logger, "app error", e)
  rescue
  end

  def self.listen_loop(e)
    Rainbows.alive or return
    Unicorn.log_error(Rainbows.server.logger, "listen loop error", e)
  rescue
  end

  def self.response(e)
    case e
    when EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL,
         Errno::EBADF, Errno::ENOTCONN, Errno::ETIMEDOUT, Errno::EHOSTUNREACH
      # swallow error if client shuts down one end or disconnects
    when Unicorn::HttpParserError
      "HTTP/1.1 400 Bad Request\r\n\r\n" # try to tell the client they're bad
    when IOError # HttpParserError is an IOError
    else
      app(e)
      "HTTP/1.1 500 Internal Server Error\r\n\r\n"
    end
  end
end
debug log:

solving 57c9173 ...
found 57c9173 in http://bogomips.org/rainbows.git

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror http://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git