Skip to content

Commit 1a434ff

Browse files
committed
Fix cURL GET parameter passing
Addresses GitHub issue #8 - cURL appears to not (or at least to no longer) actually support turning POSTFIELDS into query string parameters, so we have to build the query string ourselves. This update does just that. Signed-off-by: Daniel Hunsaker <[email protected]>
1 parent 765bfbe commit 1a434ff

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pve2_api.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@ private function action ($action_path, $http_method, $put_post_parameters = null
176176
// Lets decide what type of action we are taking...
177177
switch ($http_method) {
178178
case "GET":
179-
// Set "POST" data - cURL will translate this into the appropriate
180-
// querystring so we don't have to worry about it.
179+
// cURL used to translate POSTFIELDS into the query string when the
180+
// request method was GET, but that doesn't seem to be the case any
181+
// longer, so we need to build them into the query string ourselves.
181182
$action_postfields_string = http_build_query($put_post_parameters);
182-
curl_setopt($prox_ch, CURLOPT_POSTFIELDS, $action_postfields_string);
183+
$action_path .= (strpos($action_path, '?') === FALSE ? '?' : '&') . $action_postfields_string;
183184
unset($action_postfields_string);
184185

185186
break;

0 commit comments

Comments
 (0)