BHttpRequest: Improve cookie string building loop...
... to avoid some checks. Does it make the code more readable? Not that it was hard to follow before.
This commit is contained in:
parent
1514eb3753
commit
3e2e0e63cd
@ -931,19 +931,22 @@ BHttpRequest::_SendHeaders()
|
||||
|
||||
// Context cookies
|
||||
if (fOptSetCookies && fContext != NULL) {
|
||||
BNetworkCookie* cookie;
|
||||
BString cookieString;
|
||||
|
||||
for (BNetworkCookieJar::UrlIterator it
|
||||
= fContext->GetCookieJar().GetUrlIterator(fUrl);
|
||||
(cookie = it.Next()) != NULL;) {
|
||||
if (cookieString.Length() > 0)
|
||||
BNetworkCookieJar::UrlIterator iterator
|
||||
= fContext->GetCookieJar().GetUrlIterator(fUrl);
|
||||
BNetworkCookie* cookie = iterator.Next();
|
||||
if (cookie != NULL) {
|
||||
while (true) {
|
||||
cookieString << cookie->RawCookie(false);
|
||||
cookie = iterator.Next();
|
||||
if (cookie == NULL)
|
||||
break;
|
||||
cookieString << "; ";
|
||||
cookieString << cookie->RawCookie(false);
|
||||
}
|
||||
|
||||
if (cookieString.Length() > 0)
|
||||
}
|
||||
|
||||
fOutputHeaders.AddHeader("Cookie", cookieString);
|
||||
}
|
||||
}
|
||||
|
||||
// Write output headers to output stream
|
||||
|
Loading…
x
Reference in New Issue
Block a user