I am running Curl command on bash script and it is working perfectly, but the same command when I use in Perl is failing with the error below -
Error -
lb_update o/p: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>
Command -
curl -H "Content-Type:application/json" -H "Authorization: Bearer $authtoken" -X PUT "https://management.azure.com/subscriptions/<subscription-ID>/resourceGroups/<resource-group>/providers/Microsoft.Network/loadBalancers/<load-balancer>?api-version=$apiversion" -d @output.json
Perl command -
$lb_update=`curl -H "Content-Type:application/json" -H "Authorization: Bearer $authtoken" -X PUT "https://management.azure.com/subscriptions/<subscription-ID>/resourceGroups/<resource-group>/providers/Microsoft.Network/loadBalancers/<load-balancer>?api-version=$apiversion" -d @output.json';
I tried to modify the Perl command with the following parameter, but that did not help. -H "Content-Length:0" and --ignore-content-length
I am new to posting questions on these forums, please bear with me for any mistakes