mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-10-31 08:39:34 +08:00
修改cookie设置的bug
This commit is contained in:
parent
8e4a2f25ba
commit
92d35f885a
@ -247,15 +247,23 @@ void HttpClient::checkCookie(HttpClient::HttpHeader &headers) {
|
||||
HttpCookie::Ptr cookie = std::make_shared<HttpCookie>();
|
||||
cookie->setHost(_lastHost);
|
||||
|
||||
for(auto &pr : key_val){
|
||||
if(pr.first == "path"){
|
||||
cookie->setPath(pr.second);
|
||||
}else if(pr.first == "expires"){
|
||||
cookie->setExpires(pr.second);
|
||||
}else{
|
||||
cookie->setKeyVal(pr.first,pr.second);
|
||||
int index = 0;
|
||||
auto arg_vec = split(set_cookie, ";");
|
||||
for (string &key_val : arg_vec) {
|
||||
auto key = FindField(key_val.data(),NULL,"=");
|
||||
auto val = FindField(key_val.data(),"=", NULL);
|
||||
|
||||
if(index++ == 0){
|
||||
cookie->setKeyVal(key,val);
|
||||
} else{
|
||||
if(key == "path"){
|
||||
cookie->setPath(val);
|
||||
}else if(key == "expires"){
|
||||
cookie->setExpires(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!(*cookie)){
|
||||
//无效的cookie
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user