http-cookie 1.0.3 → 1.1.6

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.
@@ -1,6 +1,5 @@
1
1
  # :markup: markdown
2
- require 'http/cookie_jar'
3
- require 'sqlite3'
2
+ autoload :SQLite3, 'sqlite3'
4
3
 
5
4
  class HTTP::CookieJar
6
5
  # A store class that uses Mozilla compatible SQLite3 database as
@@ -10,7 +9,7 @@ class HTTP::CookieJar
10
9
  # stored persistently in the SQLite3 database.
11
10
  class MozillaStore < AbstractStore
12
11
  # :stopdoc:
13
- SCHEMA_VERSION = 5
12
+ SCHEMA_VERSION = 7
14
13
 
15
14
  def default_options
16
15
  {
@@ -22,14 +21,11 @@ class HTTP::CookieJar
22
21
 
23
22
  ALL_COLUMNS = %w[
24
23
  baseDomain
25
- appId inBrowserElement
24
+ originAttributes
26
25
  name value
27
26
  host path
28
27
  expiry creationTime lastAccessed
29
28
  isSecure isHttpOnly
30
- ]
31
- UK_COLUMNS = %w[
32
- name host path
33
29
  appId inBrowserElement
34
30
  ]
35
31
 
@@ -41,20 +37,15 @@ class HTTP::CookieJar
41
37
  }
42
38
  }
43
39
 
44
- class Database < SQLite3::Database
45
- def initialize(file, options = {})
40
+ class Database
41
+ def initialize(file)
42
+ @db = SQLite3::Database.new(file, results_as_hash: true)
46
43
  @stmts = []
47
- options = {
48
- :results_as_hash => true,
49
- }.update(options)
50
- super
51
44
  end
52
45
 
53
46
  def prepare(sql)
54
- case st = super
55
- when SQLite3::Statement
56
- @stmts << st
57
- end
47
+ st = @db.prepare(sql)
48
+ @stmts << st if st.is_a?(SQLite3::Statement)
58
49
  st
59
50
  end
60
51
 
@@ -63,7 +54,19 @@ class HTTP::CookieJar
63
54
  @stmts.reject! { |st|
64
55
  st.closed? || st.close
65
56
  }
66
- super
57
+ @db.close
58
+ end
59
+
60
+ def closed?
61
+ @db.closed?
62
+ end
63
+
64
+ def execute(*args, &block)
65
+ @db.execute(*args, &block)
66
+ end
67
+
68
+ def create_function(*args, &block)
69
+ @db.create_function(*args, &block)
67
70
  end
68
71
  end
69
72
  # :startdoc:
@@ -95,6 +98,11 @@ class HTTP::CookieJar
95
98
  def initialize(options = nil)
96
99
  super
97
100
 
101
+ @origin_attributes = encode_www_form({}.tap { |params|
102
+ params['appId'] = @app_id if @app_id.nonzero?
103
+ params['inBrowserElement'] = 1 if @in_browser_element
104
+ })
105
+
98
106
  @filename = options[:filename] or raise ArgumentError, ':filename option is missing'
99
107
 
100
108
  @sjar = HTTP::CookieJar::HashStore.new
@@ -134,7 +142,7 @@ class HTTP::CookieJar
134
142
 
135
143
  # Returns the schema version of the database.
136
144
  def schema_version
137
- @schema_version ||= @db.execute("PRAGMA user_version").first[0]
145
+ @schema_version ||= @db.execute("PRAGMA user_version").first["user_version"]
138
146
  rescue SQLite3::SQLException
139
147
  @logger.warn "couldn't get schema version!" if @logger
140
148
  return nil
@@ -147,8 +155,8 @@ class HTTP::CookieJar
147
155
  @schema_version = version
148
156
  end
149
157
 
150
- def create_table
151
- self.schema_version = SCHEMA_VERSION
158
+ def create_table_v5
159
+ self.schema_version = 5
152
160
  @db.execute("DROP TABLE IF EXISTS moz_cookies")
153
161
  @db.execute(<<-'SQL')
154
162
  CREATE TABLE moz_cookies (
@@ -176,6 +184,62 @@ class HTTP::CookieJar
176
184
  SQL
177
185
  end
178
186
 
187
+ def create_table_v6
188
+ self.schema_version = 6
189
+ @db.execute("DROP TABLE IF EXISTS moz_cookies")
190
+ @db.execute(<<-'SQL')
191
+ CREATE TABLE moz_cookies (
192
+ id INTEGER PRIMARY KEY,
193
+ baseDomain TEXT,
194
+ originAttributes TEXT NOT NULL DEFAULT '',
195
+ name TEXT,
196
+ value TEXT,
197
+ host TEXT,
198
+ path TEXT,
199
+ expiry INTEGER,
200
+ lastAccessed INTEGER,
201
+ creationTime INTEGER,
202
+ isSecure INTEGER,
203
+ isHttpOnly INTEGER,
204
+ CONSTRAINT moz_uniqueid UNIQUE (name, host, path, originAttributes)
205
+ )
206
+ SQL
207
+ @db.execute(<<-'SQL')
208
+ CREATE INDEX moz_basedomain
209
+ ON moz_cookies (baseDomain,
210
+ originAttributes);
211
+ SQL
212
+ end
213
+
214
+ def create_table
215
+ self.schema_version = SCHEMA_VERSION
216
+ @db.execute("DROP TABLE IF EXISTS moz_cookies")
217
+ @db.execute(<<-'SQL')
218
+ CREATE TABLE moz_cookies (
219
+ id INTEGER PRIMARY KEY,
220
+ baseDomain TEXT,
221
+ originAttributes TEXT NOT NULL DEFAULT '',
222
+ name TEXT,
223
+ value TEXT,
224
+ host TEXT,
225
+ path TEXT,
226
+ expiry INTEGER,
227
+ lastAccessed INTEGER,
228
+ creationTime INTEGER,
229
+ isSecure INTEGER,
230
+ isHttpOnly INTEGER,
231
+ appId INTEGER DEFAULT 0,
232
+ inBrowserElement INTEGER DEFAULT 0,
233
+ CONSTRAINT moz_uniqueid UNIQUE (name, host, path, originAttributes)
234
+ )
235
+ SQL
236
+ @db.execute(<<-'SQL')
237
+ CREATE INDEX moz_basedomain
238
+ ON moz_cookies (baseDomain,
239
+ originAttributes);
240
+ SQL
241
+ end
242
+
179
243
  def db_prepare(sql)
180
244
  st = @db.prepare(sql)
181
245
  yield st
@@ -226,7 +290,7 @@ class HTTP::CookieJar
226
290
  when 4
227
291
  @db.execute("ALTER TABLE moz_cookies RENAME TO moz_cookies_old")
228
292
  @db.execute("DROP INDEX moz_basedomain")
229
- create_table
293
+ create_table_v5
230
294
  @db.execute(<<-'SQL')
231
295
  INSERT INTO moz_cookies
232
296
  (baseDomain, appId, inBrowserElement, name, value, host, path, expiry,
@@ -236,7 +300,42 @@ class HTTP::CookieJar
236
300
  FROM moz_cookies_old
237
301
  SQL
238
302
  @db.execute("DROP TABLE moz_cookies_old")
303
+ when 5
304
+ @db.execute("ALTER TABLE moz_cookies RENAME TO moz_cookies_old")
305
+ @db.execute("DROP INDEX moz_basedomain")
306
+ create_table_v6
307
+ @db.create_function('CONVERT_TO_ORIGIN_ATTRIBUTES', 2) { |func, appId, inBrowserElement|
308
+ params = {}
309
+ params['appId'] = appId if appId.nonzero?
310
+ params['inBrowserElement'] = inBrowserElement if inBrowserElement.nonzero?
311
+ func.result = encode_www_form(params)
312
+ }
313
+ @db.execute(<<-'SQL')
314
+ INSERT INTO moz_cookies
315
+ (baseDomain, originAttributes, name, value, host, path, expiry,
316
+ lastAccessed, creationTime, isSecure, isHttpOnly)
317
+ SELECT baseDomain,
318
+ CONVERT_TO_ORIGIN_ATTRIBUTES(appId, inBrowserElement),
319
+ name, value, host, path, expiry, lastAccessed, creationTime,
320
+ isSecure, isHttpOnly
321
+ FROM moz_cookies_old
322
+ SQL
323
+ @db.execute("DROP TABLE moz_cookies_old")
324
+ when 6
325
+ @db.execute("ALTER TABLE moz_cookies ADD appId INTEGER DEFAULT 0")
326
+ @db.execute("ALTER TABLE moz_cookies ADD inBrowserElement INTEGER DEFAULT 0")
327
+ @db.create_function('SET_APP_ID', 1) { |func, originAttributes|
328
+ func.result = get_query_param(originAttributes, 'appId').to_i # nil.to_i == 0
329
+ }
330
+ @db.create_function('SET_IN_BROWSER', 1) { |func, originAttributes|
331
+ func.result = get_query_param(originAttributes, 'inBrowserElement').to_i # nil.to_i == 0
332
+ }
333
+ @db.execute(<<-'SQL')
334
+ UPDATE moz_cookies SET appId = SET_APP_ID(originAttributes),
335
+ inBrowserElement = SET_IN_BROWSER(originAttributes)
336
+ SQL
239
337
  @logger.info("Upgraded database to schema version %d" % schema_version) if @logger
338
+ self.schema_version += 1
240
339
  else
241
340
  break
242
341
  end
@@ -259,16 +358,17 @@ class HTTP::CookieJar
259
358
  def db_add(cookie)
260
359
  @stmt[:add].execute({
261
360
  :baseDomain => cookie.domain_name.domain || cookie.domain,
262
- :appId => @app_id,
263
- :inBrowserElement => @in_browser_element ? 1 : 0,
361
+ :originAttributes => @origin_attributes,
264
362
  :name => cookie.name, :value => cookie.value,
265
363
  :host => cookie.dot_domain,
266
364
  :path => cookie.path,
267
365
  :expiry => cookie.expires_at.to_i,
268
- :creationTime => cookie.created_at.to_i,
269
- :lastAccessed => cookie.accessed_at.to_i,
366
+ :creationTime => serialize_usectime(cookie.created_at),
367
+ :lastAccessed => serialize_usectime(cookie.accessed_at),
270
368
  :isSecure => cookie.secure? ? 1 : 0,
271
369
  :isHttpOnly => cookie.httponly? ? 1 : 0,
370
+ :appId => @app_id,
371
+ :inBrowserElement => @in_browser_element ? 1 : 0,
272
372
  })
273
373
  cleanup if (@gc_index += 1) >= @gc_threshold
274
374
 
@@ -295,6 +395,34 @@ class HTTP::CookieJar
295
395
  self
296
396
  end
297
397
 
398
+ if RUBY_VERSION >= '1.9'
399
+ def encode_www_form(enum)
400
+ URI.encode_www_form(enum)
401
+ end
402
+
403
+ def get_query_param(str, key)
404
+ URI.decode_www_form(str).find { |k, v|
405
+ break v if k == key
406
+ }
407
+ end
408
+ else
409
+ def encode_www_form(enum)
410
+ enum.map { |k, v| "#{CGI.escape(k)}=#{CGI.escape(v)}" }.join('&')
411
+ end
412
+
413
+ def get_query_param(str, key)
414
+ CGI.parse(str)[key].first
415
+ end
416
+ end
417
+
418
+ def serialize_usectime(time)
419
+ time ? (time.to_f * 1e6).floor : 0
420
+ end
421
+
422
+ def deserialize_usectime(value)
423
+ Time.at(value ? value / 1e6 : 0)
424
+ end
425
+
298
426
  public
299
427
 
300
428
  def add(cookie)
@@ -337,7 +465,6 @@ class HTTP::CookieJar
337
465
  now = Time.now
338
466
  if uri
339
467
  thost = DomainName.new(uri.host)
340
- tpath = uri.path
341
468
 
342
469
  @stmt[:cookies_for_domain].execute({
343
470
  :baseDomain => thost.domain || thost.hostname,
@@ -355,8 +482,8 @@ class HTTP::CookieJar
355
482
  attrs[:domain] = row['host']
356
483
  attrs[:path] = row['path']
357
484
  attrs[:expires_at] = Time.at(row['expiry'])
358
- attrs[:accessed_at] = Time.at(row['lastAccessed'] || 0)
359
- attrs[:created_at] = Time.at(row['creationTime'] || 0)
485
+ attrs[:accessed_at] = deserialize_usectime(row['lastAccessed'])
486
+ attrs[:created_at] = deserialize_usectime(row['creationTime'])
360
487
  attrs[:secure] = secure
361
488
  attrs[:httponly] = row['isHttpOnly'] != 0
362
489
  })
@@ -364,7 +491,7 @@ class HTTP::CookieJar
364
491
  if cookie.valid_for_uri?(uri)
365
492
  cookie.accessed_at = now
366
493
  @stmt[:update_lastaccessed].execute({
367
- 'lastAccessed' => now.to_i,
494
+ 'lastAccessed' => serialize_usectime(now),
368
495
  'id' => row['id'],
369
496
  })
370
497
  yield cookie
@@ -383,8 +510,8 @@ class HTTP::CookieJar
383
510
  attrs[:domain] = row['host']
384
511
  attrs[:path] = row['path']
385
512
  attrs[:expires_at] = Time.at(row['expiry'])
386
- attrs[:accessed_at] = Time.at(row['lastAccessed'] || 0)
387
- attrs[:created_at] = Time.at(row['creationTime'] || 0)
513
+ attrs[:accessed_at] = deserialize_usectime(row['lastAccessed'])
514
+ attrs[:created_at] = deserialize_usectime(row['creationTime'])
388
515
  attrs[:secure] = row['isSecure'] != 0
389
516
  attrs[:httponly] = row['isHttpOnly'] != 0
390
517
  })
@@ -1,7 +1,5 @@
1
1
  # :markup: markdown
2
- require 'http/cookie_jar'
3
- require 'psych' if !defined?(YAML) && RUBY_VERSION == "1.9.2"
4
- require 'yaml'
2
+ autoload :YAML, 'yaml'
5
3
 
6
4
  # YAMLSaver saves and loads cookies in the YAML format. It can load a
7
5
  # YAML file saved by Mechanize, but the saving format is not
@@ -21,7 +19,7 @@ class HTTP::CookieJar::YAMLSaver < HTTP::CookieJar::AbstractSaver
21
19
 
22
20
  def load(io, jar)
23
21
  begin
24
- data = YAML.load(io)
22
+ data = load_yaml(io)
25
23
  rescue ArgumentError => e
26
24
  case e.message
27
25
  when %r{\Aundefined class/module Mechanize::}
@@ -31,7 +29,7 @@ class HTTP::CookieJar::YAMLSaver < HTTP::CookieJar::AbstractSaver
31
29
  yaml = io.read
32
30
  # a gross hack
33
31
  yaml.gsub!(%r{^( [^ ].*:) !ruby/object:Mechanize::Cookie$}, "\\1")
34
- data = YAML.load(yaml)
32
+ data = load_yaml(yaml)
35
33
  rescue Errno::ESPIPE
36
34
  @logger.warn "could not rewind the stream for conversion" if @logger
37
35
  rescue ArgumentError
@@ -73,4 +71,10 @@ class HTTP::CookieJar::YAMLSaver < HTTP::CookieJar::AbstractSaver
73
71
  def default_options
74
72
  {}
75
73
  end
74
+
75
+ def load_yaml(yaml)
76
+ YAML.safe_load(yaml, :permitted_classes => %w[Time HTTP::Cookie Mechanize::Cookie DomainName], :aliases => true)
77
+ rescue NoMethodError # ruby < 2.0, no safe_load
78
+ YAML.load(yaml)
79
+ end
76
80
  end
@@ -1,31 +1,14 @@
1
1
  # :markup: markdown
2
- require 'http/cookie'
2
+
3
+ module HTTP
4
+ autoload :Cookie, "http/cookie"
5
+ end
3
6
 
4
7
  ##
5
8
  # This class is used to manage the Cookies that have been returned from
6
9
  # any particular website.
7
10
 
8
11
  class HTTP::CookieJar
9
- class << self
10
- def const_missing(name)
11
- case name.to_s
12
- when /\A([A-Za-z]+)Store\z/
13
- file = 'http/cookie_jar/%s_store' % $1.downcase
14
- when /\A([A-Za-z]+)Saver\z/
15
- file = 'http/cookie_jar/%s_saver' % $1.downcase
16
- end
17
- begin
18
- require file
19
- rescue LoadError
20
- raise NameError, 'can\'t resolve constant %s; failed to load %s' % [name, file]
21
- end
22
- if const_defined?(name)
23
- const_get(name)
24
- else
25
- raise NameError, 'can\'t resolve constant %s after loading %s' % [name, file]
26
- end
27
- end
28
- end
29
12
 
30
13
  attr_reader :store
31
14
 
@@ -156,7 +139,7 @@ class HTTP::CookieJar
156
139
  block_given? or return enum_for(__method__, uri)
157
140
 
158
141
  if uri
159
- uri = URI(uri)
142
+ uri = HTTP::Cookie::URIParser.parse(uri)
160
143
  return self unless URI::HTTP === uri && uri.host
161
144
  end
162
145
 
@@ -342,3 +325,6 @@ class HTTP::CookieJar
342
325
  self
343
326
  end
344
327
  end
328
+
329
+ require 'http/cookie_jar/abstract_store'
330
+ require 'http/cookie_jar/abstract_saver'
data/lib/http-cookie.rb CHANGED
@@ -1 +1,4 @@
1
- require 'http/cookie'
1
+ module HTTP
2
+ autoload :Cookie, 'http/cookie'
3
+ autoload :CookieJar, 'http/cookie_jar'
4
+ end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-cookie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
8
8
  - Aaron Patterson
9
9
  - Eric Hodel
10
10
  - Mike Dalessio
11
- autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2016-09-30 00:00:00.000000000 Z
13
+ date: 1980-01-02 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: domain_name
@@ -31,16 +30,16 @@ dependencies:
31
30
  name: sqlite3
32
31
  requirement: !ruby/object:Gem::Requirement
33
32
  requirements:
34
- - - "~>"
33
+ - - ">="
35
34
  - !ruby/object:Gem::Version
36
- version: 1.3.3
35
+ version: '1.3'
37
36
  type: :development
38
37
  prerelease: false
39
38
  version_requirements: !ruby/object:Gem::Requirement
40
39
  requirements:
41
- - - "~>"
40
+ - - ">="
42
41
  - !ruby/object:Gem::Version
43
- version: 1.3.3
42
+ version: '1.3'
44
43
  - !ruby/object:Gem::Dependency
45
44
  name: bundler
46
45
  requirement: !ruby/object:Gem::Requirement
@@ -124,21 +123,17 @@ email:
124
123
  executables: []
125
124
  extensions: []
126
125
  extra_rdoc_files:
127
- - README.md
128
126
  - LICENSE.txt
127
+ - README.md
129
128
  files:
130
- - ".gitignore"
131
- - ".travis.yml"
132
129
  - CHANGELOG.md
133
- - Gemfile
134
130
  - LICENSE.txt
135
131
  - README.md
136
- - Rakefile
137
- - http-cookie.gemspec
138
132
  - lib/http-cookie.rb
139
133
  - lib/http/cookie.rb
140
134
  - lib/http/cookie/ruby_compat.rb
141
135
  - lib/http/cookie/scanner.rb
136
+ - lib/http/cookie/uri_parser.rb
142
137
  - lib/http/cookie/version.rb
143
138
  - lib/http/cookie_jar.rb
144
139
  - lib/http/cookie_jar/abstract_saver.rb
@@ -147,16 +142,10 @@ files:
147
142
  - lib/http/cookie_jar/hash_store.rb
148
143
  - lib/http/cookie_jar/mozilla_store.rb
149
144
  - lib/http/cookie_jar/yaml_saver.rb
150
- - test/helper.rb
151
- - test/mechanize.yml
152
- - test/simplecov_start.rb
153
- - test/test_http_cookie.rb
154
- - test/test_http_cookie_jar.rb
155
145
  homepage: https://github.com/sparklemotion/http-cookie
156
146
  licenses:
157
147
  - MIT
158
148
  metadata: {}
159
- post_install_message:
160
149
  rdoc_options: []
161
150
  require_paths:
162
151
  - lib
@@ -171,14 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
160
  - !ruby/object:Gem::Version
172
161
  version: '0'
173
162
  requirements: []
174
- rubyforge_project:
175
- rubygems_version: 2.6.6
176
- signing_key:
163
+ rubygems_version: 4.0.6
177
164
  specification_version: 4
178
165
  summary: A Ruby library to handle HTTP Cookies based on RFC 6265
179
- test_files:
180
- - test/helper.rb
181
- - test/mechanize.yml
182
- - test/simplecov_start.rb
183
- - test/test_http_cookie.rb
184
- - test/test_http_cookie_jar.rb
166
+ test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 1.8.7
6
- - ree
7
- - 1.9.3
8
- - 2.0.0
9
- - 2.1
10
- - 2.2
11
- - 2.3.0
12
- - ruby-head
13
- - jruby-1.7
14
- - jruby-9
15
- - rbx-2
16
- matrix:
17
- allow_failures:
18
- - rvm: ruby-head
19
- - rvm: rbx-2
20
- before_install:
21
- - gem update bundler
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in http-cookie.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,20 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
3
-
4
- Rake::TestTask.new(:test) do |test|
5
- test.ruby_opts << '-r./test/simplecov_start.rb' if RUBY_VERSION >= '1.9'
6
- test.pattern = 'test/**/test_*.rb'
7
- test.verbose = true
8
- end
9
-
10
- task :default => :test
11
-
12
- require 'rdoc/task'
13
- Rake::RDocTask.new do |rdoc|
14
- version = HTTP::Cookie::VERSION
15
-
16
- rdoc.rdoc_dir = 'rdoc'
17
- rdoc.title = "http-cookie #{version}"
18
- rdoc.rdoc_files.include('lib/**/*.rb')
19
- rdoc.rdoc_files.include(Bundler::GemHelper.gemspec.extra_rdoc_files)
20
- end
data/http-cookie.gemspec DELETED
@@ -1,34 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'http/cookie/version'
5
-
6
- Gem::Specification.new do |gem|
7
- gem.name = "http-cookie"
8
- gem.version = HTTP::Cookie::VERSION
9
- gem.authors, gem.email = {
10
- 'Akinori MUSHA' => 'knu@idaemons.org',
11
- 'Aaron Patterson' => 'aaronp@rubyforge.org',
12
- 'Eric Hodel' => 'drbrain@segment7.net',
13
- 'Mike Dalessio' => 'mike.dalessio@gmail.com',
14
- }.instance_eval { [keys, values] }
15
-
16
- gem.description = %q{HTTP::Cookie is a Ruby library to handle HTTP Cookies based on RFC 6265. It has with security, standards compliance and compatibility in mind, to behave just the same as today's major web browsers. It has builtin support for the legacy cookies.txt and the latest cookies.sqlite formats of Mozilla Firefox, and its modular API makes it easy to add support for a new backend store.}
17
- gem.summary = %q{A Ruby library to handle HTTP Cookies based on RFC 6265}
18
- gem.homepage = "https://github.com/sparklemotion/http-cookie"
19
- gem.license = "MIT"
20
-
21
- gem.files = `git ls-files`.split($/)
22
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
23
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
24
- gem.require_paths = ["lib"]
25
- gem.extra_rdoc_files = ['README.md', 'LICENSE.txt']
26
-
27
- gem.add_runtime_dependency("domain_name", ["~> 0.5"])
28
- gem.add_development_dependency("sqlite3", ["~> 1.3.3"]) unless defined?(JRUBY_VERSION)
29
- gem.add_development_dependency("bundler", [">= 1.2.0"])
30
- gem.add_development_dependency("test-unit", [">= 2.4.3", *("< 3" if RUBY_VERSION < "1.9")])
31
- gem.add_development_dependency("rake", [">= 0.9.2.2", *("< 11" if RUBY_VERSION < "1.9")])
32
- gem.add_development_dependency("rdoc", ["> 2.4.2"])
33
- gem.add_development_dependency("simplecov", [">= 0"])
34
- end
data/test/helper.rb DELETED
@@ -1,55 +0,0 @@
1
- require 'rubygems'
2
- require 'test-unit'
3
- require 'uri'
4
- require 'http/cookie'
5
-
6
- module Test
7
- module Unit
8
- module Assertions
9
- def assert_warn(pattern, message = nil, &block)
10
- class << (output = "")
11
- alias write <<
12
- end
13
- stderr, $stderr = $stderr, output
14
- yield
15
- assert_match(pattern, output, message)
16
- ensure
17
- $stderr = stderr
18
- end
19
-
20
- def assert_warning(pattern, message = nil, &block)
21
- verbose, $VERBOSE = $VERBOSE, true
22
- assert_warn(pattern, message, &block)
23
- ensure
24
- $VERBOSE = verbose
25
- end
26
- end
27
- end
28
- end
29
-
30
- module Enumerable
31
- def combine
32
- masks = inject([[], 1]){|(ar, m), e| [ar << m, m << 1 ] }[0]
33
- all = masks.inject(0){ |al, m| al|m }
34
-
35
- result = []
36
- for i in 1..all do
37
- tmp = []
38
- each_with_index do |e, idx|
39
- tmp << e unless (masks[idx] & i) == 0
40
- end
41
- result << tmp
42
- end
43
- result
44
- end
45
- end
46
-
47
- def test_file(filename)
48
- File.expand_path(filename, File.dirname(__FILE__))
49
- end
50
-
51
- def sleep_until(time)
52
- if (s = time - Time.now) > 0
53
- sleep s
54
- end
55
- end