if ($response instanceof AphrontWebpageResponse) { echo phutil_tag('div', array('style' => 'background: #eeddff;' . 'white-space: pre-wrap;' . 'z-index: 200000;' . 'position: relative;' . 'padding: 8px;' . 'font-family: monospace'), $unexpected_output); } } $sink->writeResponse($response); } catch (Exception $ex) { $write_guard->dispose(); $access_log->write(); if ($original_exception) { $ex = new PhutilAggregateException('Multiple exceptions during processing and rendering.', array($original_exception, $ex)); } PhabricatorStartup::didEncounterFatalException('Rendering Exception', $ex, $show_unexpected_traces); } $write_guard->dispose(); $access_log->setData(array('c' => $response->getHTTPResponseCode(), 'T' => PhabricatorStartup::getMicrosecondsSinceStart())); DarkConsoleXHProfPluginAPI::saveProfilerSample($access_log); // Add points to the rate limits for this request. if (isset($_SERVER['REMOTE_ADDR'])) { $user_ip = $_SERVER['REMOTE_ADDR']; // The base score for a request allows users to make 30 requests per // minute. $score = 1000 / 30; // If the user was logged in, let them make more requests. if ($request->getUser() && $request->getUser()->getPHID()) { $score = $score / 5; } PhabricatorStartup::addRateLimitScore($user_ip, $score); } } catch (Exception $ex) { PhabricatorStartup::didEncounterFatalException('Core Exception', $ex, $show_unexpected_traces); }
AphrontApplicationConfiguration::runHTTPRequest($sink); } catch (Exception $ex) { try { $response = new AphrontUnhandledExceptionResponse(); $response->setException($ex); PhabricatorStartup::endOutputCapture(); $sink->writeResponse($response); } catch (Exception $response_exception) { // If we hit a rendering exception, ignore it and throw the original // exception. It is generally more interesting and more likely to be // the root cause. throw $ex; } } } catch (Exception $ex) { PhabricatorStartup::didEncounterFatalException('Core Exception', $ex, false); } function phabricator_startup() { // Load the PhabricatorStartup class itself. $t_startup = microtime(true); $root = dirname(dirname(__FILE__)); require_once $root . '/support/PhabricatorStartup.php'; // If the preamble script exists, load it. $t_preamble = microtime(true); $preamble_path = $root . '/support/preamble.php'; if (file_exists($preamble_path)) { require_once $preamble_path; } $t_hook = microtime(true); PhabricatorStartup::didStartup($t_startup);