mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-01-01 06:33:22 +00:00
#422: bite me imgur
This commit is contained in:
parent
168dd9f147
commit
aad4dea917
@ -181,7 +181,8 @@ HttpBaseChannel::Init(nsIURI *aURI,
|
||||
rv = mRequestHead.SetHeader(nsHttp::Host, hostLine);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gHttpHandler->AddStandardRequestHeaders(&mRequestHead.Headers(), isHTTPS);
|
||||
rv = gHttpHandler->AddStandardRequestHeaders(&mRequestHead.Headers(), isHTTPS,
|
||||
hostLine);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoCString type;
|
||||
|
@ -422,14 +422,28 @@ nsHttpHandler::InitConnectionMgr()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request, bool isSecure)
|
||||
nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request,
|
||||
bool isSecure,
|
||||
const nsACString &hostLine)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Add the "User-Agent" header
|
||||
rv = request->SetHeader(nsHttp::User_Agent, UserAgent(),
|
||||
false, nsHttpHeaderArray::eVarietyDefault);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// Add the "User-Agent" header (unless we have blacklisted this site and
|
||||
// we aren't using a custom user agent; see TenFourFox issue 422).
|
||||
if (mUserAgentOverride || (
|
||||
!hostLine.EqualsLiteral("i.imgur.com") &&
|
||||
!hostLine.EqualsLiteral("imgur.com") &&
|
||||
1)) {
|
||||
rv = request->SetHeader(nsHttp::User_Agent, UserAgent(),
|
||||
false, nsHttpHeaderArray::eVarietyDefault);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
#if DEBUG
|
||||
else {
|
||||
fprintf(stderr, "User agent header suppressed for host: %s\n",
|
||||
PromiseFlatCString(hostLine).get());
|
||||
}
|
||||
#endif
|
||||
|
||||
// MIME based content negotiation lives!
|
||||
// Add the "Accept" header. Note, this is set as an override because the
|
||||
|
@ -67,7 +67,8 @@ public:
|
||||
nsHttpHandler();
|
||||
|
||||
nsresult Init();
|
||||
nsresult AddStandardRequestHeaders(nsHttpHeaderArray *, bool isSecure);
|
||||
nsresult AddStandardRequestHeaders(nsHttpHeaderArray *, bool isSecure,
|
||||
const nsACString &hostLine);
|
||||
nsresult AddConnectionHeader(nsHttpHeaderArray *,
|
||||
uint32_t capabilities);
|
||||
bool IsAcceptableEncoding(const char *encoding, bool isSecure);
|
||||
|
Loading…
Reference in New Issue
Block a user