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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4251c1e0cac2b15b884b54ee293a1822ee955347f3c488b558c0f82cf50ddfe
4
- data.tar.gz: 51a472149c1c0f04ad12edc90b0084760417e03b8d17889b27ee11ceb66ebc0d
3
+ metadata.gz: e40f32962fa3503f6269cee6997a1288ad7921b7d24462ff4258947778850f21
4
+ data.tar.gz: c1330120ddf74e8e644b051c9b7c30986f0b6a1428d2420c92d8d02649acb846
5
5
  SHA512:
6
- metadata.gz: f930317afad701fd29d5db2a720ce8d1ed7d9039116baa81c667f873ba709d252fe2c2286920258d522597279f9997c8fd284100640f966e14599f3d7b2df563
7
- data.tar.gz: c5ca8e7c0c5238c5a0d09d9fc17a8eb920b014598e42a5aace0780663e19d52a8c850eab28be1cf8fa2a2449521a425d0b3b33e5546e7d6db1a14ea9610721ac
6
+ metadata.gz: 28ffbea37fa7cfa64e6cd40c56b4f9584d016f5b305567beb939b400e610592a79b7481a9e08171df210e454d37efa18848b7236cc720ffa79a18a001b020f5f
7
+ data.tar.gz: 054af3f071444d16b77c138e79cf616eef5096081805950cca99d4c0d1ca5352763c50482011b1c11f725dab78293949e3ec5ea678cea0ea782aa8c198a9f34a
data/CHANGELOG.md CHANGED
@@ -1,9 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.9.0
4
+
5
+ - bugfix chunked response behavior.
6
+
3
7
  ## 0.8.0
4
8
 
5
- - add http head support.
6
- - improve timeout testing.
9
+ - add http `head` support.
10
+ - add http `501` not implemented status response.
7
11
 
8
12
  ## 0.7.0
9
13
 
@@ -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
- HEADER_EOP = "\r\n"
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
- #{HEADER_EOP}
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
- #{HEADER_EOP}
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
- #{HEADER_EOP}
195
+ #{HTTP_EOP}
186
196
  eos
187
197
 
188
198
  logger.error(err.message)
@@ -1,3 +1,3 @@
1
1
  module ForwardProxy
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
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.8.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-07-31 00:00:00.000000000 Z
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: