PDA

Просмотр полной версии : не могу поставить куки


Дикс
10.04.2009, 09:42
создал в апаче два вирт. хоста:
golem.tbilet
и
tbilet

на первом ставлю куку:

setcookie("sessionid", "значение", time() + 60*60*24*10, "/", ".tbilet", 0);

но она ставится только для golem.tbilet, а для .tbilet - не ставится, хотя функция возвращает 1

в чем тут может быть дело??

astrologer
10.04.2009, 09:51
Представь, что у тебя было бы не tbilet, а ru, com или org, например.

Дикс
10.04.2009, 09:55
бляцтво, оказывается надо было вешать секурный вирт. хост на то же имя, но другой порт.
т.е. рабочая стуктура такая:

tbilet - главный сайт
tbilet:443 - ССЛ, для авторизации и прочей хрени

Дикс
10.04.2009, 09:56
astrologer
и че? локальному апачу и пхп плевать на длину имени хоста

astrologer
10.04.2009, 18:00
Дело не в длине.
4.3.2 Rejecting Cookies

To prevent possible security or privacy violations, a user agent
rejects a cookie (shall not store its information) if any of the
following is true:

* The value for the Path attribute is not a prefix of the request-
URI.

* The value for the Domain attribute contains no embedded dots or
does not start with a dot.

* The value for the request-host does not domain-match the Domain
attribute.

* The request-host is a FQDN (not IP address) and has the form HD,
where D is the value of the Domain attribute, and H is a string
that contains one or more dots.

Examples:

* A Set-Cookie from request-host y.x.foo.com for Domain=.foo.com
would be rejected, because H is y.x and contains a dot.

* A Set-Cookie from request-host x.foo.com for Domain=.foo.com would
be accepted.

* A Set-Cookie with Domain=.com or Domain=.com., will always be
rejected, because there is no embedded dot.

* A Set-Cookie with Domain=ajax.com will be rejected because the
value for Domain does not begin with a dot.2109 (http://www.ietf.org/rfc/rfc2109.txt), 4.3.2 Rejecting Cookies
2965 (http://www.ietf.org/rfc/rfc2965.txt), 3.3.2 Rejecting Cookies