Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Writing cookies: Prefix wildcard domains with "."

If a cookie matches a wildcard domain, e.g. "(anything).example.com",
then the line written out to a Netscape-formatted cookies.txt file must
begin with a dot, e.g. ".example.com" not "example.com".  This is
redundant with the second field of the line, a TRUE/FALSE value
indicating whether the domain is a wildcard, but that's the way it goes.
  • Loading branch information...
commit dae27334815082e228cfd344e2452a17121f6847 1 parent 7c49ee0
@mmorearty mmorearty authored Mike Morearty committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/mechanize/cookie_jar.rb
View
2  lib/mechanize/cookie_jar.rb
@@ -192,7 +192,7 @@ def dump_cookiestxt(io)
"#{Mechanize::VERSION} https://github.com/sparklemotion/mechanize.\n\n"
to_a.each do |cookie|
io.puts([
- cookie.domain,
+ (cookie.for_domain? ? "." : "") + cookie.domain,
cookie.for_domain? ? "TRUE" : "FALSE",
cookie.path,
cookie.secure ? "TRUE" : "FALSE",
Please sign in to comment.
Something went wrong with that request. Please try again.