/** * Get the regex for matching the domain part of this route. * * @param \Illuminate\Routing\Route $route * @return string */ private function getDomainRegex($route) { ReflectionHelper::invokePrivateMethod($route, 'compileRoute'); $compiledRoute = ReflectionHelper::readPrivateProperty($route, 'compiled'); return $compiledRoute->getHostRegex(); }
private function addInternalDomain(Zend_Controller_Router_Route_Hostname $route) { $parts = ReflectionHelper::readPrivateProperty($route, '_parts'); foreach ($parts as &$part) { if ($part === null) { $part = '[^.]+'; } } $regex = implode('\\.', $parts); $this->domainCollector[] = '/^' . $regex . '$/iu'; }
private function addInternalDomain($route) { $regex = ReflectionHelper::readPrivateProperty($route, 'regex'); $this->domainCollector[] = '/^' . $regex . '$/'; }
protected function clientRequest($method, $uri, array $parameters = array(), array $files = array(), array $server = array(), $content = null, $changeHistory = true) { if ($this instanceof Framework) { if (preg_match('#^(//|https?://(?!localhost))#', $uri)) { $hostname = parse_url($uri, PHP_URL_HOST); if (!$this->isInternalDomain($hostname)) { throw new ExternalUrlException(get_class($this) . " can't open external URL: " . $uri); } } if ($method !== 'GET' && $content === null && !empty($parameters)) { $content = http_build_query($parameters); } } if (!ReflectionHelper::readPrivateProperty($this->client, 'followRedirects')) { $result = $this->client->request($method, $uri, $parameters, $files, $server, $content, $changeHistory); $this->debugResponse($uri); return $result; } else { $maxRedirects = ReflectionHelper::readPrivateProperty($this->client, 'maxRedirects', 'Symfony\\Component\\BrowserKit\\Client'); $this->client->followRedirects(false); $result = $this->client->request($method, $uri, $parameters, $files, $server, $content, $changeHistory); $this->debugResponse($uri); return $this->redirectIfNecessary($result, $maxRedirects, 0); } }
/** * @return string */ private function getApplicationDomainRegex() { $server = ReflectionHelper::readPrivateProperty($this->client, 'server'); $domain = $server['HTTP_HOST']; return '/^' . str_replace('.', '\\.', $domain) . '$/'; }
protected function clientRequest($method, $uri, array $parameters = array(), array $files = array(), array $server = array(), $content = null, $changeHistory = true) { $this->debugSection("Request Headers", $this->headers); foreach ($this->headers as $header => $val) { // moved from REST module if (!$val) { continue; } $header = str_replace('-', '_', strtoupper($header)); $server["HTTP_{$header}"] = $val; // Issue #827 - symfony foundation requires 'CONTENT_TYPE' without HTTP_ if ($this instanceof Framework && $header === 'CONTENT_TYPE') { $server[$header] = $val; } } $server['REQUEST_TIME'] = time(); $server['REQUEST_TIME_FLOAT'] = microtime(true); if ($this instanceof Framework) { if (preg_match('#^(//|https?://(?!localhost))#', $uri)) { $hostname = parse_url($uri, PHP_URL_HOST); if (!$this->isInternalDomain($hostname)) { throw new ExternalUrlException(get_class($this) . " can't open external URL: " . $uri); } } if ($method !== 'GET' && $content === null && !empty($parameters)) { $content = http_build_query($parameters); } } if (!ReflectionHelper::readPrivateProperty($this->client, 'followRedirects')) { $result = $this->client->request($method, $uri, $parameters, $files, $server, $content, $changeHistory); $this->debugResponse($uri); return $result; } $maxRedirects = ReflectionHelper::readPrivateProperty($this->client, 'maxRedirects', 'Symfony\\Component\\BrowserKit\\Client'); $this->client->followRedirects(false); $result = $this->client->request($method, $uri, $parameters, $files, $server, $content, $changeHistory); $this->debugResponse($uri); return $this->redirectIfNecessary($result, $maxRedirects, 0); }
private function addInternalDomain(\Zend\Mvc\Router\Http\Hostname $route) { $regex = ReflectionHelper::readPrivateProperty($route, 'regex'); $this->domainCollector[] = '/^' . $regex . '$/'; }
/** * Returns a list of regex patterns for recognized domain names * * @return array */ public function getInternalDomains() { $domains = [$this->getDomainRegex(Yii::app()->request->getHostInfo())]; if (Yii::app()->urlManager->urlFormat === 'path') { $rules = ReflectionHelper::readPrivateProperty(Yii::app()->urlManager, '_rules'); foreach ($rules as $rule) { if ($rule->hasHostInfo === true) { $domains[] = $this->getDomainRegex($rule->template, $rule->params); } } } return array_unique($domains); }