Commit graph

317 commits

Author SHA1 Message Date
Akinori MUSHA
ddf74fee1e Rewrite the Set-Cookie header parser entirely.
The new parser is almost RFC 6265 compliant as the previous
implementation but has some extensions:

- It can parse double-quoted values with unsafe characters inside
  escaped with the backslash.

- It parses a date value of the expires attribute in the way the RFC
  describes, with an exception that it allows omission of the seconds
  field.  Some of the broken date representations that used to pass
  are now treated as error and ignored.

- It can parse a Set-Cookie value that contains multiple cookie
  definitions separated by comma, and commas put inside double quotes
  are not mistaken as definition separator.
2013-03-21 15:52:22 +09:00
Akinori MUSHA
b11aa95025 Initialize secure and httponly with false instead of nil. 2013-03-21 15:49:44 +09:00
Akinori MUSHA
6b6944b324 Add inspect. 2013-03-21 15:46:45 +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
f04714741f Add expires_at as alias for expires. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
ae0b3834e7 Make path= accept a string-like. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
59370c79c3 Improve rdoc markups, migrating to Markdown. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
5d0bc5f67d Disallow some more bad characters in name=/value=. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
cc6780a5bc A relative path must be treated as the root path as per RFC 6265 5.1.4. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
28eabedcd3 Use __send__() instead of send(). 2013-03-21 15:46:45 +09:00
Akinori MUSHA
b78271db6d Remove an obsolete part. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
f14c1786cd Make expires and max_age affect each other and drop session=(). 2013-03-21 15:46:45 +09:00
Akinori MUSHA
1c7b660c85 Improve comments. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
ceea67add9 Drop multi-byte characters from the test, which are not allowed. 2013-03-21 15:46:45 +09:00
Akinori MUSHA
7d81c10914 A cookie value may be DQUOTE'd as per RFC 6265 2.2.
Escaping with the backslash character is not mentioned in the RFC but
the backslash character is not allowed here anyway, so just be nice
and support it for legacy applications.
2013-03-21 15:46:45 +09:00
Akinori MUSHA
6c5e87aff3 Add ruby-head and jruby-head. 2013-03-18 02:04:25 +09:00
Akinori MUSHA
4532f190cc Avoid 1.9 syntax. 2013-03-18 01:05:03 +09:00
Akinori MUSHA
af97e2db0f Add rake and rdoc as development dependency. 2013-03-18 01:00:55 +09:00
Akinori MUSHA
ca51ab9430 Add .travis.yml. 2013-03-18 00:56:47 +09:00
Akinori MUSHA
1eb25f4ab9 Bump VERSION to 0.1.5. 2013-03-18 00:53:14 +09:00
Akinori MUSHA
dff0f57614 Delete trailing whitespace. 2013-03-18 00:43:52 +09:00
Akinori MUSHA
1a7c38e9e0 Apply minor code improvements. 2013-03-18 00:40:47 +09:00
Akinori MUSHA
9768154e82 Dir.tmpdir should be mktmpdir here. 2013-03-18 00:39:55 +09:00
Akinori MUSHA
c389a52e2c Drop dependency on WEBrick::HTTPUtils. 2013-03-18 00:09:01 +09:00
Akinori MUSHA
6d3f4ee2dd parse() ignores bad cookies. 2013-03-18 00:06:20 +09:00
Akinori MUSHA
4a5eb9801a Test that parse() actually returns a cookie. 2013-03-18 00:05:31 +09:00
Akinori MUSHA
3e61ef78a2 Require 'uri'. 2013-03-17 23:56:58 +09:00
Akinori MUSHA
cbb25195d4 Bump VERSION to 0.1.4. 2013-03-15 19:25:16 +09:00
Akinori MUSHA
fc8ddebce0 Fix a terrible typo that kept YAMLServer from working. :( 2013-03-15 19:24:20 +09:00
Akinori MUSHA
c6d28de9b7 Improve documentation. 2013-03-15 19:22:39 +09:00
Akinori MUSHA
c99825de21 Cookie.parse() returns an array of cookies. 2013-03-15 18:35:13 +09:00
Akinori MUSHA
d2cb5ff69d Bump VERSION to 0.1.3. 2013-03-15 12:31:49 +09:00
Akinori MUSHA
15f960bfbd Reduce warnings. 2013-03-15 12:31:19 +09:00
Akinori MUSHA
4845b0de94 Trying to preload psych only on Ruby 1.9.2. 2013-03-15 12:29:54 +09:00
Akinori MUSHA
631608f82d Bump VERSION to 0.1.2. 2013-03-15 12:14:58 +09:00
Akinori MUSHA
f936d91521 1.8 compatibility: Fix syntax and remove dependency on hash key order. 2013-03-15 12:13:59 +09:00
Akinori MUSHA
b2920eda0f Do not chdir in test. It breaks autoloads since test is run with -Ilib. 2013-03-15 12:12:53 +09:00
Akinori MUSHA
59ddb58b25 1.8 compatibility; Use IndexError instead of KeyError. 2013-03-15 12:11:38 +09:00
Akinori MUSHA
05e5d332df These autoloads do not serve much. 2013-03-15 12:10:22 +09:00
Akinori MUSHA
236f3af719 Extend URI() globally. URI() is like everywhere by now. 2013-03-15 12:08:45 +09:00
Akinori MUSHA
e09d7ebcac Drop rcovtask for 1.8. It does not work for me. 2013-03-15 12:07:54 +09:00
Akinori MUSHA
a74db60721 Bump VERSION to 0.1.1. 2013-03-15 11:36:58 +09:00
Akinori MUSHA
8be03978a0 Make each(uri) not fail if a non-HTTP URL is given.
Fix documents with #each.  The uri argument was not made a keyword
argument.

Guarantee that the +uri+ given to AbstractStore#each() is a URI
object.

Make HashStore#each return self as required.
2013-03-15 11:33:54 +09:00
Akinori MUSHA
9d3975f641 A Store class should define empty?. 2013-03-15 11:27:02 +09:00
Akinori MUSHA
b86690cb21 Check if the scheme is http(s) and the host is non-nil in URI. 2013-03-15 11:21:57 +09:00
Akinori MUSHA
c2e0dbb96f Bump VERSION to 0.1.0. 2013-03-15 10:52:04 +09:00
Akinori MUSHA
5cebc4e56d Ignore incompatible YAML data. 2013-03-15 10:46:50 +09:00
Akinori MUSHA
f7bb9d6272 Perform markups. 2013-03-15 10:12:08 +09:00
Akinori MUSHA
c0d5f3a121 Add error messages to make migration from Mechanize::Cookie easier.
Add a section to elaborate on the incompatibilities to README.md.
2013-03-15 05:53:11 +09:00
Akinori MUSHA
8d8f01fa81 Cap the numbers of cookies per domain and cookies total, respectively.
This is implemented in HashStore#cleanup(), which is automatically
called by #add() after every 150 updates.
2013-03-15 04:20:59 +09:00