nethttputils 0.3.2.7 → 0.3.2.8

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
  SHA1:
3
- metadata.gz: 5ef478ad663a8500e057309f2fcb9bb3587a2525
4
- data.tar.gz: 82ccf697e5a37a3d7a46a216ece1e1d5a0498e8f
3
+ metadata.gz: 4bb3ff44508a83e6598792376792f736f878a525
4
+ data.tar.gz: 1d7a3335ef9071633325ea342ef627994d0b493d
5
5
  SHA512:
6
- metadata.gz: 0eddfd6fee3905ebd37c9863f0ce420befdb5ee19b4ec2414a05b5be808606032abd3e4bff0ce701a4b8fcb5584e9bbf2b3af8e9e660198bcf668bf296dab860
7
- data.tar.gz: 1efd44dfd6afb4b1bbe3657f51a5dde2535715c4576b5126e48e827836848d2b263f7264094a5307da61031d860c80c04060779b2d16351690659d88cc83f84a
6
+ metadata.gz: 02dd3b560d3d99c9f653dc09a284fb944443bb934afe4d8da36ba8f7b70b34f9cd5e7662c9c55d04a0651417409663813020d237a498b10fb513e8ca4808fb72
7
+ data.tar.gz: ec2b35988efa0e1c44979662827a7f6d5db10a77d6a10307c26f64089f833b42f28ca41fe78ceea34f6b6d10e4c75eedfddb1ec44de93e45422dea78335c9bd6
@@ -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=]+)\z/.match c.split(/\s*;\s*/).first
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "nethttputils"
3
- spec.version = "0.3.2.7"
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 --
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nethttputils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2.7
4
+ version: 0.3.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov aka Nakilon