New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored Phalcon\Http\Request #11921

merged 7 commits into from Jun 26, 2016


None yet
1 participant

sergeyklay commented Jun 23, 2016

  • Now Request::getHttpHost always return host name or empty string
  • Optionally Request::getHttpHost can validate and clean host name
  • Added Request::getPort. To get information about the port on which the request is made
  • Added Request::setStrictHostCheck and Request::isStrictHostCheck to manage strict validation of host name
  • Updated Phalcon\Http\RequestInterface

Request::getHttpHost trying to find host name in following order:


Note: validation and cleaning has a negative performance impact because they uses regular expressions.

use Phalcon\Http\Request;

$request = new Request;

$request->getHttpHost(); //

$request->getHttpHost(); //

$request->getHttpHost(); // throws UnexpectedValueException

// The Request::_strictHostCheck is still true
$request->getHttpHost(); //

$request->getHttpHost(); //

Fixes #2573

sergeyklay added some commits Jun 23, 2016

@sergeyklay sergeyklay changed the title from Refactored Phalcon\Http\Request::getHttpHost to Refactored Phalcon\Http\Request Jun 24, 2016

sergeyklay added some commits Jun 24, 2016

@sergeyklay sergeyklay merged commit 2de3c2a into phalcon:2.1.x Jun 26, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment