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 +4 -4
- data/lib/spider-gazelle.rb +1 -1
- data/lib/spider-gazelle/gazelle/app_store.rb +4 -2
- data/lib/spider-gazelle/gazelle/request.rb +1 -1
- data/spec/http1_spec.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d572d56238befc1bb320a35caa722a5b5862de98
|
4
|
+
data.tar.gz: 543e26733659f208fd6f2cbb8c634a2082b3a01b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 053e8b2128d068779d21d5ffd8f312265895b61d7da0ccceb8dea262c2fb6026dbcd3bf4f41bdc4f7809a0d7a6bc3baf4a56be58a42a31d05e33cad4b7af1eb6
|
7
|
+
data.tar.gz: 8c8a6ee3c20692c3173b2a0240818223cf4cd9c967f007db3fde7e6186f273234c81e7419906b787325c5e39ff0b6e6ae3e858e0625ad9f13de7ca8b3256638f
|
data/lib/spider-gazelle.rb
CHANGED
@@ -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],
|
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],
|
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(
|
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
|