aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
2 2
3/* 3/*
4 Cheetah News lib/http.class.php 4 Cheetah News lib/http.class.php
5 Copyright (C) 2005, 2006 Wojciech Polak. 5 Copyright (C) 2005, 2006, 2015 Wojciech Polak.
6 Copyright (C) 2006 The Cheetah News Team. 6 Copyright (C) 2006 The Cheetah News Team.
7 7
8 This program is free software; you can redistribute it and/or modify it 8 This program is free software; you can redistribute it and/or modify it
@@ -69,10 +69,16 @@ class Http
69 switch ($url_parts['scheme']) 69 switch ($url_parts['scheme'])
70 { 70 {
71 case 'http': 71 case 'http':
72 case 'https':
72 $this->host = $url_parts['host']; 73 $this->host = $url_parts['host'];
73 if (!empty ($url_parts['port'])) 74 if (!empty ($url_parts['port']))
74 $this->port = $url_parts['port']; 75 $this->port = $url_parts['port'];
75 76
77 if ($url_parts['scheme'] == 'https') {
78 $this->host = 'ssl://'.$this->host;
79 $this->port = 443;
80 }
81
76 if ($this->_connect ($fp)) 82 if ($this->_connect ($fp))
77 { 83 {
78 $path = (!empty ($url_parts['path']) ? $url_parts['path'] : '') 84 $path = (!empty ($url_parts['path']) ? $url_parts['path'] : '')
@@ -87,7 +93,7 @@ class Http
87 if ($this->maxredirs > $this->_redirectdepth) 93 if ($this->maxredirs > $this->_redirectdepth)
88 { 94 {
89 // only follow redirect if it's on this site, or offsiteok is true 95 // only follow redirect if it's on this site, or offsiteok is true
90 if (preg_match ("|^http://".preg_quote ($this->host)."|i", 96 if (preg_match ("|^https?://".preg_quote ($this->host)."|i",
91 $this->_redirectaddr) || $this->offsiteok) 97 $this->_redirectaddr) || $this->offsiteok)
92 { 98 {
93 /* follow the redirect */ 99 /* follow the redirect */
@@ -114,6 +120,8 @@ class Http
114 120
115 function _httprequest ($path, $fp, $url) 121 function _httprequest ($path, $fp, $url)
116 { 122 {
123 $this->host = str_replace ('ssl://', '', $this->host);
124
117 $url_parts = parse_url ($url); 125 $url_parts = parse_url ($url);
118 if (empty ($path)) $path = '/'; 126 if (empty ($path)) $path = '/';
119 if (empty ($url)) $url = '/'; 127 if (empty ($url)) $url = '/';

Return to:

Send suggestions and report system problems to the System administrator.