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:
@@ -931,20 +931,23 @@ BHttpRequest::_SendHeaders()
|
|||||||
|
|
||||||
// Context cookies
|
// Context cookies
|
||||||
if (fOptSetCookies && fContext != NULL) {
|
if (fOptSetCookies && fContext != NULL) {
|
||||||
BNetworkCookie* cookie;
|
|
||||||
BString cookieString;
|
BString cookieString;
|
||||||
|
|
||||||
for (BNetworkCookieJar::UrlIterator it
|
BNetworkCookieJar::UrlIterator iterator
|
||||||
= fContext->GetCookieJar().GetUrlIterator(fUrl);
|
= fContext->GetCookieJar().GetUrlIterator(fUrl);
|
||||||
(cookie = it.Next()) != NULL;) {
|
BNetworkCookie* cookie = iterator.Next();
|
||||||
if (cookieString.Length() > 0)
|
if (cookie != NULL) {
|
||||||
cookieString << "; ";
|
while (true) {
|
||||||
cookieString << cookie->RawCookie(false);
|
cookieString << cookie->RawCookie(false);
|
||||||
|
cookie = iterator.Next();
|
||||||
|
if (cookie == NULL)
|
||||||
|
break;
|
||||||
|
cookieString << "; ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cookieString.Length() > 0)
|
|
||||||
fOutputHeaders.AddHeader("Cookie", cookieString);
|
fOutputHeaders.AddHeader("Cookie", cookieString);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Write output headers to output stream
|
// Write output headers to output stream
|
||||||
for (int32 headerIndex = 0; headerIndex < fOutputHeaders.CountHeaders();
|
for (int32 headerIndex = 0; headerIndex < fOutputHeaders.CountHeaders();
|
||||||
|
|||||||
Reference in New Issue
Block a user