adsf 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/NEWS.md +8 -2
- data/README.md +10 -0
- data/bin/adsf +1 -1
- data/lib/adsf/rack.rb +1 -0
- data/lib/adsf/rack/cors.rb +19 -0
- data/lib/adsf/rack/index_file_finder.rb +1 -1
- data/lib/adsf/server.rb +1 -0
- data/lib/adsf/version.rb +1 -1
- metadata +3 -3
- data/ChangeLog +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d209e17b4b260c9bc77e4c435a94d51b8b6cf4e0ce7b38a4f77d90bc8bf27fc3
|
4
|
+
data.tar.gz: 472632fb8c5f1e29e1fe773b30cc2c6a341c35725e7942546bdaefe7b3326223
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cefc44acb68c0f56faaa5495f824b266e2d4267dce825afa950ec61a9b5c2c92c2e4a27dd526cb8e00b0085979e695f61d853bf04c64a41a7ed516657bc7904c
|
7
|
+
data.tar.gz: 154c0da23d3c09430e5813a1c613ad6bcdb0530057aa98d0e6b785ce8a59505a1832d63dacd98f1fe9a16a0979f27e95819fc3106546bbcded63c57bec18a6e5
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
adsf (1.3.
|
4
|
+
adsf (1.3.1)
|
5
5
|
rack (>= 1.0.0, < 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
ast (~> 2.3)
|
25
25
|
powerpack (0.1.1)
|
26
26
|
rack (2.0.3)
|
27
|
-
rack-test (0.
|
27
|
+
rack-test (0.8.2)
|
28
28
|
rack (>= 1.0, < 3)
|
29
29
|
rainbow (2.2.2)
|
30
30
|
rake
|
data/NEWS.md
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
# adsf News
|
2
2
|
|
3
|
+
## 1.3.1 (2017-11-25)
|
4
|
+
|
5
|
+
Enhancements:
|
6
|
+
|
7
|
+
* Added headers for CORS (#9, #12)
|
8
|
+
|
3
9
|
## 1.3.0 (2017-11-19)
|
4
10
|
|
5
11
|
Features:
|
6
12
|
|
7
13
|
* Added `Adsf::Server`
|
8
14
|
|
9
|
-
## 1.2.1
|
15
|
+
## 1.2.1 (2016-03-14)
|
10
16
|
|
11
17
|
* Fixed compatibility with Ruby 2.3.0 (#3) [Vipul Amler]
|
12
18
|
|
13
|
-
## 1.2.0
|
19
|
+
## 1.2.0 (2013-11-29)
|
14
20
|
|
15
21
|
* Added `--local-only` and `--listen-address` options (#1) [Ed Brannin]
|
16
22
|
|
data/README.md
CHANGED
@@ -50,6 +50,16 @@ It takes the following options:
|
|
50
50
|
run Rack::File.new('public')
|
51
51
|
```
|
52
52
|
|
53
|
+
**Why not use `Rack::Static`?** Rack comes with `Rack::Static`, whose purpose is similar to, but not the same as, `Adsf::Rack::IndexFileFinder`. In particular:
|
54
|
+
|
55
|
+
* `Adsf::Rack::IndexFileFinder` does not serve files, unlike `Rack::Static`. `IndexFileFinder` only rewrites the incoming request and passes it on (usually to `Rack::File`).
|
56
|
+
|
57
|
+
* `Adsf::Rack::IndexFileFinder` supports multiple index files, while `Rack::Static` only supports one (you could have multiple `Rack::Static` middlewares, one for each index filenames, though).
|
58
|
+
|
59
|
+
* `Rack::Static` will report the wrong filename on 404 pages: when requesting a directory without an index file, it will e.g. report “File not found: /index.html” rather than “File not found: /”.
|
60
|
+
|
61
|
+
* When requesting a directory without specifying the trailing slash, `Adsf::Rack::IndexFileFinder` will redirect to the URL with a trailing slash, unlike `Rack::Static`. This mimics the behavior of typical HTTP servers. For example, when requesting `/foo`, when a `foo` directory exists and it contains `index.html`, `IndexFileFinder` will redirect to `/foo/`.
|
62
|
+
|
53
63
|
### Server
|
54
64
|
|
55
65
|
`Adsf::Server` runs a web server programmatically. For example:
|
data/bin/adsf
CHANGED
data/lib/adsf/rack.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Adsf::Rack
|
2
|
+
class CORS
|
3
|
+
def initialize(app)
|
4
|
+
@app = app
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(env)
|
8
|
+
status, headers, body = *@app.call(env)
|
9
|
+
|
10
|
+
new_headers =
|
11
|
+
headers.merge(
|
12
|
+
'Access-Control-Allow-Origin' => '*',
|
13
|
+
'Access-Control-Allow-Headers' => 'Origin, X-Requested-With, Content-Type, Accept, Range',
|
14
|
+
)
|
15
|
+
|
16
|
+
[status, new_headers, body]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/adsf/server.rb
CHANGED
data/lib/adsf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adsf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -37,7 +37,6 @@ executables:
|
|
37
37
|
extensions: []
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
|
-
- ChangeLog
|
41
40
|
- Gemfile
|
42
41
|
- Gemfile.lock
|
43
42
|
- LICENSE
|
@@ -47,6 +46,7 @@ files:
|
|
47
46
|
- bin/adsf
|
48
47
|
- lib/adsf.rb
|
49
48
|
- lib/adsf/rack.rb
|
49
|
+
- lib/adsf/rack/cors.rb
|
50
50
|
- lib/adsf/rack/index_file_finder.rb
|
51
51
|
- lib/adsf/server.rb
|
52
52
|
- lib/adsf/version.rb
|
data/ChangeLog
DELETED