cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

$this->request->getHttpHost() returns ":"

Open applejohnny opened this issue 13 years ago • 4 comments

var_dump( 
$this->request->getHttpHost(), 
$this->request->getServer('HTTP_HOST'), 
$_SERVER['HTTP_HOST'] 
);

$this->request->getHttpHost() returns ":", but other variants works well. version 0.8

applejohnny avatar Jan 29 '13 14:01 applejohnny

These are the tests for that method: https://github.com/phalcon/cphalcon/blob/0.9.0/php-tests/tests/Phalcon/Http/Request/UnitTest.php#L323

Maybe some of those headers are missing

ghost avatar Jan 30 '13 23:01 ghost

As You can see from this: http://php.net/manual/en/reserved.variables.server.php

$_SERVER['HTTP_SERVER_NAME'] = 'localhost';
$_SERVER['HTTP_SERVER_PORT'] = 80;

There's no such variables in $_SERVER, perhaps you meant:

$_SERVER['SERVER_NAME'] = 'localhost';
$_SERVER['SERVER_PORT'] = 80;

And there is a more suitable variable for this method:

$_SERVER['HTTP_HOST'] = 'localhost:80';

applejohnny avatar Jan 31 '13 03:01 applejohnny

This is now fixed in 0.9.0, thanks for reporting it

ghost avatar Feb 01 '13 20:02 ghost

Phalcon 9.0b2 Description is: "Gets information about schema, host and port used by the request" But It returns host name only, no http_schema , no port.

VeryMad avatar Mar 05 '13 15:03 VeryMad