spider-gazelle 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 883af96ffb1054dc17b7f623ca7a6a1b6afe48cf
4
- data.tar.gz: 9dda42f38e4cb802d4c6a11632438c16c2868cde
3
+ metadata.gz: d572d56238befc1bb320a35caa722a5b5862de98
4
+ data.tar.gz: 543e26733659f208fd6f2cbb8c634a2082b3a01b
5
5
  SHA512:
6
- metadata.gz: 848ba774b73a281f074505d8a0c92e8742e78cc6608ed441e283497f26fdfda6b3f992547b2df4eae4960cb3649e93ca135ffdf0173e7b97e22c67f193e3f8ab
7
- data.tar.gz: 170c737ed7502cbff903f1ef8d04f8050d0632471d50077384125f284608b5362fe3585e8c823faa30973d21f0fb55901154c579c3c861ebd724d32190f0b2d6
6
+ metadata.gz: 053e8b2128d068779d21d5ffd8f312265895b61d7da0ccceb8dea262c2fb6026dbcd3bf4f41bdc4f7809a0d7a6bc3baf4a56be58a42a31d05e33cad4b7af1eb6
7
+ data.tar.gz: 8c8a6ee3c20692c3173b2a0240818223cf4cd9c967f007db3fde7e6186f273234c81e7419906b787325c5e39ff0b6e6ae3e858e0625ad9f13de7ca8b3256638f
@@ -9,7 +9,7 @@ require 'spider-gazelle/signaller'
9
9
 
10
10
 
11
11
  module SpiderGazelle
12
- VERSION = '2.0.0'.freeze
12
+ VERSION = '2.0.1'.freeze
13
13
  EXEC_NAME = 'sg'.freeze
14
14
  INTERNAL_PIPE_BACKLOG = 128
15
15
 
@@ -16,8 +16,9 @@ module SpiderGazelle
16
16
 
17
17
  app, opts = ::Rack::Builder.parse_file(rackup)
18
18
  tls = configure_tls(options)
19
+ port = tls ? 443 : 80
19
20
 
20
- val = [app, options[:app_mode], options[:port], tls]
21
+ val = [app, options[:app_mode], port, tls]
21
22
  @apps << val
22
23
  @loaded[rackup] = val
23
24
  }
@@ -37,8 +38,9 @@ module SpiderGazelle
37
38
 
38
39
  id = @apps.length
39
40
  tls = configure_tls(options)
41
+ port = tls ? 443 : 80
40
42
 
41
- val = [app, options[:app_mode], options[:port], tls]
43
+ val = [app, options[:app_mode], port, tls]
42
44
  @apps << val
43
45
  @loaded[obj_id] = val
44
46
 
@@ -111,7 +111,7 @@ module SpiderGazelle
111
111
  if host = @env[HTTP_HOST]
112
112
  if colon = host.index(COLON)
113
113
  @env[SERVER_NAME] = host[0, colon]
114
- @env[SERVER_PORT] = host[colon+1, host.bytesize]
114
+ @env[SERVER_PORT] = host[colon + 1, host.bytesize].to_i
115
115
  else
116
116
  @env[SERVER_NAME] = host
117
117
  end
data/spec/http1_spec.rb CHANGED
@@ -76,6 +76,8 @@ describe ::SpiderGazelle::Gazelle::Http1 do
76
76
 
77
77
  it "should process a single request and close the connection", http1: true do
78
78
  app = lambda do |env|
79
+ expect(env['SERVER_PORT']).to eq(80)
80
+
79
81
  body = 'Hello, World!'
80
82
  [200, {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s}, [body]]
81
83
  end
@@ -133,7 +135,7 @@ describe ::SpiderGazelle::Gazelle::Http1 do
133
135
  expect(env['REQUEST_PATH']).to eq('/')
134
136
  expect(env['QUERY_STRING']).to eq('test=ing')
135
137
  expect(env['SERVER_NAME']).to eq('spider.gazelle.net')
136
- expect(env['SERVER_PORT']).to eq(80)
138
+ expect(env['SERVER_PORT']).to eq(3000)
137
139
  expect(env['REMOTE_ADDR']).to eq('127.0.0.1')
138
140
  expect(env['rack.url_scheme']).to eq('http')
139
141
 
@@ -143,7 +145,7 @@ describe ::SpiderGazelle::Gazelle::Http1 do
143
145
 
144
146
  @loop.run {
145
147
  @http1.load(@socket, @port, app, @app_mode, @tls)
146
- @http1.parse("GET /?test=ing HTTP/1.1\r\nHost: spider.gazelle.net\r\nConnection: Close\r\n\r\n")
148
+ @http1.parse("GET /?test=ing HTTP/1.1\r\nHost: spider.gazelle.net:3000\r\nConnection: Close\r\n\r\n")
147
149
  }
148
150
 
149
151
  expect(@shutdown_called).to be == 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spider-gazelle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen von Takach