async-http 0.24.1 → 0.24.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/async/http/content_encoding.rb +2 -4
- data/lib/async/http/middleware.rb +14 -2
- data/lib/async/http/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 544832b67f4090c760bfbc3e583d9f63d0300f1add25197c76fd374277e2490f
|
4
|
+
data.tar.gz: a7d9db41872b45d47575d864416e3be669f0b2cac6555574b3f94d9d322313c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ff96006418add5ca4f1c79f806134795f7387ead61b88e2f3534a66a1fc2584cd8667af5389baf427536060780e39464b6987224a4169a292d2abf0f9905ffa
|
7
|
+
data.tar.gz: 7b658324c3c6ee42a3c849e2953c6157686abef1b6efe8a7cd439c840a33bb7da04e9f28897a8459726d8a57eca158ce07d6d6e0b2d93b270fa885c7df16cbf5
|
data/README.md
CHANGED
@@ -37,12 +37,13 @@ require 'async/http/server'
|
|
37
37
|
require 'async/http/client'
|
38
38
|
require 'async/reactor'
|
39
39
|
require 'async/http/url_endpoint'
|
40
|
+
require 'async/http/response'
|
40
41
|
|
41
42
|
endpoint = Async::HTTP::URLEndpoint.parse('http://127.0.0.1:9294', reuse_port: true)
|
42
43
|
|
43
44
|
class Server < Async::HTTP::Server
|
44
45
|
def handle_request(request, peer, address)
|
45
|
-
[200, {}, ["Hello World"]]
|
46
|
+
Async::HTTP::Response[200, {}, ["Hello World"]]
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
@@ -43,14 +43,12 @@ module Async
|
|
43
43
|
def call(request, *)
|
44
44
|
response = super
|
45
45
|
|
46
|
+
# TODO use http-accept and sort by priority
|
46
47
|
if !response.body.empty? and accept_encoding = request.headers['accept-encoding']
|
47
48
|
if content_type = response.headers['content-type'] and @content_types.match?(content_type)
|
48
|
-
# TODO use http-accept and sort by priority
|
49
|
-
encodings = accept_encoding.split(/\s*,\s*/)
|
50
|
-
|
51
49
|
body = response.body
|
52
50
|
|
53
|
-
|
51
|
+
accept_encoding.each do |name|
|
54
52
|
if wrapper = @wrappers[name]
|
55
53
|
response.headers['content-encoding'] = name
|
56
54
|
|
@@ -46,8 +46,20 @@ module Async
|
|
46
46
|
end
|
47
47
|
|
48
48
|
module Okay
|
49
|
-
def self.
|
50
|
-
|
49
|
+
def self.close
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.call(request, *)
|
53
|
+
Response[200, {}, []]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
module HelloWorld
|
58
|
+
def self.close
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.call(request, *)
|
62
|
+
Response[200, {'content-type' => 'text/plain'}, ["Hello World!"]]
|
51
63
|
end
|
52
64
|
end
|
53
65
|
end
|
data/lib/async/http/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.24.
|
4
|
+
version: 0.24.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|