forward-proxy 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/lib/forward_proxy/server.rb +14 -4
- data/lib/forward_proxy/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: e40f32962fa3503f6269cee6997a1288ad7921b7d24462ff4258947778850f21
|
4
|
+
data.tar.gz: c1330120ddf74e8e644b051c9b7c30986f0b6a1428d2420c92d8d02649acb846
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28ffbea37fa7cfa64e6cd40c56b4f9584d016f5b305567beb939b400e610592a79b7481a9e08171df210e454d37efa18848b7236cc720ffa79a18a001b020f5f
|
7
|
+
data.tar.gz: 054af3f071444d16b77c138e79cf616eef5096081805950cca99d4c0d1ca5352763c50482011b1c11f725dab78293949e3ec5ea678cea0ea782aa8c198a9f34a
|
data/CHANGELOG.md
CHANGED
data/lib/forward_proxy/server.rb
CHANGED
@@ -78,7 +78,7 @@ module ForwardProxy
|
|
78
78
|
|
79
79
|
# HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
|
80
80
|
# protocol elements except the entity-body.
|
81
|
-
|
81
|
+
HTTP_EOP = "\r\n"
|
82
82
|
|
83
83
|
# The following comments are from the IETF document
|
84
84
|
# "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content"
|
@@ -114,7 +114,7 @@ module ForwardProxy
|
|
114
114
|
# the request-target.
|
115
115
|
client_conn.write <<~eos.chomp
|
116
116
|
HTTP/1.1 200 OK
|
117
|
-
#{
|
117
|
+
#{HTTP_EOP}
|
118
118
|
eos
|
119
119
|
|
120
120
|
# The CONNECT method requests that the recipient establish a tunnel to
|
@@ -155,7 +155,7 @@ module ForwardProxy
|
|
155
155
|
client_conn.puts <<~eos.chomp
|
156
156
|
HTTP/1.1 #{resp.code}
|
157
157
|
#{headers.map { |header, value| "#{header}: #{value}" }.join("\n")}
|
158
|
-
#{
|
158
|
+
#{HTTP_EOP}
|
159
159
|
eos
|
160
160
|
|
161
161
|
# The following comments are taken from:
|
@@ -166,6 +166,16 @@ module ForwardProxy
|
|
166
166
|
# instead stream the body directly to an IO.
|
167
167
|
resp.read_body do |chunk|
|
168
168
|
client_conn << chunk
|
169
|
+
# The following comments are taken from:
|
170
|
+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding#directives
|
171
|
+
|
172
|
+
# Data is sent in a series of chunks. The Content-Length header is omitted in this case and
|
173
|
+
# at the beginning of each chunk you need to add the length of the current chunk in
|
174
|
+
# hexadecimal format, followed by '\r\n' and then the chunk itself, followed by another
|
175
|
+
# '\r\n'. The terminating chunk is a regular chunk, with the exception that its length
|
176
|
+
# is zero. It is followed by the trailer, which consists of a (possibly empty) sequence of
|
177
|
+
# header fields.
|
178
|
+
client_conn << HTTP_EOP if resp['Transfer-Encoding'] == 'chunked'
|
169
179
|
end
|
170
180
|
end
|
171
181
|
end
|
@@ -182,7 +192,7 @@ module ForwardProxy
|
|
182
192
|
client_conn.puts <<~eos.chomp
|
183
193
|
HTTP/1.1 #{status_code}
|
184
194
|
Via: #{HEADER_VIA}
|
185
|
-
#{
|
195
|
+
#{HTTP_EOP}
|
186
196
|
eos
|
187
197
|
|
188
198
|
logger.error(err.message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forward-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Moriarty
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Forward proxy using just Ruby standard libraries.
|
14
14
|
email:
|