value ��ʽ��xxx=xxx; domain=xxx; expires=xxx; path=xxx
| 129 | |
| 130 | // value ��ʽ��xxx=xxx; domain=xxx; expires=xxx; path=xxx |
| 131 | bool HttpCookie::setCookie(const char* value) |
| 132 | { |
| 133 | if (value == NULL || *value == 0) { |
| 134 | return false; |
| 135 | } |
| 136 | |
| 137 | ACL_ARGV* tokens = acl_argv_split(value, ";"); |
| 138 | acl_assert(tokens->argc > 0); |
| 139 | |
| 140 | HTTP_PARAM param; |
| 141 | |
| 142 | // �ӵ�һ�� name=value �ֶ���ȡ�� cookie ���� cookie ֵ |
| 143 | if (splitNameValue(tokens->argv[0], ¶m) == false) { |
| 144 | acl_argv_free(tokens); |
| 145 | return false; |
| 146 | } |
| 147 | // name �϶��� "\0"���� value ����Ϊ "\0" |
| 148 | name_ = dbuf_->dbuf_strdup(param.name); |
| 149 | value_ = dbuf_->dbuf_strdup(param.value); |
| 150 | |
| 151 | for (int i = 1; i < tokens->argc; i++) { |
| 152 | if (splitNameValue(tokens->argv[i], ¶m) == false) { |
| 153 | continue; |
| 154 | } |
| 155 | if (*(param.value) == 0) { |
| 156 | continue; |
| 157 | } |
| 158 | if (strcasecmp(param.name, "domain") == 0) { |
| 159 | setDomain(param.value); |
| 160 | } else if (strcasecmp(param.name, "expires") == 0) { |
| 161 | setExpires(param.value); |
| 162 | } else if (strcasecmp(param.name, "path") == 0) { |
| 163 | setPath(param.value); |
| 164 | } else { |
| 165 | add(param.name, param.value); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | acl_argv_free(tokens); |
| 170 | return true; |
| 171 | } |
| 172 | |
| 173 | HttpCookie& HttpCookie::setDomain(const char* domain) |
| 174 | { |
no test coverage detected