error Chunked transfer encoding not supported

Aleksej

Well-Known Member
Feb 25, 2018
62
4
48
39
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
Hello,

I'm also getting error "HTTP/1.1 501 chunked transfer encoding not supported" for writing client using boost::beast library , below is request type.

http::request<json_body> req{http::verb::post, target, 11};

For other opensource URL same code is working fine.
can you please give any suggestion for this?

Thanks
-Digambar