rack-proxy 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +15 -0
- data/lib/net_http_hacked.rb +1 -1
- data/lib/rack/proxy.rb +4 -1
- data/test/rack_proxy_test.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d347e8178e678199e2c0909de87bbdbaca03f35e
|
4
|
+
data.tar.gz: f410d801a63f97afd6076e6ea76ab0befeb0d1b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a810cef5273abe06ac5291ef502d4b473692c4334768b6620a2cde6ed3ff45247b25867fa187b1827257d5081a240de3ae5b755249fe6ec4f565c65387c92242
|
7
|
+
data.tar.gz: 570c6d53c3435b775d81ec49fc37b7c9b7045fae128936283fe21838fad04dd7a8320287df8840b3bf7fd2be22402143a5c2e3cf347185b93c0703f96bcb877f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
A request/response rewriting HTTP proxy. A Rack app. Subclass `Rack::Proxy` and provide your `rewrite_env` and `rewrite_response` methods.
|
2
2
|
|
3
|
+
Installation
|
4
|
+
-------
|
5
|
+
|
6
|
+
Add the following to your Gemfile:
|
7
|
+
|
8
|
+
```
|
9
|
+
gem 'rack-proxy', '~> 0.6.2'
|
10
|
+
```
|
11
|
+
|
12
|
+
Or install:
|
13
|
+
|
14
|
+
```
|
15
|
+
gem install rack-proxy
|
16
|
+
```
|
17
|
+
|
3
18
|
Example
|
4
19
|
-------
|
5
20
|
|
data/lib/net_http_hacked.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# We are hacking net/http to change semantics of streaming handling
|
2
|
-
# from "block" semantics to regular "return"
|
2
|
+
# from "block" semantics to regular "return" semantics.
|
3
3
|
# We need it to construct a streamable rack triplet:
|
4
4
|
#
|
5
5
|
# [status, headers, streamable_body]
|
data/lib/rack/proxy.rb
CHANGED
@@ -5,7 +5,7 @@ module Rack
|
|
5
5
|
|
6
6
|
# Subclass and bring your own #rewrite_request and #rewrite_response
|
7
7
|
class Proxy
|
8
|
-
VERSION = "0.6.
|
8
|
+
VERSION = "0.6.2"
|
9
9
|
|
10
10
|
class << self
|
11
11
|
def extract_http_request_headers(env)
|
@@ -121,6 +121,9 @@ module Rack
|
|
121
121
|
body = target_response.body || [""]
|
122
122
|
body = [body] unless body.respond_to?(:each)
|
123
123
|
|
124
|
+
# According to https://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-14#section-7.1.3.1Acc
|
125
|
+
# should remove hop-by-hop header fields
|
126
|
+
headers.reject! { |k| ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailer', 'transfer-encoding', 'upgrade'].include? k.downcase }
|
124
127
|
[target_response.code, headers, body]
|
125
128
|
end
|
126
129
|
|
data/test/rack_proxy_test.rb
CHANGED
@@ -115,4 +115,10 @@ class RackProxyTest < Test::Unit::TestCase
|
|
115
115
|
post "/", nil, "CONTENT_LENGTH" => nil
|
116
116
|
end
|
117
117
|
end
|
118
|
+
|
119
|
+
def test_response_header_included_Hop_by_hop
|
120
|
+
app({:streaming => true}).host = 'auth.goeasyship.com'
|
121
|
+
get 'https://example.com/oauth2/token/info?access_token=123'
|
122
|
+
assert !last_response.headers.key?('transfer-encoding')
|
123
|
+
end
|
118
124
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacek Becela
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|