/** * Handle the common (resource independent) headers * * @param DAV_Resource $resource * @return array HTTP headers */ protected static function common($resource) { $headers = $resource->method_HEAD(); if (!isset($headers['Content-Length']) && !is_null($tmp = $resource->prop_getcontentlength())) { $headers['Content-Length'] = htmlspecialchars_decode($tmp); } if (!isset($headers['Content-Type'])) { if (!is_null($tmp = $resource->prop_getcontenttype())) { $headers['Content-Type'] = htmlspecialchars_decode($tmp); } else { $headers['Content-Type'] = 'application/octet-stream'; } } if (!isset($headers['ETag']) && !is_null($tmp = $resource->prop_getetag())) { $headers['ETag'] = htmlspecialchars_decode($tmp); } if (!isset($headers['Last-Modified']) && !is_null($tmp = $resource->prop_getlastmodified())) { $headers['Last-Modified'] = htmlspecialchars_decode($tmp); } if (!isset($headers['Content-Language']) && !is_null($tmp = $resource->prop_getcontentlanguage())) { $headers['Content-Language'] = htmlspecialchars_decode($tmp); } $headers['Accept-Ranges'] = 'bytes'; return $headers; }