Commit graph

180 commits

Author SHA1 Message Date
Akinori MUSHA
f5f82c0304 Fix test_parse_bad_version and test_parse_bad_max_age. 2013-04-07 23:02:14 +09:00
Akinori MUSHA
dcf7f7e7a5 Avoid a bug of ruby 1.8. 2013-04-03 20:09:48 +09:00
Akinori MUSHA
726e2f89ea Emulate behavior of URI() of ruby >=1.9 where it raises ArgumentError. 2013-04-03 18:41:22 +09:00
Akinori MUSHA
9b4ce19873 Bump VERSION to 1.0.0.pre9. 2013-04-03 18:08:56 +09:00
Akinori MUSHA
7dba33bd40 Cookie#domain=: Fix handling of an empty string and let it accept nil. 2013-04-03 17:58:41 +09:00
Akinori MUSHA
ffabb614ad Perform acceptance check in CookieJar#add instead of origin=.
- Cookie#acceptable? is added, which is called by such methods as
  Cookie.parse and CookieJar#add.

- Cookie#origin= no longer raises ArgumentError just because it
  conflicts with the domain.

- Cookie#origin= raises ArgumentError if it is given an object that is
  not URI or string-like.
2013-04-03 17:57:27 +09:00
Akinori MUSHA
90ffce9aa6 Improve rdoc. 2013-04-03 17:29:08 +09:00
Akinori MUSHA
25630b35e7 Use case-when. 2013-04-02 23:34:44 +09:00
Akinori MUSHA
1d9dc5754c Fix testing with simplecov. 2013-04-02 22:59:52 +09:00
Akinori MUSHA
7ab0a15d78 Update rdoc. 2013-03-29 15:34:27 +09:00
Akinori MUSHA
48f5783ba5 origin=: Do not raise error if the new value is the same as the stock value. 2013-03-29 02:14:55 +09:00
Akinori MUSHA
5a78013d85 Bump the version to 1.0.0.pre8. 2013-03-29 01:58:43 +09:00
Akinori MUSHA
1c140c035d Add a utility shorthand method HTTP::CookieJar#parse. 2013-03-29 01:55:43 +09:00
Akinori MUSHA
dc65a98907 HTTP::Cookie.parse: Change the signature again.
I made the uri parameter optional when I introduced the origin
attribute, but on second thought it should always be given.

I'm making the origin parameter fixed and mandatory again, but this
time it comes next to set_cookie.  This order should look more natural
because the one that comes first is to be parsed.

Since Mechanize::Cookie.parse required the uri parameter to be a URI
object, backward compatibility is still possible.
2013-03-29 01:39:30 +09:00
Akinori MUSHA
ef7bdeefba Cookie#cookie_value too should quote values if necessary. 2013-03-28 22:06:19 +09:00
Akinori MUSHA
2dc17ab7dc Better indentation while test is passing. 2013-03-28 19:24:05 +09:00
Akinori MUSHA
3131a46f14 Bump the version to 1.0.0.pre7. 2013-03-28 19:13:04 +09:00
Akinori MUSHA
26034253b1 Elaborate on the hash storage model. 2013-03-28 19:13:02 +09:00
Akinori MUSHA
8d7da32cc3 Fully test MozillaStore as well as HashStore. 2013-03-27 02:49:55 +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
11a9df8559 Fix handling of the :for_domain option in HTTP::Cookie.new(). 2013-03-28 01:46:42 +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
19901a9d9c Edit rdoc. 2013-03-28 00:37:35 +09:00
Akinori MUSHA
a3a1acfee2 Even a host that equals a public suffix may not issue domain wide cookies.
This is described in RFC 6265 5.3.
2013-03-28 00:36:01 +09:00
Akinori MUSHA
c5252649c8 Add some tests that fail to spot bugs. 2013-03-28 00:34:49 +09:00
Akinori MUSHA
c787b0b9dc Bump VERSION to 1.0.0.pre6. 2013-03-28 00:16:51 +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
073d83b40c Cookie.new: Let max_age take precedence over expires. 2013-03-28 00:12:46 +09:00
Akinori MUSHA
fcb447164d Prefer __send__ to send. 2013-03-28 00:12:29 +09:00
Akinori MUSHA
8aa9ed9e6c Bump VERSION to 1.0.0.pre5. 2013-03-27 21:17:07 +09:00
Akinori MUSHA
d76101722d Catch IndexError instead. 2013-03-27 20:40:56 +09:00
Akinori MUSHA
94d4b8f2a7 Do not depend on sqlite3 on JRuby. 2013-03-27 20:28:32 +09:00
Akinori MUSHA
4ebce92fad Rescue LoadError. 2013-03-27 20:16:05 +09:00
Akinori MUSHA
64297ffebe Change sqlite3 to a development dependency, since it is optional. 2013-03-27 20:14:23 +09:00
Akinori MUSHA
619b915a94 Fix test_yaml_expires taking care of time precisions. 2013-03-27 20:08:27 +09:00
Akinori MUSHA
c53579c231 Bump VERSION to 1.0.0.pre4. 2013-03-27 19:52:14 +09:00
Akinori MUSHA
683141da59 Use :memory: database to save test time. 2013-03-27 19:50:31 +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
a0ea64da56 CookieJar.new: Pass the store class via a :store keyword. 2013-03-27 17:43:58 +09:00
Akinori MUSHA
b58736957d Bump VERSION to 1.0.0.pre3. 2013-03-27 16:10:11 +09:00
Akinori MUSHA
6fade20c59 Make GC threshold user specifiable. 2013-03-27 16:10:05 +09:00
Akinori MUSHA
823c2a15e0 Add sqlite3 as runtime dependency, or MozillaStore. 2013-03-27 16:01:48 +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