Inheritance: extends AbstractMessage, implements Neos\Flow\Mvc\ResponseInterface
 /**
  * Just return the processed value
  *
  * @return mixed
  */
 public function evaluate()
 {
     $httpResponse = new Response();
     $httpResponse->setStatus($this->getStatusCode());
     $httpResponse->setHeaders(new Headers());
     foreach ($this->getHeaders() as $name => $value) {
         $httpResponse->setHeader($name, $value);
     }
     return implode("\r\n", $httpResponse->renderHeaders()) . "\r\n\r\n";
 }
 /**
  * Sends the specified HTTP status immediately.
  *
  * NOTE: This method only supports web requests and will throw an exception if used with other request types.
  *
  * @param integer $statusCode The HTTP status code
  * @param string $statusMessage A custom HTTP status message
  * @param string $content Body content which further explains the status
  * @throws UnsupportedRequestTypeException If the request is not a web request
  * @throws StopActionException
  * @api
  */
 protected function throwStatus($statusCode, $statusMessage = null, $content = null)
 {
     $this->response->setStatus($statusCode, $statusMessage);
     if ($content === null) {
         $content = $this->response->getStatus();
     }
     $this->response->setContent($content);
     throw new StopActionException();
 }
 /**
  * @test
  */
 public function throwStatusSetsTheStatusMessageAsContentIfNoFurtherContentIsProvided()
 {
     $controller = $this->getAccessibleMock(AbstractController::class, ['processRequest']);
     $controller->_call('initializeController', $this->mockActionRequest, $this->mockHttpResponse);
     $this->mockHttpResponse->expects($this->atLeastOnce())->method('setStatus')->with(404, null);
     $this->mockHttpResponse->expects($this->atLeastOnce())->method('getStatus')->will($this->returnValue('404 Not Found'));
     $this->mockHttpResponse->expects($this->atLeastOnce())->method('setContent')->with('404 Not Found');
     try {
         $controller->_call('throwStatus', 404);
     } catch (StopActionException $e) {
     }
 }
 /**
  * @param Request $httpRequest
  * @param RedirectInterface $redirect
  * @return Response|null
  */
 protected function buildResponse(Request $httpRequest, RedirectInterface $redirect)
 {
     if (headers_sent() === true && FLOW_SAPITYPE !== 'CLI') {
         return null;
     }
     $response = new Response();
     $statusCode = $redirect->getStatusCode();
     $response->setStatus($statusCode);
     if ($statusCode >= 300 && $statusCode <= 399) {
         $location = $redirect->getTargetUriPath();
         if (parse_url($location, PHP_URL_SCHEME) === null) {
             $location = $httpRequest->getBaseUri() . $location;
         }
         $response->setHeaders(new Headers(['Location' => $location, 'Cache-Control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Expires' => 'Sat, 26 Jul 1997 05:00:00 GMT']));
     } elseif ($statusCode >= 400 && $statusCode <= 599) {
         $exception = new Exception();
         $exception->setStatusCode($statusCode);
         throw $exception;
     }
     return $response;
 }
 /**
  * Redirects the web request to another uri.
  *
  * NOTE: This method only supports web requests and will throw an exception
  * if used with other request types.
  *
  * @param mixed $uri Either a string representation of a URI or a \Neos\Flow\Http\Uri object
  * @param integer $delay (optional) The delay in seconds. Default is no delay.
  * @param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other"
  * @return void
  * @throws StopActionException
  * @api
  */
 protected function redirectToUri($uri, $delay = 0, $statusCode = 303)
 {
     // the parent method throws the exception, but we need to act afterwards
     // thus the code in catch - it's the expected state
     try {
         parent::redirectToUri($uri, $delay, $statusCode);
     } catch (StopActionException $exception) {
         if ($this->request->getFormat() === 'json') {
             $this->response->setContent('');
         }
         throw $exception;
     }
 }
 /**
  * Starts the authentication: Redirect to login page
  *
  * @param Request $request The current request
  * @param Response $response The current response
  * @return void
  * @throws MissingConfigurationException
  */
 public function startAuthentication(Request $request, Response $response)
 {
     if (isset($this->options['routeValues'])) {
         $routeValues = $this->options['routeValues'];
         if (!is_array($routeValues)) {
             throw new MissingConfigurationException(sprintf('The configuration for the WebRedirect authentication entry point is incorrect. "routeValues" must be an array, got "%s".', gettype($routeValues)), 1345040415);
         }
         $actionRequest = new ActionRequest($request);
         $this->uriBuilder->setRequest($actionRequest);
         $actionName = $this->extractRouteValue($routeValues, '@action');
         $controllerName = $this->extractRouteValue($routeValues, '@controller');
         $packageKey = $this->extractRouteValue($routeValues, '@package');
         $subPackageKey = $this->extractRouteValue($routeValues, '@subpackage');
         $uri = $this->uriBuilder->setCreateAbsoluteUri(true)->uriFor($actionName, $routeValues, $controllerName, $packageKey, $subPackageKey);
     } elseif (isset($this->options['uri'])) {
         $uri = strpos($this->options['uri'], '://') !== false ? $this->options['uri'] : $request->getBaseUri() . $this->options['uri'];
     } else {
         throw new MissingConfigurationException('The configuration for the WebRedirect authentication entry point is incorrect or missing. You need to specify either the target "uri" or "routeValues".', 1237282583);
     }
     $response->setContent(sprintf('<html><head><meta http-equiv="refresh" content="0;url=%s"/></head></html>', htmlentities($uri, ENT_QUOTES, 'utf-8')));
     $response->setStatus(303);
     $response->setHeader('Location', $uri);
 }
Beispiel #7
0
 /**
  * Render this form.
  *
  * @return string rendered form
  * @api
  * @throws \Neos\Form\Exception\RenderingException
  */
 public function render()
 {
     if ($this->isAfterLastPage()) {
         $this->invokeFinishers();
         return $this->response->getContent();
     }
     $this->formState->setLastDisplayedPageIndex($this->currentPage->getIndex());
     if ($this->formDefinition->getRendererClassName() === null) {
         throw new \Neos\Form\Exception\RenderingException(sprintf('The form definition "%s" does not have a rendererClassName set.', $this->formDefinition->getIdentifier()), 1326095912);
     }
     $rendererClassName = $this->formDefinition->getRendererClassName();
     $renderer = new $rendererClassName();
     if (!$renderer instanceof \Neos\Form\Core\Renderer\RendererInterface) {
         throw new \Neos\Form\Exception\RenderingException(sprintf('The renderer "%s" des not implement RendererInterface', $rendererClassName), 1326096024);
     }
     $controllerContext = $this->getControllerContext();
     $renderer->setControllerContext($controllerContext);
     $renderer->setFormRuntime($this);
     return $renderer->renderRenderable($this);
 }
 /**
  * @test
  */
 public function shutdownCreatesSpecialDataEntryForSessionWithAuthenticatedAccounts()
 {
     $session = new Session();
     $this->inject($session, 'bootstrap', $this->mockBootstrap);
     $this->inject($session, 'objectManager', $this->mockObjectManager);
     $this->inject($session, 'settings', $this->settings);
     $this->inject($session, 'metaDataCache', $this->createCache('Meta'));
     $this->inject($session, 'storageCache', $this->createCache('Storage'));
     $session->initializeObject();
     $session->start();
     $account = new Account();
     $account->setAccountIdentifier('admin');
     $account->setAuthenticationProviderName('MyProvider');
     $token = new UsernamePassword();
     $token->setAuthenticationStatus(TokenInterface::AUTHENTICATION_SUCCESSFUL);
     $token->setAccount($account);
     $this->mockSecurityContext->expects($this->any())->method('isInitialized')->will($this->returnValue(true));
     $this->mockSecurityContext->expects($this->any())->method('getAuthenticationTokens')->will($this->returnValue([$token]));
     $session->close();
     $this->httpRequest->setCookie($this->httpResponse->getCookie('TYPO3_Flow_Session'));
     $session->resume();
     $this->assertEquals(['MyProvider:admin'], $session->getData('TYPO3_Flow_Security_Accounts'));
 }
 /**
  * @test
  */
 public function renderSetsContentTypeHeader()
 {
     $this->response->expects($this->once())->method('setHeader')->with('Content-Type', 'application/json');
     $this->view->render();
 }
 /**
  * @test
  * @dataProvider contentAndExpectedStringRepresentation()
  */
 public function toStringAlwaysReturnsAStringRepresentationOfContent($content, $expectedString)
 {
     $response = new Response();
     $response->setContent($content);
     $this->assertSame($expectedString, (string) $response);
 }
 /**
  * Prepare a response in case an error occurred.
  *
  * @param object $exception \Exception or \Throwable
  * @param Http\Response $response
  * @return void
  */
 protected function prepareErrorResponse($exception, Http\Response $response)
 {
     $pathPosition = strpos($exception->getFile(), 'Packages/');
     $filePathAndName = $pathPosition !== false ? substr($exception->getFile(), $pathPosition) : $exception->getFile();
     $exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
     $content = PHP_EOL . 'Uncaught Exception in Flow ' . $exceptionCodeNumber . $exception->getMessage() . PHP_EOL;
     $content .= 'thrown in file ' . $filePathAndName . PHP_EOL;
     $content .= 'in line ' . $exception->getLine() . PHP_EOL . PHP_EOL;
     $content .= Debugger::getBacktraceCode($exception->getTrace(), false, true) . PHP_EOL;
     if ($exception instanceof Exception) {
         $statusCode = $exception->getStatusCode();
     } else {
         $statusCode = 500;
     }
     $response->setStatus($statusCode);
     $response->setContent($content);
     $response->setHeader('X-Flow-ExceptionCode', $exception->getCode());
     $response->setHeader('X-Flow-ExceptionMessage', $exception->getMessage());
 }
 /**
  * @test
  * @expectedException \Neos\Flow\Http\Client\InfiniteRedirectionException
  */
 public function browserHaltsOnExceedingMaximumRedirections()
 {
     $requestEngine = $this->createMock(Client\RequestEngineInterface::class);
     for ($i = 0; $i <= 10; $i++) {
         $response = new Http\Response();
         $response->setHeader('Location', 'http://localhost/this/willLead/you/knowhere/' . $i);
         $response->setStatus(301);
         $requestEngine->expects($this->at($i))->method('sendRequest')->will($this->returnValue($response));
     }
     $this->browser->setRequestEngine($requestEngine);
     $this->browser->request('http://localhost/some/initialRequest');
 }
 /**
  * Adds an HTTP header to the Response which indicates that the application is powered by Flow.
  *
  * @param Response $response
  * @return void
  */
 protected function addPoweredByHeader(Response $response)
 {
     if ($this->settings['http']['applicationToken'] === 'Off') {
         return;
     }
     $applicationIsFlow = $this->settings['core']['applicationPackageKey'] === 'Neos.Flow';
     if ($this->settings['http']['applicationToken'] === 'ApplicationName') {
         if ($applicationIsFlow) {
             $response->getHeaders()->set('X-Flow-Powered', 'Flow');
         } else {
             $response->getHeaders()->set('X-Flow-Powered', 'Flow ' . $this->settings['core']['applicationName']);
         }
         return;
     }
     /** @var Package $applicationPackage */
     /** @var Package $flowPackage */
     $flowPackage = $this->bootstrap->getEarlyInstance(PackageManagerInterface::class)->getPackage('Neos.Flow');
     $applicationPackage = $this->bootstrap->getEarlyInstance(PackageManagerInterface::class)->getPackage($this->settings['core']['applicationPackageKey']);
     if ($this->settings['http']['applicationToken'] === 'MajorVersion') {
         $flowVersion = $this->renderMajorVersion($flowPackage->getInstalledVersion());
         $applicationVersion = $this->renderMajorVersion($applicationPackage->getInstalledVersion());
     } else {
         $flowVersion = $this->renderMinorVersion($flowPackage->getInstalledVersion());
         $applicationVersion = $this->renderMinorVersion($applicationPackage->getInstalledVersion());
     }
     if ($applicationIsFlow) {
         $response->getHeaders()->set('X-Flow-Powered', 'Flow/' . ($flowVersion ?: 'dev'));
     } else {
         $response->getHeaders()->set('X-Flow-Powered', 'Flow/' . ($flowVersion ?: 'dev') . ' ' . $this->settings['core']['applicationName'] . '/' . ($applicationVersion ?: 'dev'));
     }
 }
 /**
  * @test
  */
 public function handleCallsMakeStandardsCompliantOnTheCurrentResponse()
 {
     $this->mockHttpResponse->expects($this->once())->method('makeStandardsCompliant')->with($this->mockHttpRequest);
     $this->standardsComplianceComponent->handle($this->mockComponentContext);
 }
Beispiel #15
0
 /**
  *  Sets the array based headers into the Response
  *
  * @param Response $response
  * @param $headers
  */
 private function _setHeadersIntoResponse(Response $response, $headers)
 {
     foreach ($headers as $key => $value) {
         $response->getHeaders()->set($key, $value);
     }
 }
 /**
  * Starts the authentication: Send HTTP header
  *
  * @param Request $request The current request
  * @param Response $response The current response
  * @return void
  */
 public function startAuthentication(Request $request, Response $response)
 {
     $response->setStatus(401);
     $response->setHeader('WWW-Authenticate', 'Basic realm="' . (isset($this->options['realm']) ? $this->options['realm'] : sha1(FLOW_PATH_ROOT)) . '"');
     $response->setContent('Authorization required');
 }
 /**
  * Explicitly destroys all session data
  *
  * @param string $reason A reason for destroying the session – used by the LoggingAspect
  * @return void
  * @throws Exception\SessionNotStartedException
  * @api
  */
 public function destroy($reason = null)
 {
     if ($this->started !== true) {
         throw new Exception\SessionNotStartedException('Tried to destroy a session which has not been started yet.', 1351162668);
     }
     if ($this->remote !== true) {
         if (!$this->response->hasCookie($this->sessionCookieName)) {
             $this->response->setCookie($this->sessionCookie);
         }
         $this->sessionCookie->expire();
     }
     $this->removeSessionMetaDataCacheEntry($this->sessionIdentifier);
     $this->storageCache->flushByTag($this->storageIdentifier);
     $this->started = false;
     $this->sessionIdentifier = null;
     $this->storageIdentifier = null;
     $this->tags = [];
     $this->request = null;
 }
 /**
  * Returns the DOM crawler which can be used to interact with the web page
  * structure, submit forms, click links or fetch specific parts of the
  * website's contents.
  *
  * The returned DOM crawler is bound to the response of the last executed
  * request.
  *
  * @return \Symfony\Component\DomCrawler\Crawler
  * @api
  */
 public function getCrawler()
 {
     $crawler = new Crawler(null, $this->lastRequest->getBaseUri());
     $crawler->addContent($this->lastResponse->getContent(), $this->lastResponse->getHeader('Content-Type'));
     return $crawler;
 }
    /**
     * Returns the statically rendered exception message
     *
     * @param integer $statusCode
     * @param string $referenceCode
     * @return string
     */
    protected function renderStatically($statusCode, $referenceCode)
    {
        $statusMessage = Response::getStatusMessageByCode($statusCode);
        $referenceCodeMessage = $referenceCode !== null ? '<p>When contacting the maintainer of this application please mention the following reference code:<br /><br />' . $referenceCode . '</p>' : '';
        return '<!DOCTYPE html>
			<html>
				<head>
					<meta charset="UTF-8">
					<title>' . $statusCode . ' ' . $statusMessage . '</title>
					<style type="text/css">
						body {
							font-family: Helvetica, Arial, sans-serif;
							margin: 0;
						}

						h1 {
							font-size: 15px;
						}

						.ApplicationWindow {
							position: absolute;
							width: 100%;
							height: 100%;
							background-color: #515151;
							margin: 0;
							z-index:1000;
						}

						.FloatingWindow {
							width: 500px;
							height: 360px;
							background-color: none;
							background-image: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAfkAAAFwCAYAAAC7CQL0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r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Ts6QVwmuQxNl6ub6PQru+g6Zny02WJdHm+a4IvTfFiD8BFj3vfNN/1du2LJPq595NvQv7I+vQ5jJrkQ+ZOmo5JP/4hJqsnm4Z9aOCdQgfARQ97afAdEvo0+HHUl4W4b3TQXVfk08DXUejXD1AXIr8I+WX5oYEXdQAu8zSfC31uGX9I2NPbUUr75Kvktok+rjM/RB1+O82uHhD23NH0lekdgEs41behfLR9V/BzWy7sZ86NPzg4aI+Pjzee5HOhX2uS7zVJuEu31cDpXeABuIyhL031bSHepZjnthcCv80knwt9+rV0Ao9j3xXyXNgFHoCrFvpQiPSQLbc6EMYGvi/ycdRLP0gu2F1fK8Vd4AG4CqHPxb4U7dLXsvc7NvBDIp8+SGmybwuxHhJycQfgKsa+6w+Avu9tHPaxke99AsfHx1XPDynoAAh/wbYxL0a3bVsvAQBcQbVfAQCIPAAg8gCAyAMAIg8AiDwAiLxfAQCIPAAg8gDAy/bfAQDpDpA3DxeAjAAAAABJRU5ErkJggg==);
						}

						.FloatingWindow .Window_TitleBar {
							font-size: 13px;
							position: relative;
							padding: 25px 0 0 26px;
							width: 440px;
							text-align: center;
							color: #404040;
						}

						.FloatingWindow .Window_Body {
							font-size: 14px;
							position: relative;
							padding: 30px 0 0 50px;
							width: 400px;
							text-align: left;
							color: #202020;
							line-height: 18px;
						}

						.StandardView_Package {
							width: 70px;
							float: right;
							margin: 0 0 80px 10px;
						}
					</style>

					<!--[if lte IE 7]>
					<style type="text/css">
						.FloatingWindow {
							background-color: #ccc;
							background-image: none;
						}
						.Window_TitleBar {
							background-color:#aaa;
							font-weight:bold;
						}
						.StandardView_Package {
							display:none;
						}
					</style>
					<![endif]-->

				</head>
				<body>
					<div class="ApplicationWindow">
						<div class="FloatingWindow">
							<div class="Window_TitleBar">' . $statusCode . ' ' . $statusMessage . '</div>
							<div class="Window_Body">
								<h1>' . $statusCode . ' ' . $statusMessage . '</h1>
								<p>An internal error occurred.</p>
								' . $referenceCodeMessage . '
							</div>
						</div>
					</div>
				</body>
			</html>';
    }
 /**
  * Prepares a Fluid view for rendering the custom error page.
  *
  * @param object $exception \Exception or \Throwable
  * @param array $renderingOptions Rendering options as defined in the settings
  * @return ViewInterface
  */
 protected function buildView($exception, array $renderingOptions)
 {
     $statusCode = 500;
     $referenceCode = null;
     if ($exception instanceof FlowException) {
         $statusCode = $exception->getStatusCode();
         $referenceCode = $exception->getReferenceCode();
     }
     $statusMessage = Response::getStatusMessageByCode($statusCode);
     $viewClassName = $renderingOptions['viewClassName'];
     /** @var ViewInterface $view */
     $view = $viewClassName::createWithOptions($renderingOptions['viewOptions']);
     $view = $this->applyLegacyViewOptions($view, $renderingOptions);
     $httpRequest = Request::createFromEnvironment();
     $request = new ActionRequest($httpRequest);
     $request->setControllerPackageKey('Neos.Flow');
     $uriBuilder = new UriBuilder();
     $uriBuilder->setRequest($request);
     $view->setControllerContext(new ControllerContext($request, new Response(), new Arguments([]), $uriBuilder));
     if (isset($renderingOptions['variables'])) {
         $view->assignMultiple($renderingOptions['variables']);
     }
     $view->assignMultiple(['exception' => $exception, 'renderingOptions' => $renderingOptions, 'statusCode' => $statusCode, 'statusMessage' => $statusMessage, 'referenceCode' => $referenceCode]);
     return $view;
 }
    /**
     * Returns the statically rendered exception message
     *
     * @param integer $statusCode
     * @param object $exception \Exception or \Throwable
     * @return void
     */
    protected function renderStatically($statusCode, $exception)
    {
        $statusMessage = Response::getStatusMessageByCode($statusCode);
        $exceptionHeader = '';
        while (true) {
            $pathPosition = strpos($exception->getFile(), 'Packages/');
            $filePathAndName = $pathPosition !== false ? substr($exception->getFile(), $pathPosition) : $exception->getFile();
            $exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
            $exceptionMessageParts = $this->splitExceptionMessage($exception->getMessage());
            $exceptionHeader .= '<h2 class="ExceptionSubject">' . $exceptionCodeNumber . htmlspecialchars($exceptionMessageParts['subject']) . '</h2>';
            if ($exceptionMessageParts['body'] !== '') {
                $exceptionHeader .= '<p class="ExceptionBody">' . nl2br(htmlspecialchars($exceptionMessageParts['body'])) . '</p>';
            }
            $exceptionHeader .= '
				<span class="ExceptionProperty">' . get_class($exception) . '</span> thrown in file<br />
				<span class="ExceptionProperty">' . $filePathAndName . '</span> in line
				<span class="ExceptionProperty">' . $exception->getLine() . '</span>.<br />';
            if ($exception instanceof FlowException) {
                $exceptionHeader .= '<span class="ExceptionProperty">Reference code: ' . $exception->getReferenceCode() . '</span><br />';
            }
            if ($exception->getPrevious() === null) {
                break;
            }
            $exceptionHeader .= '<br /><div style="width: 100%; background-color: #515151; color: white; padding: 2px; margin: 0 0 6px 0;">Nested Exception</div>';
            $exception = $exception->getPrevious();
        }
        $backtraceCode = Debugger::getBacktraceCode($exception->getTrace());
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
				"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
			<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
			<head>
				<title>' . $statusCode . ' ' . $statusMessage . '</title>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
				<style>
					.ExceptionSubject {
						margin: 0;
						padding: 0;
						font-size: 15px;
						color: #BE0027;
					}
					.ExceptionBody {
						padding: 10px;
						margin: 10px;
						color: black;
						background: #DDD;
					}
					.ExceptionProperty {
						color: #101010;
					}
					pre {
						margin: 0;
						font-size: 11px;
						color: #515151;
						background-color: #D0D0D0;
						padding-left: 30px;
					}
				</style>
			</head>
			<div style="
					position: absolute;
					left: 10px;
					background-color: #B9B9B9;
					outline: 1px solid #515151;
					color: #515151;
					font-family: Arial, Helvetica, sans-serif;
					font-size: 12px;
					margin: 10px;
					padding: 0;
				">
				<div style="width: 100%; background-color: #515151; color: white; padding: 2px; margin: 0 0 6px 0;">Uncaught Exception in Flow</div>
				<div style="width: 100%; padding: 2px; margin: 0 0 6px 0;">
					' . $exceptionHeader . '
					<br />
					' . $backtraceCode . '
				</div>
			</div>
		';
    }
 /**
  * Sends the given HTTP request
  *
  * @param Http\Request $request
  * @return Http\Response The response or FALSE
  * @api
  * @throws Http\Exception
  * @throws CurlEngineException
  */
 public function sendRequest(Http\Request $request)
 {
     if (!extension_loaded('curl')) {
         throw new Http\Exception('CurlEngine requires the PHP CURL extension to be installed and loaded.', 1346319808);
     }
     $requestUri = $request->getUri();
     $curlHandle = curl_init((string) $requestUri);
     curl_setopt_array($curlHandle, $this->options);
     // Send an empty Expect header in order to avoid chunked data transfer (which we can't handle yet).
     // If we don't set this, cURL will set "Expect: 100-continue" for requests larger than 1024 bytes.
     curl_setopt($curlHandle, CURLOPT_HTTPHEADER, ['Expect:']);
     // If the content is a stream resource, use cURL's INFILE feature to stream it
     $content = $request->getContent();
     if (is_resource($content)) {
         curl_setopt_array($curlHandle, [CURLOPT_INFILE => $content, CURLOPT_INFILESIZE => $request->getHeader('Content-Length')]);
     }
     switch ($request->getMethod()) {
         case 'GET':
             if ($request->getContent()) {
                 // workaround because else the request would implicitly fall into POST:
                 curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'GET');
                 if (!is_resource($content)) {
                     curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $content);
                 }
             }
             break;
         case 'POST':
             curl_setopt($curlHandle, CURLOPT_POST, true);
             if (!is_resource($content)) {
                 $body = $content !== '' ? $content : http_build_query($request->getArguments());
                 curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $body);
             }
             break;
         case 'PUT':
             curl_setopt($curlHandle, CURLOPT_PUT, true);
             if (!is_resource($content) && $content !== '') {
                 $inFileHandler = fopen('php://temp', 'r+');
                 fwrite($inFileHandler, $request->getContent());
                 rewind($inFileHandler);
                 curl_setopt_array($curlHandle, [CURLOPT_INFILE => $inFileHandler, CURLOPT_INFILESIZE => strlen($request->getContent())]);
             }
             break;
         default:
             if (!is_resource($content)) {
                 $body = $content !== '' ? $content : http_build_query($request->getArguments());
                 curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $body);
             }
             curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, $request->getMethod());
     }
     $preparedHeaders = [];
     foreach ($request->getHeaders()->getAll() as $fieldName => $values) {
         foreach ($values as $value) {
             $preparedHeaders[] = $fieldName . ': ' . $value;
         }
     }
     curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $preparedHeaders);
     // curl_setopt($curlHandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP && CURLPROTO_HTTPS);
     // CURLOPT_UPLOAD
     if ($requestUri->getPort() !== null) {
         curl_setopt($curlHandle, CURLOPT_PORT, $requestUri->getPort());
     }
     // CURLOPT_COOKIE
     $curlResult = curl_exec($curlHandle);
     if ($curlResult === false) {
         throw new CurlEngineException(sprintf('cURL reported error code %s with message "%s". Last requested URL was "%s" (%s).', curl_errno($curlHandle), curl_error($curlHandle), curl_getinfo($curlHandle, CURLINFO_EFFECTIVE_URL), $request->getMethod()), 1338906040);
     } elseif (strlen($curlResult) === 0) {
         return false;
     }
     curl_close($curlHandle);
     $response = Http\Response::createFromRaw($curlResult);
     if ($response->getStatusCode() === 100) {
         $response = Http\Response::createFromRaw($response->getContent(), $response);
     }
     return $response;
 }
Beispiel #23
0
 /**
  * Returns the statically rendered exception message
  *
  * @param integer $statusCode
  * @param object $exception \Exception or \Throwable
  * @return void
  */
 protected function renderStatically($statusCode, $exception)
 {
     $statusMessage = Response::getStatusMessageByCode($statusCode);
     $exceptionHeader = '<div class="Flow-Debug-Exception-Header">';
     while (true) {
         $filepaths = Debugger::findProxyAndShortFilePath($exception->getFile());
         $filePathAndName = $filepaths['proxy'] !== '' ? $filepaths['proxy'] : $filepaths['short'];
         $exceptionMessageParts = $this->splitExceptionMessage($exception->getMessage());
         $exceptionHeader .= '<h1 class="ExceptionSubject">' . htmlspecialchars($exceptionMessageParts['subject']) . '</h1>';
         if ($exceptionMessageParts['body'] !== '') {
             $exceptionHeader .= '<p class="ExceptionBody">' . nl2br(htmlspecialchars($exceptionMessageParts['body'])) . '</p>';
         }
         $exceptionHeader .= '<table class="Flow-Debug-Exception-Meta"><tbody>';
         $exceptionHeader .= '<tr><th>Exception Code</th><td class="ExceptionProperty">' . $exception->getCode() . '</td></tr>';
         $exceptionHeader .= '<tr><th>Exception Type</th><td class="ExceptionProperty">' . get_class($exception) . '</td></tr>';
         if ($exception instanceof FlowException) {
             $exceptionHeader .= '<tr><th>Log Reference</th><td class="ExceptionProperty">' . $exception->getReferenceCode() . '</td></tr>';
         }
         $exceptionHeader .= '<tr><th>Thrown in File</th><td class="ExceptionProperty">' . $filePathAndName . '</td></tr>';
         $exceptionHeader .= '<tr><th>Line</th><td class="ExceptionProperty">' . $exception->getLine() . '</td></tr>';
         if ($filepaths['proxy'] !== '') {
             $exceptionHeader .= '<tr><th>Original File</th><td class="ExceptionProperty">' . $filepaths['short'] . '</td></tr>';
         }
         $exceptionHeader .= '</tbody></table>';
         if ($exception->getPrevious() === null) {
             break;
         }
         $exceptionHeader .= '<br /><h2>Nested Exception</h2>';
         $exception = $exception->getPrevious();
     }
     $exceptionHeader .= '</div>';
     $backtraceCode = Debugger::getBacktraceCode($exception->getTrace());
     $footer = '<div class="Flow-Debug-Exception-Footer">';
     $footer .= '<table class="Flow-Debug-Exception-InstanceData"><tbody>';
     if (defined('FLOW_PATH_ROOT')) {
         $footer .= '<tr><th>Instance root</th><td class="ExceptionProperty">' . FLOW_PATH_ROOT . '</td></tr>';
     }
     if (Bootstrap::$staticObjectManager instanceof ObjectManagerInterface) {
         $bootstrap = Bootstrap::$staticObjectManager->get(Bootstrap::class);
         $footer .= '<tr><th>Application Context</th><td class="ExceptionProperty">' . $bootstrap->getContext() . '</td></tr>';
         $footer .= '<tr><th>Request Handler</th><td class="ExceptionProperty">' . get_class($bootstrap->getActiveRequestHandler()) . '</td></tr>';
     }
     $footer .= '</tbody></table>';
     $footer .= '</div>';
     echo sprintf($this->htmlExceptionTemplate, $statusCode . ' ' . $statusMessage, file_get_contents(__DIR__ . '/../../Resources/Public/Error/Exception.css'), $exceptionHeader, $backtraceCode, $footer);
 }
 /**
  * @param string $output
  * @param Runtime $typoScriptRuntime
  * @return string The message body without the message head
  */
 protected function mergeHttpResponseFromOutput($output, Runtime $typoScriptRuntime)
 {
     if (substr($output, 0, 5) === 'HTTP/') {
         $endOfHeader = strpos($output, "\r\n\r\n");
         if ($endOfHeader !== false) {
             $header = substr($output, 0, $endOfHeader + 4);
             try {
                 $renderedResponse = Response::createFromRaw($header);
                 /** @var Response $response */
                 $response = $typoScriptRuntime->getControllerContext()->getResponse();
                 $response->setStatus($renderedResponse->getStatusCode());
                 foreach ($renderedResponse->getHeaders()->getAll() as $headerName => $headerValues) {
                     $response->setHeader($headerName, $headerValues[0]);
                 }
                 $output = substr($output, strlen($header));
             } catch (\InvalidArgumentException $exception) {
             }
         }
     }
     return $output;
 }