MCPcopy Create free account
hub / github.com/acl-dev/acl / create_cookies

Method create_cookies

lib_acl_cpp/src/http/http_request.cpp:1037–1071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1035}
1036
1037void http_request::create_cookies()
1038{
1039 acl_assert(cookie_inited_ == false);
1040 if (client_ == NULL) {
1041 logger_error("connection not opened yet");
1042 return;
1043 }
1044
1045 const HTTP_HDR_RES* res = client_->get_respond_head(NULL);
1046 if (res == NULL) {
1047 return;
1048 }
1049
1050 if (cookies_ == NULL) {
1051 cookies_ = NEW std::vector<HttpCookie*>;
1052 }
1053
1054 int n = acl_array_size(res->hdr.entry_lnk);
1055 for (int i = 0; i < n; i++) {
1056 const HTTP_HDR_ENTRY* hdr = (const HTTP_HDR_ENTRY*)
1057 acl_array_index(res->hdr.entry_lnk, i);
1058 if (strcasecmp(hdr->name, "Set-Cookie") != 0)
1059 continue;
1060 if (hdr->value == NULL || *(hdr->value) == 0)
1061 continue;
1062 HttpCookie* cookie = NEW HttpCookie();
1063 if (! cookie->setCookie(hdr->value)) {
1064 cookie->destroy();
1065 continue;
1066 }
1067 cookies_->push_back(cookie);
1068 }
1069
1070 cookie_inited_ = true;
1071}
1072
1073} // namespace acl

Callers 2

get_cookiesMethod · 0.80
get_cookieMethod · 0.80

Calls 7

acl_array_sizeFunction · 0.85
acl_array_indexFunction · 0.85
get_respond_headMethod · 0.80
HttpCookieClass · 0.50
setCookieMethod · 0.45
destroyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected