nethttputils 0.3.2.7 → 0.3.2.8
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/lib/nethttputils.rb +6 -2
- data/nethttputils.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bb3ff44508a83e6598792376792f736f878a525
|
4
|
+
data.tar.gz: 1d7a3335ef9071633325ea342ef627994d0b493d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02dd3b560d3d99c9f653dc09a284fb944443bb934afe4d8da36ba8f7b70b34f9cd5e7662c9c55d04a0651417409663813020d237a498b10fb513e8ca4808fb72
|
7
|
+
data.tar.gz: ec2b35988efa0e1c44979662827a7f6d5db10a77d6a10307c26f64089f833b42f28ca41fe78ceea34f6b6d10e4c75eedfddb1ec44de93e45422dea78335c9bd6
|
data/lib/nethttputils.rb
CHANGED
@@ -204,7 +204,7 @@ module NetHTTPUtils
|
|
204
204
|
# TODO: use WEBrick::Cookie
|
205
205
|
old_cookies = cookies.dup
|
206
206
|
response.to_hash.fetch("set-cookie", []).each do |c|
|
207
|
-
fail "bad cookie? #{c.inspect}" unless /\A([^\s=]+)=([^\s=]
|
207
|
+
fail "bad cookie? #{c.inspect}" unless /\A([^\s=]+)=([^\s=]*)\z/.match c.split(/\s*;\s*/).first
|
208
208
|
logger.debug "set-cookie: #{$1}=#{$2}"
|
209
209
|
old_cookies.delete $1
|
210
210
|
cookies.store $1, $2
|
@@ -213,6 +213,7 @@ module NetHTTPUtils
|
|
213
213
|
logger.debug "faking an old cookie into new response: #{k}=#{v}"
|
214
214
|
response.add_field "Set-Cookie", "#{k}=#{v}"
|
215
215
|
end
|
216
|
+
|
216
217
|
case response.code
|
217
218
|
when /\A30\d\z/
|
218
219
|
logger.info "redirect: #{response["location"]}"
|
@@ -353,16 +354,19 @@ if $0 == __FILE__
|
|
353
354
|
next unless "GET" == req.request_method
|
354
355
|
res.cookies.push WEBrick::Cookie.new("1", "2")
|
355
356
|
res.cookies.push WEBrick::Cookie.new("3", "4")
|
357
|
+
res.cookies.push WEBrick::Cookie.new("8", "9")
|
358
|
+
res.cookies.push WEBrick::Cookie.new("a", "b")
|
356
359
|
res.cookies.push WEBrick::Cookie.new("1", "5")
|
357
360
|
res.status = 300
|
358
361
|
res["location"] = "/2"
|
359
362
|
end
|
360
363
|
server.mount_proc "/2" do |req, res|
|
361
364
|
res.cookies.push WEBrick::Cookie.new("3", "6")
|
365
|
+
res.cookies.push WEBrick::Cookie.new("8", "")
|
362
366
|
res.cookies.push WEBrick::Cookie.new("4", "7")
|
363
367
|
end
|
364
368
|
t = Thread.new{ server.start }
|
365
|
-
fail unless %w{ 3=6 4=7 1=5 } == p(NetHTTPUtils.request_data("http://localhost:8000/1").
|
369
|
+
fail unless %w{ 3=6 8= 4=7 1=5 a=b } == p(NetHTTPUtils.request_data("http://localhost:8000/1").
|
366
370
|
instance_variable_get(:@last_response).to_hash.fetch("set-cookie"))
|
367
371
|
server.shutdown
|
368
372
|
t.join
|
data/nethttputils.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "nethttputils"
|
3
|
-
spec.version = "0.3.2.
|
3
|
+
spec.version = "0.3.2.8"
|
4
4
|
spec.summary = "this tool is like a pet that I adopted young and now I depend on, sorry"
|
5
5
|
spec.description = <<-EOF
|
6
6
|
Back in 2015 I was a guy automating things at my job and two scripts had a common need --
|