cookies - android setcookie -
i trying set cookie below.
cookiesyncmanager.createinstance(context); cookiemanager cookiemanager = cookiemanager.getinstance(); cookiemanager.setcookie("http://wwww.mydomain.com", "mycookie=123"; domain=.mydomain"); cookiesyncmanager.getinstance().sync(); when access page mydomain.com, cookie can retrieved. when try set cookie using ip address, page cannot retrieve cookie.
1) because can set cookie using hostname? 2) why when access website using ip address, website still able set , retrieve cookie?
its domain name specification:
domain=domain optional. domain attribute specifies domain cookie valid. explicitly specified domain must start dot.
http://www.ietf.org/rfc/rfc2109.txt
android might extract domain , path url, domain must fully-qualified domain name.
further, if access via ip following statement relevant:
domain selection origin server's fully-qualified host name must domain-match domain attribute of cookie.
the answer yes though.
Comments
Post a Comment