Permalink
Browse files

reverting to the original Handler interface while keeping the secure_…

…proxy option working
  • Loading branch information...
1 parent 46c4665 commit 2eb3b91b290d4894ff7136a9943c5d3cd6d7367f @danielpietzsch danielpietzsch committed Jun 20, 2012
Showing with 5 additions and 5 deletions.
  1. +1 −1 lib/em-websocket/connection.rb
  2. +4 −4 lib/em-websocket/handler_factory.rb
@@ -108,7 +108,7 @@ def dispatch(data)
else
debug [:inbound_headers, data]
@data << data
- @handler = HandlerFactory.build(self, @data, @secure, @secure_proxy, @debug)
+ @handler = HandlerFactory.build(self, @data, @secure || @secure_proxy, @debug)
unless @handler
# The whole header has not been received yet.
return false
@@ -4,7 +4,7 @@ class HandlerFactory
PATH = /^(\w+) (\/[^\s]*) HTTP\/1\.1$/
HEADER = /^([^:]+):\s*(.+)$/
- def self.build(connection, data, secure = false, secure_proxy = false, debug = false)
+ def self.build(connection, data, secure = false, debug = false)
(header, remains) = data.split("\r\n\r\n", 2)
unless remains
# The whole header has not been received yet.
@@ -35,10 +35,10 @@ def self.build(connection, data, secure = false, secure_proxy = false, debug = f
request[h[1].strip.downcase] = h[2].strip if h
end
- build_with_request(connection, request, remains, secure, secure_proxy, debug)
+ build_with_request(connection, request, remains, secure, debug)
end
- def self.build_with_request(connection, request, remains, secure = false, secure_proxy = false, debug = false)
+ def self.build_with_request(connection, request, remains, secure = false, debug = false)
# Determine version heuristically
version = if request['sec-websocket-version']
# Used from drafts 04 onwards
@@ -74,7 +74,7 @@ def self.build_with_request(connection, request, remains, secure = false, secure
end
# transform headers
- protocol = ((secure || secure_proxy) ? "wss" : "ws")
+ protocol = (secure ? "wss" : "ws")
request['host'] = Addressable::URI.parse("#{protocol}://"+request['host'])
case version

0 comments on commit 2eb3b91

Please sign in to comment.