mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
Prepare for using URI(url_or_uri).
This commit is contained in:
parent
c23dafe8c3
commit
a1e5e1628a
1 changed files with 14 additions and 0 deletions
|
|
@ -9,6 +9,18 @@ end
|
|||
|
||||
# This class is used to represent an HTTP Cookie.
|
||||
class HTTP::Cookie
|
||||
# In Ruby < 1.9.3 URI() does not accept an URI object.
|
||||
if RUBY_VERSION < "1.9.3"
|
||||
module URIFix
|
||||
def URI(url)
|
||||
url.is_a?(URI) ? url : URI(url)
|
||||
end
|
||||
private :URI
|
||||
end
|
||||
end
|
||||
|
||||
include URIFix if defined?(URIFix)
|
||||
|
||||
attr_reader :name
|
||||
attr_accessor :value, :version
|
||||
attr_accessor :domain, :path, :secure
|
||||
|
|
@ -81,6 +93,8 @@ class HTTP::Cookie
|
|||
alias for_domain? for_domain
|
||||
|
||||
class << self
|
||||
include URIFix if defined?(URIFix)
|
||||
|
||||
# Parses a Set-Cookie header value +set_cookie+ sent from +origin+
|
||||
# into an array of Cookie objects. Parts (separated by commas)
|
||||
# that are malformed are ignored.
|
||||
|
|
|
|||
Loading…
Reference in a new issue