Use HTTP_HOST instead of SERVER_NAME to guess hostname

This commit is contained in:
Frederic Guillot 2016-04-23 19:37:39 -04:00
parent d10ac3b818
commit d2d47f332c
2 changed files with 1 additions and 3 deletions

View File

@ -186,8 +186,6 @@ Router\action('subscribe', function () {
} catch (PicoFeed\Client\InvalidCertificateException $e) { } catch (PicoFeed\Client\InvalidCertificateException $e) {
$error_message = t('Invalid SSL certificate.'); $error_message = t('Invalid SSL certificate.');
} catch (PicoFeed\Client\InvalidUrlException $e) { } catch (PicoFeed\Client\InvalidUrlException $e) {
// picoFeed uses this exception for multiple reasons, but doesn't
// provide an exception code to distinguish what exactly happend here
$error_message = $e->getMessage(); $error_message = $e->getMessage();
} catch (PicoFeed\Client\MaxRedirectException $e) { } catch (PicoFeed\Client\MaxRedirectException $e) {
$error_message = t('Maximum number of HTTP redirections exceeded.'); $error_message = t('Maximum number of HTTP redirections exceeded.');

View File

@ -81,7 +81,7 @@ function css()
function get_current_base_url() function get_current_base_url()
{ {
$url = is_secure_connection() ? 'https://' : 'http://'; $url = is_secure_connection() ? 'https://' : 'http://';
$url .= $_SERVER['SERVER_NAME']; $url .= $_SERVER['HTTP_HOST'];
$url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT']; $url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT'];
$url .= str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])) !== '/' ? str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])).'/' : '/'; $url .= str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])) !== '/' ? str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])).'/' : '/';