use Friendica\Core\Storage\Type\SystemResource;
use Friendica\Model\User;
use Friendica\Network\HTTPException;
+use Friendica\Network\HTTPException\NotModifiedException;
use Friendica\Object\Image;
use Friendica\Util\Images;
use Friendica\Util\Network;
$totalstamp = microtime(true);
if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
- header("HTTP/1.1 304 Not Modified");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
if (!empty($_SERVER["HTTP_IF_NONE_MATCH"])) {
header("Etag: " . $_SERVER["HTTP_IF_NONE_MATCH"]);
header_remove("Expires");
header_remove("Cache-Control");
}
- exit;
+ throw new NotModifiedException();
}
Profile::addVisitorCookieForHTTPSigner();
$mimetext = '';
if (!empty($url)) {
$mime = ParseUrl::getContentType($url);
- if (empty($mime) || ($mime[0] != 'image')) {
- $url = '';
- } else {
+ if (!empty($mime)) {
$mimetext = $mime[0] . '/' . $mime[1];
+ } else {
+ Logger::info('Invalid file', ['url' => $url]);
+ }
+ if (!empty($mimetext) && ($mime[0] != 'image') && ($mimetext != 'application/octet-stream')) {
+ Logger::info('Unexpected Content-Type', ['mime' => $mimetext, 'url' => $url]);
+ $mimetext = '';
}
}
- if (empty($url)) {
+ if (empty($mimetext)) {
if ($customsize <= Proxy::PIXEL_MICRO) {
$url = Contact::getDefaultAvatar($contact, Proxy::SIZE_MICRO);
} elseif ($customsize <= Proxy::PIXEL_THUMB) {