mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
Core: HttpRequest improved cookie precendence
git-svn-id: svn://ultimatepp.org/upp/trunk@4996 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
6ecaedceb1
commit
8f22ce895c
1 changed files with 12 additions and 4 deletions
|
|
@ -485,15 +485,23 @@ void HttpRequest::StartRequest()
|
|||
if(ctype.GetCount())
|
||||
data << "Content-Type: " << ctype << "\r\n";
|
||||
}
|
||||
String cs;
|
||||
VectorMap<String, Tuple2<String, int> > cms;
|
||||
for(int i = 0; i < cookies.GetCount(); i++) {
|
||||
const HttpCookie& c = cookies[i];
|
||||
if(host.EndsWith(c.domain) && path.StartsWith(c.path)) {
|
||||
if(cs.GetCount())
|
||||
cs << "; ";
|
||||
cs << c.id << '=' << c.value;
|
||||
Tuple2<String, int>& m = cms.GetAdd(c.id, MakeTuple(String(), -1));
|
||||
if(c.path.GetLength() > m.b) {
|
||||
m.a = c.value;
|
||||
m.b = c.path.GetLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
String cs;
|
||||
for(int i = 0; i < cms.GetCount(); i++) {
|
||||
if(i)
|
||||
cs << "; ";
|
||||
cs << cms.GetKey(i) << '=' << cms[i].a;
|
||||
}
|
||||
if(cs.GetCount())
|
||||
data << "Cookie: " << cs << "\r\n";
|
||||
if(!IsNull(proxy_host) && !IsNull(proxy_username))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue