mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
Drop dependency on WEBrick::HTTPUtils.
This commit is contained in:
parent
6d3f4ee2dd
commit
c389a52e2c
2 changed files with 6 additions and 3 deletions
|
|
@ -1,7 +1,6 @@
|
|||
require 'http/cookie/version'
|
||||
require 'time'
|
||||
require 'uri'
|
||||
require 'webrick/httputils'
|
||||
require 'domain_name'
|
||||
|
||||
module HTTP
|
||||
|
|
@ -203,7 +202,10 @@ class HTTP::Cookie
|
|||
pair.strip!
|
||||
key, value = pair.split(/=/, 2) #/)
|
||||
next unless key
|
||||
value = WEBrick::HTTPUtils.dequote(value.strip) if value
|
||||
case value # may be nil
|
||||
when /\A"(.*)"\z/
|
||||
value = $1.gsub(/\\(.)/, "\\1")
|
||||
end
|
||||
|
||||
case key.downcase
|
||||
when 'domain'
|
||||
|
|
|
|||
|
|
@ -95,13 +95,14 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|||
|
||||
def test_parse_quoted
|
||||
cookie_str =
|
||||
"quoted=\"value\"; Expires=Sun, 06 Nov 2011 00:11:18 GMT; Path=/"
|
||||
"quoted=\"value\"; Expires=Sun, 06 Nov 2011 00:11:18 GMT; Path=/; comment=\"comment is \\\"comment\\\"\""
|
||||
|
||||
uri = URI.parse 'http://example'
|
||||
|
||||
assert_equal 1, HTTP::Cookie.parse(cookie_str, :origin => uri) { |cookie|
|
||||
assert_equal 'quoted', cookie.name
|
||||
assert_equal '"value"', cookie.value
|
||||
assert_equal 'comment is "comment"', cookie.comment
|
||||
}.size
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue