From 15b33f67108fcf717fc56fc9cb931f7c22a69737 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 6 Sep 2011 13:49:42 +0000 Subject: [PATCH] useProxy is duplicate, because isProxyUsed() is cached, fixed bug in IP resolver (opps) --- inc/classes/resolver.class.php | 4 +++- inc/http-functions.php | 16 ++++------------ inc/libs/yoomedia_functions.php | 1 + inc/mysql-manager.php | 4 ++-- .../admin/admin_add_config_network_type_form.tpl | 4 ++-- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/inc/classes/resolver.class.php b/inc/classes/resolver.class.php index a09fab364e..47805bde3c 100644 --- a/inc/classes/resolver.class.php +++ b/inc/classes/resolver.class.php @@ -83,6 +83,7 @@ class HostnameResolver { } else { // Get IP address $ip = gethostbyname($hostname); + //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, 'ip=' . $ip . ',hostname=' . $hostname . ' - RESOLVED!'); // Count lookup hit incrementStatsEntry('dns_lookup_hits'); @@ -97,6 +98,7 @@ class HostnameResolver { // Set return value to $ip //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, sprintf("IP detected, cache entry written: %s->%s", $hostname, $ip)); + $ret = $ip; } else { // Network address or broadcast address found //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, sprintf("IP %s is possibly a network or broadcast address.", $ip)); @@ -118,7 +120,7 @@ class HostnameResolver { // Free result SQL_FREERESULT($result); - // Return IP number (let's hope it! + // Return IP number (let's hope it) return $ret; } diff --git a/inc/http-functions.php b/inc/http-functions.php index b657298105..85ae678a45 100644 --- a/inc/http-functions.php +++ b/inc/http-functions.php @@ -308,18 +308,9 @@ function sendRawRequest ($host, $request) { // Initialize array $response = array('', '', ''); - // Default is not to use proxy - $useProxy = false; - // Default is non-broken HTTP server implementation $GLOBALS['is_http_server_broken'] = false; - // Are proxy settins set? - if (isProxyUsed()) { - // Then use it - $useProxy = true; - } // END - if - // Load include loadIncludeOnce('inc/classes/resolver.class.php'); @@ -338,7 +329,7 @@ function sendRawRequest ($host, $request) { $resolver = new HostnameResolver(); // Open connection - if ($useProxy === true) { + if (isProxyUsed() === true) { // Resolve hostname into IP address $ip = $resolver->resolveHostname(compileRawCode(getProxyHost())); @@ -351,6 +342,7 @@ function sendRawRequest ($host, $request) { // Connect to host directly $fp = fsockopen($ip, $port, $errno, $errdesc, 30); } + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ip=' . $ip . ',host=' . $host . ',isProxyUsed()=' . intval(isProxyUsed())); // Is there a link? if (!is_resource($fp)) { @@ -364,7 +356,7 @@ function sendRawRequest ($host, $request) { } // Do we use proxy? - if ($useProxy === true) { + if (isProxyUsed() === true) { // Setup proxy tunnel $response = setupProxyTunnel($host, $port, $fp); @@ -452,7 +444,7 @@ function sendRawRequest ($host, $request) { // No response, maybe timeout $response = array('', '', ''); logDebugMessage(__FUNCTION__, __LINE__, 'Invalid empty response array, maybe timed out?'); - } elseif ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy === true)) { + } elseif ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && (isProxyUsed() === true)) { // Proxy header detected, so remove two lines array_shift($response); array_shift($response); diff --git a/inc/libs/yoomedia_functions.php b/inc/libs/yoomedia_functions.php index f515b525cc..8b317b6406 100644 --- a/inc/libs/yoomedia_functions.php +++ b/inc/libs/yoomedia_functions.php @@ -394,6 +394,7 @@ function YOOMEDIA_GET_ERRORCODE_FROM_RESULT ($response) { $code = bigintval($codeArray[0]); } elseif (!empty($response[0])) { // Merge response together + die('response=
'.print_r($response,true).'
'); $parts = explode('|', implode('', $response)); // If we have only one part, we got an error diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index ebb1aeb436..2b879de773 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1494,8 +1494,8 @@ function generateCategoryOptionsList ($mode) { // Initialize array... $CATS = array( - 'id' => array(), - 'name' => array(), + 'id' => array(), + 'name' => array(), 'userids' => array() ); diff --git a/templates/de/html/admin/admin_add_config_network_type_form.tpl b/templates/de/html/admin/admin_add_config_network_type_form.tpl index 0cb2bb926c..44d54dd609 100644 --- a/templates/de/html/admin/admin_add_config_network_type_form.tpl +++ b/templates/de/html/admin/admin_add_config_network_type_form.tpl @@ -14,8 +14,8 @@ {%template,YesNoSelectionBox=set_all%}
- {--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_MAX_RELOAD_TIME--} ({--TIME_UNIT--})
- $content[network_max_reload_time] ({%pipe,translateTimeUnit=$content[network_type_reload_time_unit]%}) + {--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_MAX_RELOAD_TIME--} ({%pipe,translateTimeUnit=$content[network_type_reload_time_unit]%})
+ $content[network_max_reload_time]
{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_MIN_WAITING_TIME--}
-- 2.39.5