| 1012 | } |
| 1013 | |
| 1014 | const HttpCookie* http_request::get_cookie(const char* name, |
| 1015 | bool case_insensitive /* = true */) const |
| 1016 | { |
| 1017 | if (!cookie_inited_) { |
| 1018 | const_cast<http_request*>(this)->create_cookies(); |
| 1019 | } |
| 1020 | if (cookies_ == NULL) { |
| 1021 | return NULL; |
| 1022 | } |
| 1023 | |
| 1024 | std::vector<HttpCookie*>::const_iterator cit = cookies_->begin(); |
| 1025 | for (; cit != cookies_->end(); ++cit) { |
| 1026 | if (case_insensitive) { |
| 1027 | if (strcasecmp((*cit)->getName(), name) == 0) { |
| 1028 | return *cit; |
| 1029 | } |
| 1030 | } else if (strcmp((*cit)->getName(), name) == 0) { |
| 1031 | return *cit; |
| 1032 | } |
| 1033 | } |
| 1034 | return NULL; |
| 1035 | } |
| 1036 | |
| 1037 | void http_request::create_cookies() |
| 1038 | { |
nothing calls this directly
no test coverage detected