]> git.wh0rd.org - tt-rss.git/commitdiff
Merge branch 'master' of binfalse/tt-rss into master
authorfox <fox+git@fakecake.org>
Thu, 18 Jan 2018 12:40:24 +0000 (12:40 +0000)
committerGogs <gogs@fake.local>
Thu, 18 Jan 2018 12:40:24 +0000 (12:40 +0000)
include/functions.php

index 649b77881024b42eedb3eaa17fbb74cb75cdb4a9..dfa78a8ace9c6ad599c79a48e0506ffdbe63e11c 100644 (file)
                                curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null");
                        }
 
-                       if (defined('_CURL_HTTP_PROXY')) {
-                               curl_setopt($ch, CURLOPT_PROXY, _CURL_HTTP_PROXY);
+                       if (defined('_HTTP_PROXY')) {
+                               curl_setopt($ch, CURLOPT_PROXY, _HTTP_PROXY);
                        }
 
                        if ($post_query) {
 
                        // TODO: should this support POST requests or not? idk
 
+                        $context_options = array(
+                                 'http' => array(
+                                               'method' => 'GET',
+                                           'ignore_errors' => true,
+                                           'timeout' => $timeout ? $timeout : FILE_FETCH_TIMEOUT,
+                                               'protocol_version'=> 1.1)
+                                 );
+
                        if (!$post_query && $last_modified) {
-                                $context = stream_context_create(array(
-                                         'http' => array(
-                                                       'method' => 'GET',
-                                                   'ignore_errors' => true,
-                                                   'timeout' => $timeout ? $timeout : FILE_FETCH_TIMEOUT,
-                                                       'protocol_version'=> 1.1,
-                                                       'header' => "If-Modified-Since: $last_modified\r\n")
-                                         ));
-                       } else {
-                                $context = stream_context_create(array(
-                                         'http' => array(
-                                                       'method' => 'GET',
-                                                   'ignore_errors' => true,
-                                                   'timeout' => $timeout ? $timeout : FILE_FETCH_TIMEOUT,
-                                                       'protocol_version'=> 1.1
-                                         )));
+                $context_options['http']['header'] = "If-Modified-Since: $last_modified\r\n";
                        }
 
+                       if (defined('_HTTP_PROXY')) {
+                               $context_options['http']['request_fulluri'] = true;
+                               $context_options['http']['proxy'] = _HTTP_PROXY;
+                       }
+
+            $context = stream_context_create($context_options);
+
                        $old_error = error_get_last();
 
                        $data = @file_get_contents($url, false, $context);