Module: Iodine::Rack
- Defined in:
- lib/rack/handler/iodine.rb,
ext/iodine/iodine_helpers.c
Overview
Defined Under Namespace
Modules: Utils
Constant Summary collapse
- IODINE_RACK_LOADED =
true
Class Method Summary collapse
-
.address ⇒ Object
get/set the HTTP socket binding address.
-
.address=(val) ⇒ Object
get/set the HTTP socket binding address.
-
.app ⇒ Object
get/set the Rack application.
-
.app=(val) ⇒ Object
get/set the Rack application.
-
.log ⇒ Object
get/set the HTTP logging value (true / false).
-
.log=(val) ⇒ Object
get/set the HTTP logging value (true / false).
-
.max_body ⇒ Object
get/set the maximum HTTP body size for incoming data.
-
.max_body=(val) ⇒ Object
get/set the maximum HTTP body size for incoming data.
-
.max_body_size ⇒ Object
get/set the maximum HTTP body size for incoming data.
-
.max_body_size=(val) ⇒ Object
get/set the maximum HTTP body size for incoming data.
-
.max_msg ⇒ Object
get/set the maximum Websocket body size for incoming data.
-
.max_msg=(val) ⇒ Object
get/set the maximum Websocket body size for incoming data.
-
.max_msg_size ⇒ Object
get/set the maximum Websocket body size for incoming data.
-
.max_msg_size=(val) ⇒ Object
get/set the maximum Websocket body size for incoming data.
-
.port ⇒ Object
get/set the HTTP listening port.
-
.port=(val) ⇒ Object
get/set the HTTP listening port.
-
.public ⇒ Object
get/set the HTTP public folder property.
-
.public=(val) ⇒ Object
get/set the HTTP public folder property.
-
.run(app, options = {}) ⇒ Object
Runs a Rack app, as par the Rack handler requirements.
-
.timeout ⇒ Object
get/set the HTTP connection timeout property.
-
.timeout=(t) ⇒ Object
get/set the HTTP connection timeout property.
-
.ws_timeout ⇒ Object
get/set the Websocket connection timeout property.
-
.ws_timeout=(t) ⇒ Object
get/set the Websocket connection timeout property.
Class Method Details
.address ⇒ Object
get/set the HTTP socket binding address. Defaults to ‘nil` (usually best).
119 120 121 |
# File 'lib/rack/handler/iodine.rb', line 119 def self.address @address end |
.address=(val) ⇒ Object
get/set the HTTP socket binding address. Defaults to ‘nil` (usually best).
114 115 116 |
# File 'lib/rack/handler/iodine.rb', line 114 def self.address=(val) @address = val end |
.app ⇒ Object
get/set the Rack application.
14 15 16 |
# File 'lib/rack/handler/iodine.rb', line 14 def self.app @app end |
.app=(val) ⇒ Object
get/set the Rack application.
9 10 11 |
# File 'lib/rack/handler/iodine.rb', line 9 def self.app=(val) @app = val end |
.log ⇒ Object
get/set the HTTP logging value (true / false). Defaults to the incoming argumrnts or ‘false`.
95 96 97 |
# File 'lib/rack/handler/iodine.rb', line 95 def self.log @log end |
.log=(val) ⇒ Object
get/set the HTTP logging value (true / false). Defaults to the incoming argumrnts or ‘false`.
90 91 92 |
# File 'lib/rack/handler/iodine.rb', line 90 def self.log=(val) @log = val end |
.max_body ⇒ Object
get/set the maximum HTTP body size for incoming data. Defaults to ~50Mb.
65 66 67 |
# File 'lib/rack/handler/iodine.rb', line 65 def self.max_body @max_body end |
.max_body=(val) ⇒ Object
get/set the maximum HTTP body size for incoming data. Defaults to ~50Mb. 0 values are silently ignored.
60 61 62 |
# File 'lib/rack/handler/iodine.rb', line 60 def self.max_body=(val) @max_body = val end |
.max_body_size ⇒ Object
get/set the maximum HTTP body size for incoming data. Defaults to ~50Mb.
55 56 57 |
# File 'lib/rack/handler/iodine.rb', line 55 def self.max_body_size @max_body end |
.max_body_size=(val) ⇒ Object
get/set the maximum HTTP body size for incoming data. Defaults to ~50Mb. 0 values are silently ignored.
50 51 52 |
# File 'lib/rack/handler/iodine.rb', line 50 def self.max_body_size=(val) @max_body = val end |
.max_msg ⇒ Object
get/set the maximum Websocket body size for incoming data. Defaults to defaults to ~250KB. 0 values are silently ignored.
85 86 87 |
# File 'lib/rack/handler/iodine.rb', line 85 def self.max_msg @max_msg end |
.max_msg=(val) ⇒ Object
get/set the maximum Websocket body size for incoming data. Defaults to defaults to ~250KB. 0 values are silently ignored.
80 81 82 |
# File 'lib/rack/handler/iodine.rb', line 80 def self.max_msg=(val) @max_msg = val end |
.max_msg_size ⇒ Object
get/set the maximum Websocket body size for incoming data. Defaults to defaults to ~250KB. 0 values are silently ignored.
75 76 77 |
# File 'lib/rack/handler/iodine.rb', line 75 def self.max_msg_size @max_msg end |
.max_msg_size=(val) ⇒ Object
get/set the maximum Websocket body size for incoming data. Defaults to defaults to ~250KB. 0 values are silently ignored.
70 71 72 |
# File 'lib/rack/handler/iodine.rb', line 70 def self.max_msg_size=(val) @max_msg = val end |
.port ⇒ Object
get/set the HTTP listening port. Defaults to 3000.
107 108 109 |
# File 'lib/rack/handler/iodine.rb', line 107 def self.port @port end |
.port=(val) ⇒ Object
get/set the HTTP listening port. Defaults to 3000.
102 103 104 |
# File 'lib/rack/handler/iodine.rb', line 102 def self.port=(val) @port = val end |
.public ⇒ Object
get/set the HTTP public folder property. Defaults to 5.
45 46 47 |
# File 'lib/rack/handler/iodine.rb', line 45 def self.public @public end |
.public=(val) ⇒ Object
get/set the HTTP public folder property. Defaults to 5. Defaults to the incoming argumrnts or ‘nil`.
39 40 41 |
# File 'lib/rack/handler/iodine.rb', line 39 def self.public=(val) @public = val end |
.run(app, options = {}) ⇒ Object
Runs a Rack app, as par the Rack handler requirements.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/rack/handler/iodine.rb', line 125 def self.run(app, = {}) # nested applications... is that a thing? if @app && @app != app old_app = @app @app = proc do |env| ret = old_app.call(env) ret = app.call(env) if !ret.is_a?(Array) || (ret.is_a?(Array) && ret[0].to_i == 404) ret end else @app = app end @port = [:Port].to_s if [:Port] @address = [:Address].to_s if [:Address] # # provide Websocket features using Rack::Websocket # Rack.send :remove_const, :Websocket if defined?(Rack::Websocket) # Rack.const_set :Websocket, ::Iodine::Websocket # start Iodine Iodine.start # # remove the Websocket features from Rack::Websocket # Rack.send :remove_const, :Websocket true end |
.timeout ⇒ Object
get/set the HTTP connection timeout property. Defaults to 5.
24 25 26 |
# File 'lib/rack/handler/iodine.rb', line 24 def self.timeout @timeout end |
.timeout=(t) ⇒ Object
get/set the HTTP connection timeout property. Defaults to 5. Limited to a maximum of 255. 0 values are silently ignored.
19 20 21 |
# File 'lib/rack/handler/iodine.rb', line 19 def self.timeout=(t) @timeout = t end |
.ws_timeout ⇒ Object
get/set the Websocket connection timeout property. Defaults to 40 seconds. Limited to a maximum of 255. 0 values are silently ignored.
34 35 36 |
# File 'lib/rack/handler/iodine.rb', line 34 def self.ws_timeout @ws_timeout end |
.ws_timeout=(t) ⇒ Object
get/set the Websocket connection timeout property. Defaults to 40 seconds. Limited to a maximum of 255. 0 values are silently ignored.
29 30 31 |
# File 'lib/rack/handler/iodine.rb', line 29 def self.ws_timeout=(t) @ws_timeout = t end |