kirk 0.2.0.beta.2-java → 0.2.0.beta.3-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kirk/server/builder.rb +18 -13
- data/lib/kirk/server/handler.rb +3 -1
- data/lib/kirk/version.rb +1 -1
- metadata +1 -1
data/lib/kirk/server/builder.rb
CHANGED
@@ -65,12 +65,15 @@ module Kirk
|
|
65
65
|
@current.hosts.concat hosts
|
66
66
|
end
|
67
67
|
|
68
|
-
def listen(
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
def listen(*listeners)
|
69
|
+
listeners = listeners.map do |listener|
|
70
|
+
listener = listener.to_s
|
71
|
+
listener = ":#{listener}" unless listener.index(':')
|
72
|
+
listener = "0.0.0.0#{listener}" if listener.index(':') == 0
|
73
|
+
listener
|
74
|
+
end
|
72
75
|
|
73
|
-
@current.listen =
|
76
|
+
@current.listen = listeners
|
74
77
|
end
|
75
78
|
|
76
79
|
def watch(*watch)
|
@@ -88,7 +91,7 @@ module Kirk
|
|
88
91
|
application = HotDeployable.new(c)
|
89
92
|
application.add_watcher(watcher)
|
90
93
|
|
91
|
-
ctx.set_connector_names
|
94
|
+
ctx.set_connector_names c.listen
|
92
95
|
ctx.set_handler application
|
93
96
|
end
|
94
97
|
end
|
@@ -102,15 +105,17 @@ module Kirk
|
|
102
105
|
@connectors = {}
|
103
106
|
|
104
107
|
@configs.each do |config|
|
105
|
-
|
108
|
+
config.listen.each do |listener|
|
109
|
+
next if @connectors.key?(listener)
|
106
110
|
|
107
|
-
|
111
|
+
host, port = listener.split(':')
|
108
112
|
|
109
|
-
|
110
|
-
|
111
|
-
|
113
|
+
connector = Jetty::SelectChannelConnector.new
|
114
|
+
connector.set_host(host)
|
115
|
+
connector.set_port(port.to_i)
|
112
116
|
|
113
|
-
|
117
|
+
@connectors[listener] = connector
|
118
|
+
end
|
114
119
|
end
|
115
120
|
|
116
121
|
@connectors.values
|
@@ -135,7 +140,7 @@ module Kirk
|
|
135
140
|
|
136
141
|
def new_config
|
137
142
|
ApplicationConfig.new.tap do |config|
|
138
|
-
config.listen = '0.0.0.0:9090'
|
143
|
+
config.listen = ['0.0.0.0:9090']
|
139
144
|
config.watch = [ ]
|
140
145
|
config.bootstrap_path = File.expand_path('../bootstrap.rb', __FILE__)
|
141
146
|
end
|
data/lib/kirk/server/handler.rb
CHANGED
@@ -15,6 +15,7 @@ module Kirk
|
|
15
15
|
QUERY_STRING = 'QUERY_STRING'.freeze
|
16
16
|
SERVER_NAME = 'SERVER_NAME'.freeze
|
17
17
|
SERVER_PORT = 'SERVER_PORT'.freeze
|
18
|
+
LOCAL_PORT = 'LOCAL_PORT'.freeze
|
18
19
|
CONTENT_TYPE = 'CONTENT_TYPE'.freeze
|
19
20
|
CONTENT_LENGTH = 'CONTENT_LENGTH'.freeze
|
20
21
|
REQUEST_URI = 'REQUEST_URI'.freeze
|
@@ -73,7 +74,8 @@ module Kirk
|
|
73
74
|
REMOTE_HOST => request.get_remote_host || "",
|
74
75
|
REMOTE_ADDR => request.get_remote_addr || "",
|
75
76
|
REMOTE_USER => request.get_remote_user || "",
|
76
|
-
SERVER_PORT => request.
|
77
|
+
SERVER_PORT => request.get_server_port.to_s,
|
78
|
+
LOCAL_PORT => request.get_local_port.to_s,
|
77
79
|
RACK_VERSION => ::Rack::VERSION)
|
78
80
|
|
79
81
|
# Process the content length
|
data/lib/kirk/version.rb
CHANGED