Commit graph

57 commits

Author SHA1 Message Date
Akinori MUSHA
10e9ca5c60 Add HTTP::Cookie#session? as an alias for #session. 2013-03-15 04:20:58 +09:00
Akinori MUSHA
9d842404e3 Fix <=> so that two cookies of different values are not equal. 2013-03-12 18:32:18 +09:00
Akinori MUSHA
ea4759bd27 Add a test for <=>. 2013-03-12 18:32:18 +09:00
Akinori MUSHA
7554bffb32 Allow passing a base time to HTTP::Cookie.parse() via :date. 2013-03-12 18:32:18 +09:00
Akinori MUSHA
6d8fb94f83 Add support for the HttpOnly attribute.
New methods are added to HTTP::Cookie: httponly?, httponly=
2013-03-12 18:32:18 +09:00
Akinori MUSHA
2af7ffa907 Refactor the test code. 2013-03-12 18:32:18 +09:00
Akinori MUSHA
87bd991a81 Put a couple of to-do items I am working on. 2013-03-08 21:31:11 +09:00
Akinori MUSHA
f79387080b Use Hash#clear rather than creating a new one. 2013-03-08 21:31:11 +09:00
Akinori MUSHA
5f21b364d3 Remove an unused variable to suppress warning. 2013-03-08 21:31:11 +09:00
Akinori MUSHA
b05008d996 Always initialize @origin to suppress warning. 2013-03-08 21:31:11 +09:00
Akinori MUSHA
3ec9dc3200 Reduce warnings from the interpreter. (method redefinition) 2013-03-08 21:31:11 +09:00
Akinori MUSHA
92fe768c7f Merge pull request #1 from mmorearty/patch-cookiejar-header
Add header line when writing to cookies.txt
2013-03-08 03:34:31 -08:00
Mike Morearty
184fae797e Slight change to cookie-jar header
Instead of "Netscape HTTP Cookie File", now writing "HTTP Cookie File".
Python's cookie code recognizes either one.
2013-02-18 15:54:14 -08:00
Mike Morearty
0decfe98b7 Add header line when writing to cookies.txt
When Python is reading a Netscape-format cookies.txt file, it seems to
require an initial line that looks like this:

    # Netscape HTTP Cookie File
2013-02-17 18:23:32 -08:00
Akinori MUSHA
3c6659f43a Enable code coverage. 2012-11-06 01:12:29 +09:00
Akinori MUSHA
4bb4d51f8d Use a newer version of test-unit. 2012-11-06 00:05:09 +09:00
Akinori MUSHA
f4cd8ffb58 Hide load_yaml, renaming to require_yaml. 2012-10-22 15:14:19 +09:00
Akinori MUSHA
2a9476707c HTTP::CookieJar#load: Use File.open() instead of Kernel#open(). 2012-10-22 15:10:34 +09:00
Akinori MUSHA
7fa5b10df6 HTTP::CookieJar#each: Take an optional URL/URI which is used as a scope.
Do not call cleanup in each or cookies.
2012-10-22 15:08:08 +09:00
Akinori MUSHA
7c5ac21d0f HTTP::CookieJar#cleanup: Use delete_if. 2012-10-22 15:03:36 +09:00
Akinori MUSHA
b7254599bd Try not to expose @jar in normal methods. 2012-10-22 14:52:30 +09:00
Akinori MUSHA
c7247cf965 HTTP::CookieJar#empty?: Optimize. 2012-10-22 14:51:59 +09:00
Akinori MUSHA
1731b155e6 HTTP::CookieJar#add: Check if both the domain and path of the cookie are set. 2012-10-22 14:50:49 +09:00
Akinori MUSHA
82deac2f19 HTTP::Cookie#origin=: Acceptability check must be performed after setting the domain and path. 2012-10-22 14:50:13 +09:00
Akinori MUSHA
fa45e028a7 Treat an empty path as '/'.
HTTP::CookieJar#cookies: Do not modify a given URI.  Remove a
redundant cleanup() call.
2012-10-22 14:21:46 +09:00
Akinori MUSHA
24e9b26004 HTTP::CookieJar#add: Use the hostname of domain_name. 2012-10-22 12:59:08 +09:00
Akinori MUSHA
a47a849387 Define HTTP::Cookie#name= with validation. 2012-10-22 03:52:25 +09:00
Akinori MUSHA
e18013e25e Each record in cookies.txt must have seven columns at most. 2012-10-22 03:51:10 +09:00
Akinori MUSHA
c727d39076 Move cookies.txt parser and serializer from HTTP::CookieJar to HTTP::Cookie.
Fix a bug where anything after '#' in cookies.txt are removed.
2012-10-22 03:30:01 +09:00
Akinori MUSHA
fdcdae34be Make test_save_and_read_cookiestxt better. 2012-10-22 03:29:32 +09:00
Akinori MUSHA
95c702f99b Rename HTTP::CookieJar#add! to HTTP::CookieJar#add removing the original #add. 2012-10-22 02:39:20 +09:00
Akinori MUSHA
a342680e4e Fix and move some tests from test_http_cookie_jar.rb to test_http_cookie.rb. 2012-10-22 02:38:08 +09:00
Akinori MUSHA
d2f31d90b5 HTTP::Cookie.new: Delay setting of origin. 2012-10-22 02:20:43 +09:00
Akinori MUSHA
ae4a9d8d40 Make HTTP::Cookie Comparable. 2012-10-22 01:02:00 +09:00
Akinori MUSHA
d59a0ee5ca Define a custom YAML encoder and decoder.
Drop support for deserializing YAML made with Mechanize <2.1.
2012-10-22 01:02:00 +09:00
Akinori MUSHA
53e5b270ee Improve test_save_cookies_yaml(). 2012-10-22 00:04:53 +09:00
Akinori MUSHA
aa64d3d98b Rename HTTP::Cookie#clear! to clear. 2012-10-21 23:48:57 +09:00
Akinori MUSHA
fe65dbfb89 Add HTTP::Cookie#domain_name. 2012-10-21 23:48:21 +09:00
Akinori MUSHA
232906e0c3 Remove obsolete instance variables. 2012-10-22 01:01:59 +09:00
Akinori MUSHA
39d6965ed9 Use String.try_convert if available. 2012-10-21 19:12:13 +09:00
Akinori MUSHA
dd3ca9a0f1 Inhibit a domain-less cookie from being used for checking validity. 2012-10-18 19:00:33 +09:00
Akinori MUSHA
c3e4fae60c Refer to the instance variable @domain instead of the accessor. 2012-10-18 18:59:37 +09:00
Akinori MUSHA
75f7ee6505 Make valid_for_uri? and acceptable_from_uri? accept a URL string also. 2012-10-18 18:57:46 +09:00
Akinori MUSHA
e010e8f30e Add tests for valid_for_uri?. 2012-10-18 18:52:06 +09:00
Akinori MUSHA
79ab0ffabf Oops, fix infinite recursive calls of URI(). 2012-10-18 18:40:39 +09:00
Akinori MUSHA
3d7b39ff86 Update the example code. 2012-10-17 22:40:20 +09:00
Akinori MUSHA
1a471513de Disallow changing the origin of a cookie once it is set. 2012-10-17 22:35:30 +09:00
Akinori MUSHA
532101a102 Introduce a new cookie object attribute "origin".
Change the signature of HTTP::Cookie.parse() so that it only
optionally takes an origin URI.  When one is given, the method checks
if each piece of cookie in the header value is valid and acceptable
from the origin to ignore unacceptable cookies.
2012-10-17 22:35:30 +09:00
Akinori MUSHA
a1e5e1628a Prepare for using URI(url_or_uri). 2012-10-17 22:35:28 +09:00
Akinori MUSHA
c23dafe8c3 Document that HTTP::Cookie.parse takes an optional block. 2012-10-17 22:35:08 +09:00