riddl 0.99.133 → 0.99.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,16 +38,6 @@ module Thin #{{{
|
|
38
38
|
end
|
39
39
|
end #}}}
|
40
40
|
|
41
|
-
class WebSocketParserData
|
42
|
-
attr_accessor :headers, :request_path, :query_string, :http_method, :body, :request_url
|
43
|
-
def match(what)
|
44
|
-
@body =~ what
|
45
|
-
end
|
46
|
-
def upgrade?
|
47
|
-
true
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
41
|
module EventMachine
|
52
42
|
module WebSocket
|
53
43
|
class Handshake
|
@@ -61,44 +51,56 @@ module EventMachine
|
|
61
51
|
end
|
62
52
|
|
63
53
|
module Riddl
|
64
|
-
|
65
|
-
class
|
54
|
+
module Protocols
|
55
|
+
class WebSocket < ::EventMachine::WebSocket::Connection
|
56
|
+
class Error < RuntimeError; end
|
66
57
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
58
|
+
class ParserData
|
59
|
+
attr_accessor :headers, :request_path, :query_string, :http_method, :body, :request_url
|
60
|
+
def match(what)
|
61
|
+
@body =~ what
|
62
|
+
end
|
63
|
+
def upgrade?
|
64
|
+
true
|
65
|
+
end
|
66
|
+
end
|
72
67
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
68
|
+
def self.new(*args)
|
69
|
+
instance = allocate
|
70
|
+
instance.__send__(:initialize, *args)
|
71
|
+
instance
|
72
|
+
end
|
78
73
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
84
|
-
end
|
74
|
+
def send_data(*args)
|
75
|
+
EM.next_tick do
|
76
|
+
@socket.send_data(*args)
|
77
|
+
end
|
78
|
+
end
|
85
79
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
80
|
+
def close_connection(*args)
|
81
|
+
EM.next_tick do
|
82
|
+
trigger_on_close
|
83
|
+
@socket.close_connection(*args)
|
84
|
+
end
|
85
|
+
end
|
90
86
|
|
91
|
-
|
92
|
-
@
|
93
|
-
@
|
94
|
-
@
|
95
|
-
@closed = true
|
96
|
-
socket.websocket = self
|
97
|
-
socket.comm_inactivity_timeout = 0
|
98
|
-
end
|
87
|
+
def trigger_on_message(msg); @app.onmessage(msg); end
|
88
|
+
def trigger_on_open(handshake); @closed = false; @app.onopen; end
|
89
|
+
def trigger_on_close; @closed = true; @app.onclose; end
|
90
|
+
def trigger_on_error(error); @closed = true; @app.onerror(error); true; end
|
99
91
|
|
100
|
-
|
101
|
-
|
92
|
+
def initialize(app, socket)
|
93
|
+
@app = app
|
94
|
+
@socket = socket
|
95
|
+
@ssl = socket.backend.respond_to?(:ssl?) && socket.backend.ssl?
|
96
|
+
@closed = true
|
97
|
+
socket.websocket = self
|
98
|
+
socket.comm_inactivity_timeout = 0
|
99
|
+
end
|
100
|
+
|
101
|
+
def closed?
|
102
|
+
@closed
|
103
|
+
end
|
102
104
|
end
|
103
105
|
end
|
104
106
|
end
|
data/lib/ruby/riddl/server.rb
CHANGED
@@ -488,7 +488,7 @@ module Riddl
|
|
488
488
|
def run(what,*args)# {{{
|
489
489
|
return if @riddl_path == ''
|
490
490
|
if what.class == Class && what.superclass == Riddl::WebSocketImplementation
|
491
|
-
data =
|
491
|
+
data = Riddl::Protocols::WebSocket::ParserData.new
|
492
492
|
data.request_path = @riddl_pinfo
|
493
493
|
data.request_url = @riddl_pinfo + '?' + @riddl_query_string
|
494
494
|
data.query_string = @riddl_query_string
|
@@ -498,7 +498,7 @@ module Riddl
|
|
498
498
|
@riddl_headers.map { |key, value| [key.downcase.gsub('_','-'), value] }
|
499
499
|
]
|
500
500
|
w = what.new(@riddl_info.merge!(:a => args, :version => @riddl_env['HTTP_SEC_WEBSOCKET_VERSION'], :match => matching_path))
|
501
|
-
w.io = Riddl::WebSocket.new(w, @riddl_env['thin.connection'])
|
501
|
+
w.io = Riddl::Protocols::WebSocket.new(w, @riddl_env['thin.connection'])
|
502
502
|
w.io.dispatch(data)
|
503
503
|
end
|
504
504
|
if what.class == Class && what.superclass == Riddl::Implementation
|
data/riddl.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.99.
|
4
|
+
version: 0.99.134
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: tools
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xml-smart
|