summaryrefslogtreecommitdiffabout
authorWojciech Polak <polak@gnu.org>2015-07-29 16:07:10 (GMT)
committer Wojciech Polak <polak@gnu.org>2015-07-29 16:07:10 (GMT)
commit016cd65ae72870349b2342d0226cac7294771f50 (patch) (side-by-side diff)
tree464da39284a1c6c43409e0d7cc5aff3a2d7c86ae
parentc01f3a965cc116a7a4aad3c06a802bce49ecf6d9 (diff)
downloadcheetah-016cd65ae72870349b2342d0226cac7294771f50.tar.gz
cheetah-016cd65ae72870349b2342d0226cac7294771f50.tar.bz2
Fix HTTPS fetch handling.HEADmaster
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/lib/http.class.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/frontend/lib/http.class.php b/frontend/lib/http.class.php
index 6fda479..25e74fb 100644
--- a/frontend/lib/http.class.php
+++ b/frontend/lib/http.class.php
@@ -2,7 +2,7 @@
/*
Cheetah News lib/http.class.php
- Copyright (C) 2005, 2006 Wojciech Polak.
+ Copyright (C) 2005, 2006, 2015 Wojciech Polak.
Copyright (C) 2006 The Cheetah News Team.
This program is free software; you can redistribute it and/or modify it
@@ -69,10 +69,16 @@ class Http
switch ($url_parts['scheme'])
{
case 'http':
+ case 'https':
$this->host = $url_parts['host'];
if (!empty ($url_parts['port']))
$this->port = $url_parts['port'];
+ if ($url_parts['scheme'] == 'https') {
+ $this->host = 'ssl://'.$this->host;
+ $this->port = 443;
+ }
+
if ($this->_connect ($fp))
{
$path = (!empty ($url_parts['path']) ? $url_parts['path'] : '')
@@ -87,7 +93,7 @@ class Http
if ($this->maxredirs > $this->_redirectdepth)
{
// only follow redirect if it's on this site, or offsiteok is true
- if (preg_match ("|^http://".preg_quote ($this->host)."|i",
+ if (preg_match ("|^https?://".preg_quote ($this->host)."|i",
$this->_redirectaddr) || $this->offsiteok)
{
/* follow the redirect */
@@ -114,6 +120,8 @@ class Http
function _httprequest ($path, $fp, $url)
{
+ $this->host = str_replace ('ssl://', '', $this->host);
+
$url_parts = parse_url ($url);
if (empty ($path)) $path = '/';
if (empty ($url)) $url = '/';

Return to:

Send suggestions and report system problems to the System administrator.