Commit graph

60 commits

Author SHA1 Message Date
Mike Dalessio
69b240bc01
fix: explicitly require CGI
Closes #49
2024-06-06 11:11:17 -04:00
André Laszlo
44374a7517 Fix an error formatting bug 2023-02-13 18:24:47 +01:00
Akinori MUSHA
060eb44497 Avoid use of numeric indexing on SQLite3::ResultSet::HashWithTypesAndFields 2022-05-25 15:37:48 +09:00
Akinori MUSHA
2c220f44dd Allow aliases because YAML.dump generates aliases when it sees multiple occurrences of an object 2021-06-07 14:45:58 +09:00
Akinori MUSHA
7a1bf4fbb3 Use safe_load when using Psych >=3.1 2021-06-07 13:41:45 +09:00
Akinori MUSHA
9eb68dcce5 Merge pull request #14 from wrzasa/master
More informative error message when cannot load a store (rebased on current master)
2016-12-09 21:52:51 +09:00
Akinori MUSHA
24b5d407d9 Merge pull request #10 from marxarelli/fix/host-only-cookie-domain-comparison
Fix host-only cookies for unqualified hostnames
2016-12-09 21:48:59 +09:00
Akinori MUSHA
80e855fdf2 Merge branch 'fix_time_representation' 2016-12-09 21:43:47 +09:00
Akinori MUSHA
56e0fd5175 Add 1.8 compatibility 2016-12-09 21:38:35 +09:00
Akinori MUSHA
9f5a0d65da MozillaStore: creationTime and lastAccessed are in usec, not seconds
This was pointed out by #8.  I decided not to add extra code for
backwards compatibility of their values.
2016-12-09 21:12:32 +09:00
Akinori MUSHA
5d7fbde318 Avoid warnings 2016-12-08 23:49:44 +09:00
Akinori MUSHA
40d988ab92 Set the originAttributes column when inserting a record 2016-12-08 23:42:40 +09:00
Akinori MUSHA
67630ac6be Support Mozilla's cookie storage format up to version 7 2016-11-25 01:52:52 +09:00
wrzasa
f828cf0319 More informative error message when cannot load a store
I tried to use `mozilla` store, but got the following message, that gave me no clue what's wrong:

          ArgumentError: cookie store unavailable: :mozilla

After some debugging I found that I have no `sqlite3` gem installed. But the error message should tell mi that. 

This change should help.
2016-03-18 17:24:56 +01:00
Dan Duvall
69154b11dd Fix host-only cookies for unqualified hostnames
Removed comparison against `DomainName#cookie_domain?` during filtering
of jar cookies. It was redundant considering the later call to
`HTTP::Cookie#valid_for_url?` and prevented valid host-only cookies from
being considered for unqualified hostnames (e.g. "localhost").

RFC 6265 (5.4) does not restrict host-only cookies from being used with
such unqualified names as it does for cookies with the domain attribute
set.
2015-09-02 12:57:11 -07:00
Akinori MUSHA
0d5e666642 Improve rdoc. 2013-04-16 22:37:19 +09:00
Akinori MUSHA
bf9bbe3da8 Move Array#sort_by! to http/cookie/ruby_compat. 2013-04-16 22:15:29 +09:00
Akinori MUSHA
a3ab578671 Fix *Store#empty?. 2013-04-16 15:05:00 +09:00
Akinori MUSHA
5bdb8f41ae Cookie#new prefers downcased symbols for keywords.
Test warnings.
2013-04-16 08:44:48 +09:00
Akinori MUSHA
8ae076d9ea Fix the compatibility code to support Syck. 2013-04-16 01:39:09 +09:00
Akinori MUSHA
b02e800dfa Comment out unused/advisory bits to gain coverage. 2013-04-16 00:54:56 +09:00
Akinori MUSHA
10ddb688df Inhibit cloning MozillaStore. 2013-04-16 00:38:47 +09:00
Akinori MUSHA
d806955f57 Fix hand-made autoloading to allow directly referencing MozillaStore. 2013-04-16 00:37:10 +09:00
Akinori MUSHA
ded02f8327 Make MozillaStore#close actually "work" by closing open statements.
Add a finalizer to MozillaStore also, which automatically closes the
SQLite3 database.
2013-04-16 00:04:54 +09:00
Akinori MUSHA
e9230a00c1 Add tests for MozillaStore#upgrade_database and fix its bugs. 2013-04-16 00:03:03 +09:00
Akinori MUSHA
25dd32219f MozillaStore#close: Do not call SQLite3::Database#close if already closed. 2013-04-15 23:57:35 +09:00
Akinori MUSHA
6ec66d11ed Restore and improve compatibility with ruby 1.8. 2013-04-14 13:01:37 +09:00
Akinori MUSHA
a485e83ad9 Simply use cookie.domain instead of cookie.domain_name.hostname. 2013-04-12 01:19:49 +09:00
Akinori MUSHA
787a0edbb9 Make use of Hash#fetch. 2013-04-11 21:18:25 +09:00
Akinori MUSHA
6689b3b7aa Drop support for obsolete attributes: version and comment. 2013-04-07 23:09:30 +09:00
Akinori MUSHA
26034253b1 Elaborate on the hash storage model. 2013-03-28 19:13:02 +09:00
Akinori MUSHA
4f526857aa Store special cookies properly.
"Special" cookies here mean those of public suffixes and IP addresses.
2013-03-28 19:10:14 +09:00
Akinori MUSHA
91b5184d96 Hold session cookies in an internal HashStore. 2013-03-28 19:10:14 +09:00
Akinori MUSHA
add4a367fd Include MonitorMixin in store classes and make them thread-safe. 2013-03-28 01:05:22 +09:00
Akinori MUSHA
30e2915c1e Officially add AbstractStore#delete() as an API method. 2013-03-28 01:04:45 +09:00
Akinori MUSHA
e72b0fdbc5 YAMLServer#load: Add backward compatibility for reading YAML in the old format. 2013-03-28 00:13:32 +09:00
Akinori MUSHA
eed7e57813 Use the cookie creation time as base time for Max-Age.
Now #expire returns created_at + max_age when expires is nil.

Cookie.parse: the :date keyword is renamed to :created_at, and the
value is set to in parsed cookies via #created_at.

In YAML serialization, #max_age is stored.
2013-03-27 19:50:30 +09:00
Akinori MUSHA
4512c333b4 MozillaStore: Add #filename, #close and #closed?. 2013-03-27 19:50:27 +09:00
Akinori MUSHA
a7575ae3df Improve documentation. 2013-03-27 18:17:56 +09:00
Akinori MUSHA
6fade20c59 Make GC threshold user specifiable. 2013-03-27 16:10:05 +09:00
Akinori MUSHA
69b3186666 Add MozillaStore. 2013-03-27 16:01:48 +09:00
Akinori MUSHA
bea9b1b502 each, cleanup: Fix the base date for expiration when the method starts.
This change is to remove an assumption that the clock is monotonic.
2013-03-27 15:10:03 +09:00
Akinori MUSHA
299bb24550 add(): Stop deleting an existing cookie when storing an expired cookie.
This is a backout of what I've done previously.  Expiration check is
better done in extraction where a user can optionally specify a base
date.

Add an internal method delete() to delete an existing cookie.
2013-03-27 14:58:22 +09:00
Akinori MUSHA
bd3ae6c1ae CookiestxtSaver: Hide HttpOnly cookies from old browsers.
This trick is the one that has been used in Mozilla before switching
the cookie database to SQLite.
2013-03-26 15:37:50 +09:00
Akinori MUSHA
8b78e3d1e4 CookiestxtSaver: Prefix the domain field with a dot if the domain flag is on.
The leading dot itself should be meaningless since there is the second
field to tell if the cookie is issued for a domain and that was the
reason I once removed it, but on second thought it doesn't hurt to put
one.
2013-03-26 15:37:50 +09:00
Akinori MUSHA
51da5e4c50 Do not touch and yield a cookie that should not be sent. 2013-03-26 01:43:06 +09:00
Akinori MUSHA
5b78957e19 Conform to RFC 6265 5.1.4 in that path=/a matches /a/* but not /ab.
Remove HTTP::Cookie.normalize_path and add HTTP::Cookie.path_match?
instead for comparison.
2013-03-23 02:02:56 +09:00
Akinori MUSHA
6dda359db1 Improve rdoc. 2013-03-23 00:37:21 +09:00
Akinori MUSHA
66f37b20dd Rename expire to expire!, to reduce the risk of making a typo. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
4532f190cc Avoid 1.9 syntax. 2013-03-18 01:05:03 +09:00