Changeset View
Changeset View
Standalone View
Standalone View
src/future/http/status/HTTPFutureHTTPResponseStatus.php
Context not available. | |||||
// NOTE: Avoiding PhutilUTF8StringTruncator here because this isn't lazy | // NOTE: Avoiding PhutilUTF8StringTruncator here because this isn't lazy | ||||
// and responses may be large. | // and responses may be large. | ||||
if (strlen($body) > 512) { | if (@strlen($body) > 512) { | ||||
$excerpt = substr($body, 0, 512).'...'; | $excerpt = @substr($body, 0, 512).'...'; | ||||
} else { | } else { | ||||
$excerpt = $body; | $excerpt = $body; | ||||
} | } | ||||
$content_type = BaseHTTPFuture::getHeader($headers, 'Content-Type'); | $content_type = BaseHTTPFuture::getHeader($headers, 'Content-Type'); | ||||
$match = null; | $match = null; | ||||
if (preg_match('/;\s*charset=([^;]+)/', $content_type, $match)) { | if (@preg_match('/;\s*charset=([^;]+)/', $content_type, $match)) { | ||||
$encoding = trim($match[1], "\"'"); | $encoding = trim($match[1], "\"'"); | ||||
try { | try { | ||||
$excerpt = phutil_utf8_convert($excerpt, 'UTF-8', $encoding); | $excerpt = phutil_utf8_convert($excerpt, 'UTF-8', $encoding); | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0