Skip to content

Commit 803dc30

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 3dc96b7 commit 803dc30

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
@@ -165,10 +165,11 @@ private function action ($action_path, $http_method, $put_post_parameters = null
165165
// Lets decide what type of action we are taking...
166166
switch ($http_method) {
167167
case "GET":
168-
// Set "POST" data - cURL will translate this into the appropriate
169-
// querystring so we don't have to worry about it.
168+
// cURL used to translate POSTFIELDS into the query string when the
169+
// request method was GET, but that doesn't seem to be the case any
170+
// longer, so we need to build them into the query string ourselves.
170171
$action_postfields_string = http_build_query($put_post_parameters);
171-
curl_setopt($prox_ch, CURLOPT_POSTFIELDS, $action_postfields_string);
172+
$action_path .= (strpos($action_path, '?') === FALSE ? '?' : '&') . $action_postfields_string;
172173
unset($action_postfields_string);
173174

174175
break;

0 commit comments

Comments
 (0)