Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] Rainbows! 5.0.0 - Rack HTTP server for the sleepy
@ 2015-11-25  1:04  5% Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2015-11-25  1:04 UTC (permalink / raw)
  To: ruby-talk; +Cc: rainbows-public

Rainbows! is an HTTP server for sleepy Rack applications.
While it will be maintained as long as anybody uses it,
use of Rainbows! for new projects is not recommended,
try other servers instead:

    http://bogomips.org/rainbows-public/20151020095934.GA19114@dcvr.yhbt.net/

Rainbows! 5.0.0 - maintained as long as anybody uses it!

This release syncs with unicorn 5 and drops some old compatibility
cruft from old releases.  Performance should be roughly unchanged
for Ruby 2.2 users while older Rubies (1.9.3 - 2.1) will see
minor, probably unnoticeable performance regressions.

Compatibility:

* The horrible, proprietary (:P) "Status:" response header is
  finally gone, saving at least 16 precious bytes in every HTTP
  response.  This should make it easier to write custom HTTP clients
  which are compatible across all HTTP servers.  It will hopefully
  make migrating between different Rack servers easier for new
  projects.

* Ruby 1.8 support removed.  Ruby 1.9.3 is currently the earliest
  supported version.  However, expect minor, likely-unnoticeable
  performance regressions if you use Ruby 2.1 or earlier.  Going
  forward, Rainbows! will favor the latest version (currently 2.2) of
  the mainline Ruby implementation, potentially sacrificing
  performance on older Rubies.

New features:

* sd_listen_fds(3) emulation added for systemd compatibility.
  You may now stop using PID files and other process monitoring
  software when using systemd.

* Newly-set TCP socket options are now applied to inherited sockets.

* Dynamic changes in the application to Rack::Utils::HTTP_STATUS
  hash is now supported; allowing users to set custom status lines
  in Rack to be reflected in unicorn.  This feature causes a minor
  performance regression, but is made up for Ruby 2.2 users with
  other optimizations.

* The monotonic clock is used under Ruby 2.1+, making the
  timeout feature immune to system clock changes.

As Rainbows! may be used anonymously without registration, the
project is committed to supporting anonymous and pseudonymous
help requests, contributions and feedback via plain-text mail to:

    rainbows-public@bogomips.org

The mail submission port (587) is open to those behind firewalls
and allows access via Tor and anonymous remailers.
Archives are accessible via:

* http://bogomips.org/rainbows-public/
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
* nntp://news.gmane.org/gmane.comp.lang.ruby.rainbows.general

and mirrored to various other places, so you do not even need
to use a valid address when posting.

18 changes since Rainbows! 4.7.0

      README: remove Zbatery references
      http_parser: handle keepalive_requests internally
      kill the moronic Status: header
      reflect changes in Rack::Utils::HTTP_STATUS_CODES
      reduce constant lookup dependencies
      http_parser: workaround hijack changes in unicorn 5
      http_server: add master_pid attribute
      stream_response_epoll: remove hijack_prepare call
      bump to unicorn 5.0.1, use monotonic clock
      add .gitattributes for Ruby method detection
      response: avoid garbage string entirely
      tiny bytecode reductions for cold paths
      Ruby 1.9.3+-only cleanups
      revactor: remove fcntl dependency
      response: simplify regexp
      t0105: fix test reliability
      fix Rainbows.now definition for old Rubies
      fix broken constant lookups in unmaintained bits

* http://rainbows.bogomips.org/
* rainbows-public@bogomips.org
* http://bogomips.org/rainbows-public/
* git clone git://bogomips.org/rainbows.git
* http://rainbows.bogomips.org/NEWS.atom.xml

*zzzzzzzz*

^ permalink raw reply	[relevance 5%]

* [PATCH 5/5] http_parser: workaround hijack changes in unicorn 5
  2015-11-14  2:47  7% [WIP 0/5] updates for unicorn 5 internal changes Eric Wong
@ 2015-11-14  2:47  6% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2015-11-14  2:47 UTC (permalink / raw)
  To: rainbows-public

unicorn lost the hijack_setup method in version 5,
so we must recreate it ourselves.
---
 lib/rainbows/coolio/client.rb        |  2 +-
 lib/rainbows/coolio/thread_client.rb |  2 +-
 lib/rainbows/epoll/client.rb         |  2 +-
 lib/rainbows/event_machine/client.rb |  2 +-
 lib/rainbows/http_parser.rb          |  9 +++++++++
 lib/rainbows/process_client.rb       |  4 ++--
 lib/rainbows/response.rb             | 16 +++-------------
 7 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/lib/rainbows/coolio/client.rb b/lib/rainbows/coolio/client.rb
index c05fd3a..ad827f6 100644
--- a/lib/rainbows/coolio/client.rb
+++ b/lib/rainbows/coolio/client.rb
@@ -125,7 +125,7 @@ class Rainbows::Coolio::Client < Coolio::IO
     @env['rack.input'] = input
     @env['REMOTE_ADDR'] = @_io.kgio_addr
     @env['async.callback'] = method(:write_async_response)
-    @hp.hijack_setup(@env, @_io)
+    @hp.hijack_setup(@_io)
     status, headers, body = catch(:async) {
       APP.call(@env.merge!(RACK_DEFAULTS))
     }
diff --git a/lib/rainbows/coolio/thread_client.rb b/lib/rainbows/coolio/thread_client.rb
index 4de705f..a3a2ebf 100644
--- a/lib/rainbows/coolio/thread_client.rb
+++ b/lib/rainbows/coolio/thread_client.rb
@@ -26,7 +26,7 @@ class Rainbows::Coolio::ThreadClient < Rainbows::Coolio::Client
   def app_response
     begin
       @env['REMOTE_ADDR'] = @_io.kgio_addr
-      @hp.hijack_setup(@env, @_io)
+      @hp.hijack_setup(@_io)
       APP.call(@env.merge!(RACK_DEFAULTS))
     rescue => e
       Rainbows::Error.app(e) # we guarantee this does not raise
diff --git a/lib/rainbows/epoll/client.rb b/lib/rainbows/epoll/client.rb
index 2d95a99..6dcbb81 100644
--- a/lib/rainbows/epoll/client.rb
+++ b/lib/rainbows/epoll/client.rb
@@ -65,7 +65,7 @@ module Rainbows::Epoll::Client
   def app_call input # called by on_read()
     @env['rack.input'] = input
     @env['REMOTE_ADDR'] = kgio_addr
-    @hp.hijack_setup(@env, self)
+    @hp.hijack_setup(self)
     status, headers, body = APP.call(@env.merge!(RACK_DEFAULTS))
     return hijacked if @hp.hijacked?
     ev_write_response(status, headers, body, @hp.next?)
diff --git a/lib/rainbows/event_machine/client.rb b/lib/rainbows/event_machine/client.rb
index 7fb88f6..039b7a6 100644
--- a/lib/rainbows/event_machine/client.rb
+++ b/lib/rainbows/event_machine/client.rb
@@ -38,7 +38,7 @@ class Rainbows::EventMachine::Client < EM::Connection
     @env['REMOTE_ADDR'] = @_io.kgio_addr
     @env['async.callback'] = method(:write_async_response)
     @env['async.close'] = EM::DefaultDeferrable.new
-    @hp.hijack_setup(@env, @_io)
+    @hp.hijack_setup(@_io)
     status, headers, body = catch(:async) {
       APP.call(@env.merge!(RACK_DEFAULTS))
     }
diff --git a/lib/rainbows/http_parser.rb b/lib/rainbows/http_parser.rb
index 30a67cb..bcf1dba 100644
--- a/lib/rainbows/http_parser.rb
+++ b/lib/rainbows/http_parser.rb
@@ -17,6 +17,15 @@ class Rainbows::HttpParser < Unicorn::HttpParser
     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
diff --git a/lib/rainbows/process_client.rb b/lib/rainbows/process_client.rb
index 492b8a6..a39d6cd 100644
--- a/lib/rainbows/process_client.rb
+++ b/lib/rainbows/process_client.rb
@@ -39,7 +39,7 @@ module Rainbows::ProcessClient
 
       set_input(env, hp)
       env['REMOTE_ADDR'] = kgio_addr
-      hp.hijack_setup(env, to_io)
+      hp.hijack_setup(to_io)
       status, headers, body = APP.call(env.merge!(RACK_DEFAULTS))
 
       if 100 == status.to_i
@@ -72,7 +72,7 @@ module Rainbows::ProcessClient
     begin
       set_input(env, hp)
       env['REMOTE_ADDR'] = kgio_addr
-      hp.hijack_setup(env, to_io)
+      hp.hijack_setup(to_io)
       status, headers, body = APP.call(env.merge!(RACK_DEFAULTS))
       if 100 == status.to_i
         write("HTTP/1.1 100 Continue\r\n\r\n".freeze)
diff --git a/lib/rainbows/response.rb b/lib/rainbows/response.rb
index 2e8d2d8..0b5e542 100644
--- a/lib/rainbows/response.rb
+++ b/lib/rainbows/response.rb
@@ -15,18 +15,8 @@ module Rainbows::Response
       Rainbows::HttpParser.keepalive_requests = 0
   end
 
-  # Rack 1.5.0 (protocol version 1.2) adds response hijacking support
-  if ((Rack::VERSION[0] << 8) | Rack::VERSION[1]) >= 0x0102
-    def hijack_prepare(value)
-      value
-    end
-
-    def hijack_socket
-      @hp.env['rack.hijack'].call
-    end
-  else
-    def hijack_prepare(_)
-    end
+  def hijack_socket
+    @hp.env['rack.hijack'].call
   end
 
   # returns the original body on success
@@ -45,7 +35,7 @@ module Rainbows::Response
       when "rack.hijack"
         # this was an illegal key in Rack < 1.5, so it should be
         # OK to silently discard it for those older versions
-        hijack = hijack_prepare(value)
+        hijack = value
         alive = false # No persistent connections for hijacking
       else
         if /\n/ =~ value
-- 
EW


^ permalink raw reply related	[relevance 6%]

* [WIP 0/5] updates for unicorn 5 internal changes
@ 2015-11-14  2:47  7% Eric Wong
  2015-11-14  2:47  6% ` [PATCH 5/5] http_parser: workaround hijack changes in unicorn 5 Eric Wong
  0 siblings, 1 reply; 3+ results
From: Eric Wong @ 2015-11-14  2:47 UTC (permalink / raw)
  To: rainbows-public

Only passes tests (using unicorn 4.x) so far.  There is likely
more to do, but just publishing these changes early to give
folks some time to look at them over the weekend.

 lib/rainbows/const.rb                   |  3 --
 lib/rainbows/coolio/client.rb           | 10 +++----
 lib/rainbows/coolio/thread_client.rb    |  6 ++--
 lib/rainbows/dev_fd_response.rb         | 22 ++++++--------
 lib/rainbows/epoll/client.rb            | 10 +++----
 lib/rainbows/error.rb                   |  4 +--
 lib/rainbows/ev_core.rb                 | 28 +++++++-----------
 lib/rainbows/event_machine/client.rb    | 14 ++++-----
 lib/rainbows/event_machine/try_defer.rb |  5 +---
 lib/rainbows/http_parser.rb             | 24 ++++++++++++++++
 lib/rainbows/http_server.rb             |  4 +--
 lib/rainbows/max_body.rb                | 13 +++------
 lib/rainbows/process_client.rb          | 19 ++++++------
 lib/rainbows/response.rb                | 51 +++++++++++----------------------
 lib/rainbows/reverse_proxy.rb           | 28 ++++++------------
 lib/rainbows/reverse_proxy/ev_client.rb |  7 ++---
 lib/rainbows/sendfile.rb                | 12 ++------
 lib/rainbows/server_token.rb            |  7 +----
 lib/rainbows/stream_response_epoll.rb   | 13 ++++-----
 19 files changed, 119 insertions(+), 161 deletions(-)

[PATCH 1/5] http_parser: handle keepalive_requests internally
[PATCH 2/5] kill the moronic Status: header
[PATCH 3/5] reflect changes in Rack::Utils::HTTP_STATUS_CODES
[PATCH 4/5] reduce constant lookup dependencies
[PATCH 5/5] http_parser: workaround hijack changes in unicorn 5

^ permalink raw reply	[relevance 7%]

Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-11-14  2:47  7% [WIP 0/5] updates for unicorn 5 internal changes Eric Wong
2015-11-14  2:47  6% ` [PATCH 5/5] http_parser: workaround hijack changes in unicorn 5 Eric Wong
2015-11-25  1:04  5% [ANN] Rainbows! 5.0.0 - Rack HTTP server for the sleepy Eric Wong

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).