fix: check the request's headers rather than the empty response's headers for User-Agent and Accept (#296)

This commit is contained in:
crjc 2021-06-05 19:19:53 +01:00 committed by GitHub
parent 26897b2425
commit bbe2ae6dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,14 +190,14 @@ namespace ix
} }
// Set a default Accept header if none is present // Set a default Accept header if none is present
if (headers.find("Accept") == headers.end()) if (args->extraHeaders.find("Accept") == args->extraHeaders.end())
{ {
ss << "Accept: */*" ss << "Accept: */*"
<< "\r\n"; << "\r\n";
} }
// Set a default User agent if none is present // Set a default User agent if none is present
if (headers.find("User-Agent") == headers.end()) if (args->extraHeaders.find("User-Agent") == args->extraHeaders.end())
{ {
ss << "User-Agent: " << userAgent() << "\r\n"; ss << "User-Agent: " << userAgent() << "\r\n";
} }