From 05f2bbfff5c041bc126894e87ea979bd3df6eb25 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 26 Nov 2009 00:44:44 +0000 Subject: [PATCH] Content-Length: 1 caused the slow response... :( --- inc/functions.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index aa691935e1..a7cd723a8d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1766,8 +1766,9 @@ function sendGetRequest ($script, $data = array()) { $request .= 'Accept-Charset: UTF-8,*' . getConfig('HTTP_EOL'); $request .= 'Cache-Control: no-cache' . getConfig('HTTP_EOL'); $request .= 'Content-Type: text/plain' . getConfig('HTTP_EOL'); - $request .= 'Content-Length: '.strlen($body) . getConfig('HTTP_EOL'); - $request .= 'Connection: close' . getConfig('HTTP_EOL') . getConfig('HTTP_EOL'); + $request .= 'Content-Length: 0' . getConfig('HTTP_EOL'); + $request .= 'Connection: close' . getConfig('HTTP_EOL'); + $request .= getConfig('HTTP_EOL'); // Send the raw request $response = sendRawRequest($host, $request); @@ -1798,7 +1799,10 @@ function sendPostRequest ($script, $postData) { $request .= 'User-Agent: ' . getConfig('TITLE') . '/' . getConfig('FULL_VERSION') . getConfig('HTTP_EOL'); $request .= 'Cache-Control: no-cache' . getConfig('HTTP_EOL'); $request .= 'Content-Type: application/x-www-form-urlencoded' . getConfig('HTTP_EOL'); - $request .= 'Connection: close' . getConfig('HTTP_EOL') . getConfig('HTTP_EOL'); + $request .= 'Connection: close' . getConfig('HTTP_EOL'); + $request .= getConfig('HTTP_EOL'); + + // Add body $request .= $body; // Send the raw request @@ -1920,6 +1924,12 @@ function sendRawRequest ($host, $request) { // Close socket fclose($fp); + // Time request if debug-mode is enabled + if (isDebugModeEnabled()) { + // Add debug message... + logDebugMessage(__FUNCTION__, __LINE__, 'Request took ' . (microtime(true) - $start) . ' seconds.'); + } // END - if + // Skip first empty lines $resp = $response; foreach ($resp as $idx => $line) { -- 2.39.2