From 89ac5d0f12aa675a380a93bb165ec43bbc9d1461 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 14 Aug 2010 03:47:22 +0000 Subject: [PATCH] Only a question mark at the end is no valid HTTP request --- inc/functions.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 9f3bf52436..79bb619c29 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -828,20 +828,23 @@ function sendGetRequest ($script, $data = array()) { // Add data $body = http_build_query($data, '', '&'); - // Do we have a question-mark in the script? - if (strpos($script, '?') === false) { - // No, so first char must be question mark - $body = '?' . $body; - } else { - // Ok, add & - $body = '&' . $body; - } + // There should be data, else we don't need to extend $script with $body + if (empty($body)) { + // Do we have a question-mark in the script? + if (strpos($script, '?') === false) { + // No, so first char must be question mark + $body = '?' . $body; + } else { + // Ok, add & + $body = '&' . $body; + } - // Add script data - $script .= $body; + // Add script data + $script .= $body; - // Remove trailed & to make it more conform - if (substr($script, -1, 1) == '&') $script = substr($script, 0, -1); + // Remove trailed & to make it more conform + if (substr($script, -1, 1) == '&') $script = substr($script, 0, -1); + } // END - if // Generate GET request header $request = 'GET /' . trim($script) . ' HTTP/1.1' . getConfig('HTTP_EOL'); -- 2.39.5