HttpRequest: Apparently fContext can be NULL. CID 1162798
This commit is contained in:
@@ -834,16 +834,18 @@ BHttpRequest::_SendHeaders()
|
|||||||
fOutputHeaders.AddHeader("Referer", fOptReferer.String());
|
fOutputHeaders.AddHeader("Referer", fOptReferer.String());
|
||||||
|
|
||||||
// Authentication
|
// Authentication
|
||||||
BHttpAuthentication& authentication = fContext->GetAuthentication(fUrl);
|
if (fContext != NULL) {
|
||||||
if (authentication.Method() != B_HTTP_AUTHENTICATION_NONE) {
|
BHttpAuthentication& authentication = fContext->GetAuthentication(fUrl);
|
||||||
if (fOptUsername.Length() > 0) {
|
if (authentication.Method() != B_HTTP_AUTHENTICATION_NONE) {
|
||||||
authentication.SetUserName(fOptUsername);
|
if (fOptUsername.Length() > 0) {
|
||||||
authentication.SetPassword(fOptPassword);
|
authentication.SetUserName(fOptUsername);
|
||||||
}
|
authentication.SetPassword(fOptPassword);
|
||||||
|
}
|
||||||
|
|
||||||
BString request(fRequestMethod);
|
BString request(fRequestMethod);
|
||||||
fOutputHeaders.AddHeader("Authorization",
|
fOutputHeaders.AddHeader("Authorization",
|
||||||
authentication.Authorization(fUrl, request));
|
authentication.Authorization(fUrl, request));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required headers for POST data
|
// Required headers for POST data
|
||||||
@@ -890,7 +892,7 @@ BHttpRequest::_SendHeaders()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Context cookies
|
// Context cookies
|
||||||
if (fOptSetCookies && (fContext != NULL)) {
|
if (fOptSetCookies && fContext != NULL) {
|
||||||
BNetworkCookie* cookie;
|
BNetworkCookie* cookie;
|
||||||
BString cookieString;
|
BString cookieString;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user