From 5e7a124ed2216e7fe96f6f4ff108a235ec600487 Mon Sep 17 00:00:00 2001 From: //de Date: Sun, 22 Mar 2015 08:25:44 -0700 Subject: [PATCH 01/10] Closes #124 --- lib/reel/server/https.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/reel/server/https.rb b/lib/reel/server/https.rb index f22f4bd..df21ad2 100644 --- a/lib/reel/server/https.rb +++ b/lib/reel/server/https.rb @@ -27,12 +27,11 @@ def initialize(host, port, options={}, &callback) # if verify_mode isn't explicitly set, verify peers if we've # been provided CA information that would enable us to do so - ssl_context.verify_mode = case - when options.include?(:verify_mode) + ssl_context.verify_mode = if options.include?(:verify_mode) options[:verify_mode] - when options.include?(:ca_file) + elsif options.include?(:ca_file) OpenSSL::SSL::VERIFY_PEER - when options.include?(:ca_path) + elsif options.include?(:ca_path) OpenSSL::SSL::VERIFY_PEER else OpenSSL::SSL::VERIFY_NONE From a2cec82786de4129ac60d7b6ed87c33937c26f0a Mon Sep 17 00:00:00 2001 From: //de Date: Sun, 22 Mar 2015 10:43:18 -0700 Subject: [PATCH 02/10] Closes #153 and Closes #136 --- lib/reel/connection.rb | 2 +- lib/reel/request/parser.rb | 6 +++++- lib/reel/server/https.rb | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/reel/connection.rb b/lib/reel/connection.rb index d2eaf2b..3450599 100644 --- a/lib/reel/connection.rb +++ b/lib/reel/connection.rb @@ -56,7 +56,7 @@ def request req = @parser.current_request @request_fsm.transition :headers - @keepalive = false if req[CONNECTION] == CLOSE || req.version == HTTP_VERSION_1_0 + @keepalive = false if req.nil? || req[CONNECTION] == CLOSE || req.version == HTTP_VERSION_1_0 @current_request = req req diff --git a/lib/reel/request/parser.rb b/lib/reel/request/parser.rb index 1e8e6ce..5e095bc 100644 --- a/lib/reel/request/parser.rb +++ b/lib/reel/request/parser.rb @@ -43,7 +43,11 @@ def current_request def readpartial(size = @buffer_size) bytes = @socket.readpartial(size) - @parser << bytes + begin + @parser << bytes + rescue ArgumentError => ex + raise Errno::EPIPE + end end # diff --git a/lib/reel/server/https.rb b/lib/reel/server/https.rb index df21ad2..74770c1 100644 --- a/lib/reel/server/https.rb +++ b/lib/reel/server/https.rb @@ -50,9 +50,9 @@ def run begin socket = @server.accept rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE, - Errno::ETIMEDOUT, Errno::EHOSTUNREACH => ex + Errno::ETIMEDOUT, Errno::EHOSTUNREACH, IOError, EOFError => ex Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" - retry + next end async.handle_connection socket From 3909420e2eaf8163045254505d9b08bdf7659349 Mon Sep 17 00:00:00 2001 From: //de Date: Sun, 22 Mar 2015 11:05:54 -0700 Subject: [PATCH 03/10] retry vs. next, see if that passes jruby --- lib/reel/server/https.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reel/server/https.rb b/lib/reel/server/https.rb index 74770c1..212ec6a 100644 --- a/lib/reel/server/https.rb +++ b/lib/reel/server/https.rb @@ -52,7 +52,7 @@ def run rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE, Errno::ETIMEDOUT, Errno::EHOSTUNREACH, IOError, EOFError => ex Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" - next + retry #de next end async.handle_connection socket From c75c2da6d260c5bfd5e053857649f8117e0c8080 Mon Sep 17 00:00:00 2001 From: //de Date: Mon, 23 Mar 2015 23:58:57 -0700 Subject: [PATCH 04/10] Fixes focusing on getting jruby to pass. --- lib/reel/server/https.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/reel/server/https.rb b/lib/reel/server/https.rb index 212ec6a..7456039 100644 --- a/lib/reel/server/https.rb +++ b/lib/reel/server/https.rb @@ -51,8 +51,11 @@ def run socket = @server.accept rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE, Errno::ETIMEDOUT, Errno::EHOSTUNREACH, IOError, EOFError => ex - Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" - retry #de next + # Not ideal, but works for now: + unless defined? JRUBY_VERSION + Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" + end + retry end async.handle_connection socket From 3b152cafacc836bdc89f40ccd4d82755e9e51350 Mon Sep 17 00:00:00 2001 From: //de Date: Tue, 24 Mar 2015 00:51:21 -0700 Subject: [PATCH 05/10] no need to keep exeception --- lib/reel/request/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reel/request/parser.rb b/lib/reel/request/parser.rb index 5e095bc..1f67e5c 100644 --- a/lib/reel/request/parser.rb +++ b/lib/reel/request/parser.rb @@ -45,7 +45,7 @@ def readpartial(size = @buffer_size) bytes = @socket.readpartial(size) begin @parser << bytes - rescue ArgumentError => ex + rescue ArgumentError raise Errno::EPIPE end end From 10e92c562c0ab3b0af3cccea2c74cd429974fde3 Mon Sep 17 00:00:00 2001 From: //de Date: Tue, 24 Mar 2015 01:07:48 -0700 Subject: [PATCH 06/10] not necessary to demonstrate every possible way of passing in a string --- spec/reel/https_server_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/reel/https_server_spec.rb b/spec/reel/https_server_spec.rb index b402edc..52f1fea 100644 --- a/spec/reel/https_server_spec.rb +++ b/spec/reel/https_server_spec.rb @@ -2,6 +2,7 @@ require 'net/http' RSpec.describe Reel::Server::HTTPS do + let(:example_https_port) { example_port + 1 } let(:example_url) { "https://#{example_addr}:#{example_https_port}#{example_path}" } let(:endpoint) { URI(example_url) } @@ -44,7 +45,7 @@ raise ex if ex end - it 'verifies client SSL certs when provided with a CA' do + it "verifies client SSL certs when provided with a CA" do ex = nil handler = proc do |connection| @@ -75,7 +76,7 @@ raise ex if ex end - it %{fails to verify client certificates that aren't signed} do + it "fails to verify client certificates that aren't signed" do ex = nil handler = proc do |connection| From d2236556c5ab0f749215eb4c87265ea399c3f7ae Mon Sep 17 00:00:00 2001 From: //de Date: Tue, 24 Mar 2015 01:11:53 -0700 Subject: [PATCH 07/10] don't need to suppress error output for jruby, it's all screwed up without this being a problem. --- lib/reel/server/https.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/reel/server/https.rb b/lib/reel/server/https.rb index 7456039..8050ae8 100644 --- a/lib/reel/server/https.rb +++ b/lib/reel/server/https.rb @@ -49,12 +49,9 @@ def run loop do begin socket = @server.accept - rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE, + rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINPROGRESS, Errno::ETIMEDOUT, Errno::EHOSTUNREACH, IOError, EOFError => ex - # Not ideal, but works for now: - unless defined? JRUBY_VERSION - Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" - end + Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" retry end From 5335eb14f806cb9e656dd538b48dc853309a6544 Mon Sep 17 00:00:00 2001 From: //de Date: Tue, 24 Mar 2015 01:34:10 -0700 Subject: [PATCH 08/10] Removes build error on jruby: #176 --- lib/reel/server/https.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reel/server/https.rb b/lib/reel/server/https.rb index 8050ae8..73cba75 100644 --- a/lib/reel/server/https.rb +++ b/lib/reel/server/https.rb @@ -50,9 +50,9 @@ def run begin socket = @server.accept rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINPROGRESS, - Errno::ETIMEDOUT, Errno::EHOSTUNREACH, IOError, EOFError => ex + Errno::ETIMEDOUT, Errno::EHOSTUNREACH, EOFError => ex Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" - retry + next end async.handle_connection socket From 89d94ec79a4fe2c5bc208d551eba0634b59fa94c Mon Sep 17 00:00:00 2001 From: //de Date: Tue, 24 Mar 2015 01:48:11 -0700 Subject: [PATCH 09/10] clean up blizzard of SSL exceptions possible --- lib/reel/server/https.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/reel/server/https.rb b/lib/reel/server/https.rb index 73cba75..5c09cbc 100644 --- a/lib/reel/server/https.rb +++ b/lib/reel/server/https.rb @@ -49,8 +49,9 @@ def run loop do begin socket = @server.accept - rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINPROGRESS, - Errno::ETIMEDOUT, Errno::EHOSTUNREACH, EOFError => ex + rescue OpenSSL::SSL::SSLError, EOFError, + Errno::ECONNRESET, Errno::EPIPE, Errno::EINPROGRESS, + Errno::ETIMEDOUT, Errno::EHOSTUNREACH => ex Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}" next end From a68ceee2e03c9dc69451d1fee96d97abeda6947e Mon Sep 17 00:00:00 2001 From: //de Date: Tue, 24 Mar 2015 01:59:16 -0700 Subject: [PATCH 10/10] Updated changelog to reflect commits made since last year. --- CHANGES.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7ea98ff..ef53201 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,22 @@ +0.6.0 +---- +* Fix stack level too deep when writing to ChunkStream +* Use HTTP::Resonse::Status::REASONS table ( HTTP::Response::* deprecated in the HTTP gem ) +* Use Timers 3.0.0 API +* Case-insensitivity for header field names ( i.e. in case a proxy downcases them ) +* Catch when openssl sometimes fires ECONNRESET, EPIPE, ETIMEDOUT, EHOSTUNREACH and as an error +* Unused `optimize` socket modifications taken off all server implementations +* Fixed 404 error in roundtrip example +* Fixed "Reel::StateError: already processing a request" when client is killed +* Numerous updates to rspec. +* Switched to websocket/driver and improved websocket handling +* Implement DriverEnvironment to fix websocket example +* Refactored Server::HTTPS to be more idomatic +* Fixed jRuby related test failures +* Fixed "ArgumentError: Data object has already been freed" caused by underlying parser. + 0.5.0 (2014-04-15) ------------------- +---- * Reel::Server(::SSL) renamed to Reel::Server::HTTP and Reel::Server::HTTPS * New Reel::Spy API for observing requests and responses from the server * Fixes to chunked encoding handling