EOL for HTTP request moved to config, errno and err_desc initialized (was absend)
authorRoland Häder <roland@mxchange.org>
Sat, 6 Jun 2009 21:23:41 +0000 (21:23 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 6 Jun 2009 21:23:41 +0000 (21:23 +0000)
inc/databases.php
inc/functions.php

index d8ebad0b6f17f8d7ff6927cabb4f8523f47ffeac..ff3555e01e1c2a1b86b4dd921cea58af2731309f 100644 (file)
@@ -107,6 +107,9 @@ setConfigEntry('_ADD', (getConfig('_PRIME') * getConfig('_PRIME') / (pi() * getC
 // Random number for e.g. the "cache-buster" used in OpenX script
 define('CACHE_BUSTER', mt_rand(1000000, 9999999));
 
 // Random number for e.g. the "cache-buster" used in OpenX script
 define('CACHE_BUSTER', mt_rand(1000000, 9999999));
 
+// HTTP-EOL
+setConfigEntry('HTTP_EOL', "\r\n");
+
 // CFG: DEBUG-SQL (if enabled and DEBUG_MODE is enabled all SQL queries will be logged to debug.log)
 setConfigEntry('DEBUG_SQL', 'N');
 
 // CFG: DEBUG-SQL (if enabled and DEBUG_MODE is enabled all SQL queries will be logged to debug.log)
 setConfigEntry('DEBUG_SQL', 'N');
 
index b69c8142dab1f2786ffe7652d49de2327bdbe18f..637412fc66ae8626244eebb5df5c42150225fc59 100644 (file)
@@ -1753,17 +1753,17 @@ function sendGetRequest ($script) {
        $host = extractHostnameFromUrl($script);
 
        // Generate GET request header
        $host = extractHostnameFromUrl($script);
 
        // Generate GET request header
-       $request  = "GET /" . trim($script) . " HTTP/1.1\r\n";
-       $request .= "Host: " . $host . "\r\n";
-       $request .= "Referer: " . constant('URL') . "/admin.php\r\n";
+       $request  = "GET /" . trim($script) . " HTTP/1.1" . getConfig('HTTP_EOL');
+       $request .= "Host: " . $host . getConfig('HTTP_EOL');
+       $request .= "Referer: " . constant('URL') . "/admin.php" . getConfig('HTTP_EOL');
        if (defined('FULL_VERSION')) {
        if (defined('FULL_VERSION')) {
-               $request .= "User-Agent: " . constant('TITLE') . '/' . constant('FULL_VERSION') . "\r\n";
+               $request .= "User-Agent: " . constant('TITLE') . '/' . constant('FULL_VERSION') . getConfig('HTTP_EOL');
        } else {
        } else {
-               $request .= "User-Agent: " . constant('TITLE') . "/?.?.?\r\n";
+               $request .= "User-Agent: " . constant('TITLE') . "/?.?.?" . getConfig('HTTP_EOL');
        }
        }
-       $request .= "Content-Type: text/plain\r\n";
-       $request .= "Cache-Control: no-cache\r\n";
-       $request .= "Connection: Close\r\n\r\n";
+       $request .= "Content-Type: text/plain" . getConfig('HTTP_EOL');
+       $request .= "Cache-Control: no-cache" . getConfig('HTTP_EOL');
+       $request .= "Connection: Close" . getConfig('HTTP_EOL') . getConfig('HTTP_EOL');
 
        // Send the raw request
        $response = sendRawRequest($host, $request);
 
        // Send the raw request
        $response = sendRawRequest($host, $request);
@@ -1791,14 +1791,14 @@ function sendPostRequest ($script, $postData) {
        $data = http_build_query($postData, '','&');
 
        // Generate POST request header
        $data = http_build_query($postData, '','&');
 
        // Generate POST request header
-       $request  = "POST /" . trim($script) . " HTTP/1.1\r\n";
-       $request .= "Host: " . $host . "\r\n";
-       $request .= "Referer: " . constant('URL') . "/admin.php\r\n";
-       $request .= "User-Agent: " . constant('TITLE') . '/' . constant('FULL_VERSION') . "\r\n";
-       $request .= "Content-type: application/x-www-form-urlencoded\r\n";
-       $request .= "Content-length: " . strlen($data) . "\r\n";
-       $request .= "Cache-Control: no-cache\r\n";
-       $request .= "Connection: Close\r\n\r\n";
+       $request  = "POST /" . trim($script) . " HTTP/1.1" . getConfig('HTTP_EOL');
+       $request .= "Host: " . $host . getConfig('HTTP_EOL');
+       $request .= "Referer: " . constant('URL') . "/admin.php" . getConfig('HTTP_EOL');
+       $request .= "User-Agent: " . constant('TITLE') . '/' . constant('FULL_VERSION') . getConfig('HTTP_EOL');
+       $request .= "Content-type: application/x-www-form-urlencoded" . getConfig('HTTP_EOL');
+       $request .= "Content-length: " . strlen($data) . getConfig('HTTP_EOL');
+       $request .= "Cache-Control: no-cache" . getConfig('HTTP_EOL');
+       $request .= "Connection: Close" . getConfig('HTTP_EOL') . getConfig('HTTP_EOL');
        $request .= $data;
 
        // Send the raw request
        $request .= $data;
 
        // Send the raw request
@@ -1810,6 +1810,9 @@ function sendPostRequest ($script, $postData) {
 
 // Sends a raw request to another host
 function sendRawRequest ($host, $request) {
 
 // Sends a raw request to another host
 function sendRawRequest ($host, $request) {
+       // Init errno and errdesc with 'all fine' values
+       $errno = 0; $errdesc = '';
+
        // Initialize array
        $response = array('', '', '');
 
        // Initialize array
        $response = array('', '', '');
 
@@ -1839,18 +1842,18 @@ function sendRawRequest ($host, $request) {
        // Do we use proxy?
        if ($useProxy) {
                // Generate CONNECT request header
        // Do we use proxy?
        if ($useProxy) {
                // Generate CONNECT request header
-               $proxyTunnel  = "CONNECT ".$host.":80 HTTP/1.1\r\n";
-               $proxyTunnel .= "Host: ".$host."\r\n";
+               $proxyTunnel  = "CONNECT " . $host . ":80 HTTP/1.1" . getConfig('HTTP_EOL');
+               $proxyTunnel .= "Host: " . $host . getConfig('HTTP_EOL');
 
                // Use login data to proxy? (username at least!)
                if (getConfig('proxy_username') != '') {
                        // Add it as well
                        $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).getConfig('ENCRYPT_SEPERATOR').COMPILE_CODE(getConfig('proxy_password')));
 
                // Use login data to proxy? (username at least!)
                if (getConfig('proxy_username') != '') {
                        // Add it as well
                        $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).getConfig('ENCRYPT_SEPERATOR').COMPILE_CODE(getConfig('proxy_password')));
-                       $proxyTunnel .= "Proxy-Authorization: Basic ".$encodedAuth."\r\n";
+                       $proxyTunnel .= "Proxy-Authorization: Basic " . $encodedAuth . getConfig('HTTP_EOL');
                } // END - if
 
                // Add last new-line
                } // END - if
 
                // Add last new-line
-               $proxyTunnel .= "\r\n";
+               $proxyTunnel .= getConfig('HTTP_EOL');
                //* DEBUG: */ print("<strong>proxyTunnel=</strong><pre>".$proxyTunnel."</pre>");
 
                // Write request
                //* DEBUG: */ print("<strong>proxyTunnel=</strong><pre>".$proxyTunnel."</pre>");
 
                // Write request