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.
@@ -65,12 +65,15 @@ module Kirk
65
65
  @current.hosts.concat hosts
66
66
  end
67
67
 
68
- def listen(listen)
69
- listen = listen.to_s
70
- listen = ":#{listen}" unless listen.index(':')
71
- listen = "0.0.0.0#{listen}" if listen.index(':') == 0
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 = 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 [c.listen]
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
- next if @connectors.key?(config.listen)
108
+ config.listen.each do |listener|
109
+ next if @connectors.key?(listener)
106
110
 
107
- host, port = config.listen.split(':')
111
+ host, port = listener.split(':')
108
112
 
109
- connector = Jetty::SelectChannelConnector.new
110
- connector.set_host(host)
111
- connector.set_port(port.to_i)
113
+ connector = Jetty::SelectChannelConnector.new
114
+ connector.set_host(host)
115
+ connector.set_port(port.to_i)
112
116
 
113
- @connectors[config.listen] = connector
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
@@ -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.get_local_port.to_s,
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
@@ -1,4 +1,4 @@
1
1
  module Kirk
2
2
  NAME = "kirk".freeze
3
- VERSION = "0.2.0.beta.2".freeze
3
+ VERSION = "0.2.0.beta.3".freeze
4
4
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: kirk
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 0.2.0.beta.2
5
+ version: 0.2.0.beta.3
6
6
  platform: java
7
7
  authors:
8
8
  - Carl Lerche