Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
JWaldecker committed Oct 16, 2016
1 parent 0c5a051 commit b62b24d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Recomended installation is using [Composer], if you do not have [Composer] what
In the root of your project execute the following:

```sh
$ composer require lumaserv/proxmoxve ~4.0.2
$ composer require lumaserv/proxmoxve ~4.0.3
```

Or add this to your `composer.json` file:

```json
{
"require": {
"lumaserv/proxmoxve": "~4.0.2"
"lumaserv/proxmoxve": "~4.0.3"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["Proxmox", "API", "KVM", "OpenVZ", "Virtualization"],
"homepage": "https://github.com/LUMASERV/ProxmoxVE",
"license": "MIT",
"version": "v4.0.2",
"version": "v4.0.3",

"authors": [
{
Expand Down
20 changes: 13 additions & 7 deletions src/Proxmox.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace ProxmoxVE;

use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Cookie\SetCookie;
use ProxmoxVE\Exception\MalformedCredentialsException;
use ProxmoxVE\Exception\AuthenticationException;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -101,9 +103,13 @@ private function requestResource($actionPath, $params = [], $method = 'GET')
{
$url = $this->getApiUrl() . $actionPath;

$cookies = [
'PVEAuthCookie' => $this->authToken->getTicket(),
];
$jar = CookieJar::fromArray([
'PVEAuthCookie' => $this->authToken->getTicket()
], null);

// $cookies = [
// 'PVEAuthCookie' => $this->authToken->getTicket(),
// ];

if ($method != 'GET') {
$headers = [
Expand All @@ -117,15 +123,15 @@ private function requestResource($actionPath, $params = [], $method = 'GET')
return $this->httpClient->get($url, [
'verify' => false,
'exceptions' => false,
'cookies' => $cookies,
'cookies' => $jar,
'query' => $params,
]);
break;
case 'POST':
return $this->httpClient->post($url, [
'verify' => false,
'exceptions' => false,
'cookies' => $cookies,
'cookies' => $jar,
'headers' => $headers,
'form_params' => $params,
]);
Expand All @@ -134,7 +140,7 @@ private function requestResource($actionPath, $params = [], $method = 'GET')
return $this->httpClient->put($url, [
'verify' => false,
'exceptions' => false,
'cookies' => $cookies,
'cookies' => $jar,
'headers' => $headers,
'form_params' => $params,
]);
Expand All @@ -143,7 +149,7 @@ private function requestResource($actionPath, $params = [], $method = 'GET')
return $this->httpClient->delete($url, [
'verify' => false,
'exceptions' => false,
'cookies' => $cookies,
'cookies' => $jar,
'headers' => $headers,
'form_params' => $params,
]);
Expand Down

0 comments on commit b62b24d

Please sign in to comment.