Mike Dalessio
22ea7af086
fix: be explicit about frozen string literals to quash warnings
2024-03-24 10:02:56 -04:00
Mike Dalessio
554d38a863
test: get to passing on JRuby
...
- update error message
- avoid race condition on cookie expiration
2024-03-23 17:25:14 -04:00
Akinori Musha
94e2b85861
Merge pull request #42 from andrelaszlo/abstract_store_fix_error_formatting_bug
...
Fix error formatting bug in HTTP::CookieJar::AbstractStore
2023-11-13 23:02:13 +09:00
Akinori MUSHA
8930674adf
Change the custom URI parser to be a bit more conservative
...
First try the default URI(), and if it fails relax the restrictions on
the path component as a fallback.
2023-11-02 01:48:31 +09:00
Christian Schmidt
052479536c
Allow non-RFC 3986-compliant URLs
2023-10-12 18:34:07 +02:00
André Laszlo
e7f2eb26e1
Add unit test
2023-02-13 18:53:02 +01:00
Akinori MUSHA
28a7478d83
Improve tests with $LOADED_FEATURES
2021-06-07 16:05:23 +09: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
40aba54618
Accept a class object where a symbol addressing a class is accepted.
...
Convert IndexError to ArgumentError, and ArgumentError to TypeError as
appropriate.
2013-04-21 20:35:17 +09:00
Akinori MUSHA
4ef2147138
Fix $LOADED_FEATURES comparison with Ruby 1.8.
2013-04-16 21:56:29 +09:00
Akinori MUSHA
bafb83fc06
Let AbstractStore & AbstractSaver autoloaded and add tests for autoloading.
2013-04-16 16:49:27 +09:00
Akinori MUSHA
20cb22bbb0
Increase GC threshold for shorter test time.
2013-04-16 10:21:52 +09:00
Akinori MUSHA
2bb7485460
Add tests for CookieJar#clone, #cleanup, expiration by #each and #empty?.
2013-04-16 15:05:00 +09:00
Akinori MUSHA
8abf3483e8
Travis-CI keeps reporting SEGV in ruby 1.9.3p327, so disuse at_exit.
2013-04-16 02:20:54 +09:00
Akinori MUSHA
18dc77af9f
Replace assert_send in at_exit with a simple message output.
2013-04-16 02:04:59 +09:00
Akinori MUSHA
b8170fb7e2
Increase the chance of having a finalizer called.
2013-04-16 01:52:59 +09:00
Akinori MUSHA
b02e800dfa
Comment out unused/advisory bits to gain coverage.
2013-04-16 00:54:56 +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
8e40fc3028
Test compatibility with a YAML file saved by Mechanize::Cookie.
2013-04-15 14:15:46 +09:00
Akinori MUSHA
1a05bb4dd0
Add more tests.
2013-04-14 13:40:49 +09:00
Akinori MUSHA
028b77987c
Gain more coverage.
2013-04-14 13:02:04 +09:00
Akinori MUSHA
655fc9eb56
Add tests for the constructor & store.
2013-04-14 12:19:11 +09:00
Akinori MUSHA
c9a8e29202
Fix a typo.
2013-04-14 12:19:10 +09:00
Akinori MUSHA
a1a130f156
CookieJar#parse: Use the block's return values to decide whether to add a cookie.
2013-04-14 12:10:28 +09:00
Akinori MUSHA
6fcc298b80
MozillaStore saves timestamps in seconds, so use a session cookie for testing.
2013-04-13 13:35:54 +09:00
Akinori MUSHA
9fec000a29
Slightly fix the timestamp tests.
2013-04-13 13:27:09 +09:00
Akinori MUSHA
17a3cbc970
Remove an unsupported keyword: session.
2013-04-13 12:57:13 +09:00
Akinori MUSHA
75267e8002
Use assert_send for comparison tests to see what is going on.
2013-04-12 23:18:06 +09:00
Akinori MUSHA
917adc1abb
Add a test for Cookie#accessed_at.
2013-04-12 01:25:04 +09:00
Akinori MUSHA
f3b8abdd8e
Add CookieJar#delete().
2013-04-12 01:19:39 +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
2dc17ab7dc
Better indentation while test is passing.
2013-03-28 19:24:05 +09:00
Akinori MUSHA
8d7da32cc3
Fully test MozillaStore as well as HashStore.
2013-03-27 02:49:55 +09:00
Akinori MUSHA
d76101722d
Catch IndexError instead.
2013-03-27 20:40:56 +09:00
Akinori MUSHA
4ebce92fad
Rescue LoadError.
2013-03-27 20:16:05 +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
a0ea64da56
CookieJar.new: Pass the store class via a :store keyword.
2013-03-27 17:43:58 +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
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
38f7e98f09
Replace compatibility errors with documentation.
...
Leave compatibility stuff to Mechanize itself and just keep
http-cookie clean.
2013-03-23 00:27:38 +09:00
Akinori MUSHA
9768154e82
Dir.tmpdir should be mktmpdir here.
2013-03-18 00:39:55 +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
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
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
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