Refactored Phalcon\Http\Request #11921

merged 7 commits into from Jun 26, 2016


None yet

1 participant

sergeyklay commented Jun 23, 2016 edited
  • 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 Fixed Request::getHttpHost 70c52df
@sergeyklay sergeyklay Cleanup Route::handle 8caab8a
@sergeyklay sergeyklay Amended Request::getHttpHost tests 5fb8b49
@sergeyklay sergeyklay Added Request::getPort 44b0839
@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 Added Request::setStrictHostCheck and Request::isStrictHostCheck 6e4fa5b
@sergeyklay sergeyklay Updated Phalcon\Http\RequestIterface a41077f
@sergeyklay sergeyklay Ameded Request tests 0affdb4
@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