Follow redirects?

@return Crawler

@throws \LogicException If request was not a redirect
180879
public function followRedirect()
    {
        if (empty($this->redirect)) {
            throw new \LogicException('The request was not redirected.');
        }

        if (-1 !== $this->maxRedirects) {
            if ($this->redirectCount > $this->maxRedirects) {
                $this->redirectCount = 0;
                throw new \LogicException(sprintf('The maximum number (%d) of redirections was reached.', $this->maxRedirects));
            }
        }

        $request = $this->internalRequest;

        if (\in_array($this->internalResponse->getStatusCode(), [301, 302, 303])) {
            $method = 'GET';
            $files = [];
            $content = null;
        } else {
            $method = $request->getMethod();
            $files = $request->getFiles();
            $content = $request->getContent();
        }

        if ('GET' === strtoupper($method)) {
            // Don't forward parameters for GET request as it should reach the redirection URI
            $parameters = [];
        } else {
            $parameters = $request->getParameters();
        }

        $server = $request->getServer();
        $server = $this->updateServerFromUri($server, $this->redirect);

        $this->isMainRequest = false;

        $response = $this->request($method, $this->redirect, $parameters, $files, $server, $content);

        $this->isMainRequest = true;

        return $response;
    }
389856
public function redirect()
    {
        $state = null;

        if ($this->usesState()) {
            $this->request->session()->put('state', $state = $this->getState());
        }

        return new RedirectResponse($this->getAuthUrl($state));
    }
370361
public function getCrawler()
    {
        if (null === $this->crawler) {
            @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED);
            // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
        }

        return $this->crawler;
    }
1330954
public function redirectToRoute()
    {
        if ($this->getRequest()
                 ->isXmlHttpRequest()) {
            return [
                'redirect' => call_user_func_array(
                    [
                        $this->url(),
                        'fromRoute',
                    ],
                    func_get_args()
                ),
            ];
        }

        return call_user_func_array(
            [
                $this->redirect(),
                'toRoute',
            ],
            func_get_args()
        );
    }
793541
public function redirect()
    {
        $previous = Url::previous(Widget::RETURN_URL_PARAM);

        return !empty($this->redirectUrl) ? $this->controller->redirect($this->redirectUrl)
            : $this->controller->redirect($previous);
    }
821457
public function execute()
    {
        /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
        $resultRedirect = $this->resultRedirectFactory->create();

        $data         = $this->getRequest()->getPostValue();
        $redirectBack = $this->getRequest()->getParam('back', false);

        if ($data) {
            $identifier = $this->getRequest()->getParam('thesaurus_id');
            $model      = $this->thesaurusFactory->create();

            if ($identifier) {
                $model->load($identifier);
                if (!$model->getThesaurusId()) {
                    $this->messageManager->addError(__('This thesaurus no longer exists.'));

                    return $resultRedirect->setPath('*/*/');
                }
            }

            $model->setData($data);
            $storeIds = $this->getRequest()->getParam('stores', null);
            if ($storeIds) {
                $model->setStoreIds($storeIds);
            }

            try {
                $this->thesaurusRepository->save($model);
                $this->messageManager->addSuccess(__('You saved the thesaurus %1.', $model->getName()));
                $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false);

                if ($redirectBack) {
                    return $resultRedirect->setPath('*/*/edit', ['thesaurus_id' => $model->getId()]);
                }

                return $resultRedirect->setPath('*/*/');
            } catch (\Exception $e) {
                $this->messageManager->addError($e->getMessage());
                $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($data);

                $returnParams = [
                    'thesaurus_id' => $this->getRequest()->getParam('thesaurus_id'),
                    'type'         => $this->getRequest()->getParam('type'),
                ];

                return $resultRedirect->setPath('*/*/edit', $returnParams);
            }
        }

        return $resultRedirect->setPath('*/*/');
    }
764710
public function reconnect()
    {
        if (is_callable($this->reconnector)) {
            $this->doctrineConnection = null;

            return call_user_func($this->reconnector, $this);
        }

        throw new LogicException('Lost connection and no reconnector available.');
    }
107400
public function redirectIntended()
    {
        // Make sure we have a route.
        if (is_null($this->route)) {
            throw new \Exception('No route has been provided.  Please use route() to add one.');
        }

        // If this response passed, show the success message.
        if ($this->success) {
            return redirect()
                ->intended($this->route)
                ->with('message', $this->message);
        }

        // If this response failed, show the error message.
        return redirect($this->route)
            ->with('error', $this->message);
    }
304140
protected function crawledBadUrls(): bool
    {
        return collect($this->urlsGroupedByStatusCode)->keys()->filter(function ($statusCode) {
            return ! $this->isSuccessOrRedirect($statusCode);
        })->count() > 0;
    }
165339
protected function getUrlToBeCrawled()
    {
        if (! is_null($this->option('url'))) {
            return $this->option('url');
        }

        if (config('laravel-link-checker.url') != '') {
            return config('laravel-link-checker.url');
        }

        if (config('app.url') != '') {
            return config('app.url');
        }

        throw new Exception('could not determine which url to be crawled.');
    }
1307864
protected function redirectByAction()
    {
        $params = $this->request->getArguments();
        $formAction = $params["formAction"];
        $arguments = array();
        if ($params["storage"]["type"] == "pages") {
            $arguments["layoutIdentifier"] = $this->backendLayoutRepository->findByIdentifier($params["storage"]["elements"]["key"],
                explode(",", $this->extSettings['backendlayout_pids']))->getIdentifier();
        } else {
            $arguments["key"] = $params["storage"]["elements"]["key"];
            $arguments["type"] = $params["storage"]["type"];
        }
        if (key_exists("save", $formAction)) {
            $this->redirect('edit', null, null, $arguments);
        } else {
            if (key_exists("saveAndExit", $formAction)) {
                $this->redirect('list');
            }
        }
    }
113758
public function finishedCrawling()
    {
        if (! $this->crawledBadUrls()) {
            return;
        }

        $urlsGroupedByStatusCode = $this->urlsGroupedByStatusCode;

        $this->mail->send('laravel-link-checker::crawlReport', compact('urlsGroupedByStatusCode'), function ($message) {
            $message->from(config('laravel-link-checker.reporters.mail.from_address'));
            $message->to(config('laravel-link-checker.reporters.mail.to_address'));
            $message->subject(config('laravel-link-checker.reporters.mail.subject'));
        });
    }
243314
private function getRedirectUrlFromRequest()
    {
        $request  = $this->application->getRequest();
        $redirect = $request->getQuery('redirect');
        if ($redirect && $this->urlWhitelisted($redirect)) {
            return $redirect;
        }

        $redirect = $request->getPost('redirect');
        if ($redirect && $this->urlWhitelisted($redirect)) {
            return $redirect;
        }

        return false;
    }
337303
public function withAnyDistance(): self
    {
        if ($this->elements->size() < 3) {
            throw new LogicException;
        }

        $path = clone $this;
        $path->elements = $this
            ->elements
            ->dropEnd(2)
            ->add(
                $this->elements->dropEnd(1)->last()->withAnyDistance()
            )
            ->add($this->elements->last());

        return $path;
    }
415360
public function handleRequest($redirected = false)
	{
    	if ($this->state < self::STATE_HANDLING) {
        	$this->executeHandlers();
        	$this->state = self::STATE_REQUEST;
    	}

    	$authorized = true;

    	if ($this->getRouter()->hasRoute()) {
			if ($this->getRouter()->isRouteAllowed()) {
				// Create a new request
				$this->setRequest(new Request($this, $this->getRouter()->getRoute()));

				// Don't handle the login in case of a redirect
				if ($redirected === false) {
					$this->getRequest()->handleLoginRequest();
				}

				$this->handleUser();

				$authorized = $this->getRequest()->isRouteAuthorized();
				if ($authorized === true) {
					$this->getRequest()->handleController();
					$this->getRequest()->handleRequest();
				}
			} else $this->getResponse()->hardExit(Response::CODE_405);
    	} else $this->getResponse()->hardExit(Response::CODE_404);

    	if ($authorized === true) {
			if ($this->state < self::STATE_DONE) {
				$this->state = self::STATE_DONE;
			}
		} else {
			$this->getRouter()->redirect($authorized);
			$this->handleRequest(true);
		}
    }
24873
public function redirect()
    {
        $this->execute();
        
        if ($this->gatewayUrl) {
            $code = 302;
            $message = $code . " Found";
            
            header("HTTP/1.1 " . $message, true, $code);
            header("Status: " . $message, true, $code);
            header("Location: {$this->gatewayUrl}");
            exit;
        }
    }
1077589
public function finishedCrawling()
    {
        $this->log->info('link checker summary');

        collect($this->urlsGroupedByStatusCode)
            ->each(function ($urls, $statusCode) {
                if ($this->isSuccessOrRedirect($statusCode)) {
                    return;
                }

                $count = count($urls);

                if ($statusCode == static::UNRESPONSIVE_HOST) {
                    $this->log->warning("{$count} url(s) did have unresponsive host(s)");

                    return;
                }

                $this->log->warning("Crawled {$count} url(s) with statuscode {$statusCode}");
            });
    }