Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix domainMatch() using rfc6265 section-5.1.3 #241

  • Loading branch information...
commit 4f8e602fed48663ae6d63102e7777a98acb4c859 1 parent f43c28c
@nauhygon authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/zombie/cookies.coffee
View
5 lib/zombie/cookies.coffee
@@ -41,8 +41,11 @@ dequote = (value)->
# Determines if domain matches hostname.
domainMatch = (domain, hostname)->
+ if domain.charAt(0) == '.'
+ domain = domain.substring(1)
+ i = hostname.length - domain.length
return domain == hostname ||
- (domain.charAt(0) == "." && domain.substring(1) == hostname.replace(/^[^.]+\./, ""))
+ (i > 0 && hostname[i-1] == '.' && domain == hostname.substring(i))
# Domain/path specific scope around the global cookies collection.

2 comments on commit 4f8e602

@zephrax

+1 to this fix.. would be great if assaf add it to his branch ;)

@jeromegn

Looks like Zombie is now using https://github.com/goinstant/node-cookie, you might want to submit a pull req on there, around those lines I think: https://github.com/goinstant/node-cookie/blob/master/lib/cookie.js#L217

Please sign in to comment.
Something went wrong with that request. Please try again.