Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Commit

Permalink
Make sure only the host and scheme are used when using HTTP Requests
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Feb 4, 2015
1 parent 51c912e commit 6f3838b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
</exclude>
</whitelist>
</filter>
</phpunit>
</phpunit>
11 changes: 8 additions & 3 deletions src/Phpro/EncodingCom/Factory/RouteAssemblerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,18 @@ public function createService(ServiceLocatorInterface $serviceLocator)
*/
protected function parseUri($serviceLocator, $localTunnelConfig)
{
$endpoint = null;
$request = $serviceLocator->get('Request');
$uri = ($request instanceof HttpRequest) ? $request->getUri() : new HttpUri();

if ($request instanceof HttpRequest) {
$uri = $request->getUri();
$endpoint = $uri->getScheme().'://'.$uri->getHost();
}

if ($localTunnelConfig->isEnabled()) {
$uri = new HttpUri('http://'.$localTunnelConfig->getHost());
$endpoint = 'http://'.$localTunnelConfig->getHost();
}

return $uri;
return new HttpUri($endpoint);
}
}

0 comments on commit 6f3838b

Please sign in to comment.