# File lib/www/mechanize/cookie_jar.rb, line 30
      def cookies(url)
        cleanup
        url.path = '/' if url.path.empty?

        domains = @jar.find_all { |domain, _|
          url.host =~ /#{CookieJar.strip_port(domain)}$/i
        }

        return [] unless domains.length > 0

        cookies = domains.map { |_,paths|
          paths.find_all { |path, _|
            url.path =~ /^#{Regexp.escape(path)}/
          }.map { |_,cookie| cookie.values }
        }.flatten

        cookies.find_all { |cookie|
          !cookie.expires || Time.now < cookie.expires
        }
      end