error Chunked transfer encoding not supported

Aleksej

Well-Known Member
Feb 25, 2018
62
4
48
38
hello.

i used own php script to connect to PVE. for now auth is ok, but in any post it returns "
Code:
HTTP/1.1 501 chunked transfer encoding not supportedCache-Control: max-age=0Connection: closeDate: Fri, 12 Jan 2024 16:34:33 GMTPragma: no-cacheServer: pve-api-daemon/3.0Expires: Fri, 12 Jan 2024 16:34:33 GMT
"

for example:
PHP:
       curl_setopt($ch, CURLOPT_URL,"https://myhost:8006/api2/json/nodes/ps116/qemu/118/status/stop")
curl_setopt($ch, CURLOPT_HTTPHEADER, ["CSRFPreventionToken: {$mytokenhere}"]);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_COOKIE, "PVEAuthCookie="{$mycookiedata}");
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_exec($ch)

the same request to:
PHP:
 curl_setopt($ch, CURLOPT_URL,"https://myhost:8006/api2/json/access/ticket");
     $pf = 'username='. urlencode($this->username).'@pve&password='.urlencode($this->password);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $pf);
   curl_exec($ch)
works fine... (actually i get token and cookie)

what changed?
not working on PVE 7.4.17 and PVE 8.1.3 after host updates

P.S. there is no errors in script. it was copied from my src and changed like IPs, names,etc. so there can be mistakes)
 
Last edited:
  • Like
Reactions: simplerezo
actually, i don't know what was actualy changed...
after few days of tries i found solution:

i replaced
PHP:
curl_setopt($ch, CURLOPT_POST, 1);
with
PHP:
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

In any case i think, this has to be reviewed by proxmox dev team, as chunked transfer is mandatory of HTTP/1.1
and it's a bit confusing according to RFC2616 https://www.rfc-editor.org/rfc/rfc2616#page-25
 
Last edited:
  • Like
Reactions: simplerezo

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!