Commit 577a9faf authored by Aaron Wells's avatar Aaron Wells
Browse files

Fix issues when checking a gravatar exists

Bug 1386532: If checking via HTTP, gravatar returns "HTTP/1.0"
via HTTPS, it returns "HTTP/1.1"

Change-Id: I82a8fce9593007784973a7796cbe9a68a85794b7
parent 54bd0196
......@@ -2609,8 +2609,8 @@ function remote_avatar($email, $size, $notfound) {
$baseurl = get_config('remoteavatarbaseurl');
}
// Check if it is a valid avatar
$result = get_headers("{$baseurl}{$md5sum}.jpg?d=404");
if ($result[0] === "HTTP/1.0 404 Not Found") {
$result = @get_headers("{$baseurl}{$md5sum}.jpg?d=404");
if (!$result || preg_match("#^HTTP/\d+\.\d+ 404 #i", $result[0])) {
return $notfound;
}
return "{$baseurl}{$md5sum}.jpg?r=g&s=$s";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment