1

I use cURL 7.50.3, with SSL to download an xml file on my application :

/usr/local/bin/curl  -v -E /home/file.crt.pem --key /home/file.key.pem "https://www.myWebSite.com/file?type=interrogation&nom=10280502_20180905208.XML&doc=reponses&societeId=10000" --output /tmp/RESULT.XML

File download ends without error, file content is correct (correct data, correct xml format...) but is truncated. If I try to access same URL and download same file with chrome or with postman, I'm able to get the entire file.

Unfortunately I cannot share the xml file as it contains personal informations.

I tried with huge files that takes several minuts to download, and some small files that are downloaded in a second.

Here the cURL output for small files:

 [5 bytes data]  
< HTTP/1.1 200 OK  
< Date: Mon, 01 Oct 2018 14:35:09 GMT  
< Set-Cookie: JSESSIONID=3ADE96F2...; Path=/; Secure; HttpOnly  
<
< Content-Disposition: attachment; filename=10280502_20180905208_RESULTATS.XML  
< Content-Type:
< text/xml;charset=utf-8  
< Content-Length: 5626406 
< Vary: Accept-Encoding  
<    0 5494k    0     0    0     0      0      0
     --:--:-- --:--:-- --:--:--     0{ [5 bytes data] 
< 100 5494k  100 5494k    0     0  5208k      0  0:00:01  0:00:01
 --:--:-- 5213k
< Connection #0 to host www.myWebSite.com left intact

For this one I get a 5.6Mo file but I should get a 11.9Mo.

For huge files I got a message :

{ [5 bytes data]
 89 3432k   89 3069k    0     0   103k      0  0:00:33  0:00:29  0:00:04     0* TLSv1.2 (IN), TLS alert, Client hello (1):
{ [2 bytes data]
 89 3432k   89 3069k    0     0   100k      0  0:00:34  0:00:30  0:00:04     0* transfer closed with 371709 bytes remaining to read
 89 3432k   89 3069k    0     0   100k      0  0:00:34  0:00:30  0:00:04     0
* Closing connection 0
} [5 bytes data]
* TLSv1.2 (OUT), TLS alert, Client hello (1):
} [2 bytes data]
curl: (18) transfer closed with 371709 bytes remaining to read

Any idea about what I'm doing wrong? Thx!

Edit : Adding --ignore-content-length seems to solve the problem but I cannot understand why. And anyway still don't understand why this is working with navigator and postman, unless they both use this option by default

Lempkin
  • 1,458
  • 2
  • 26
  • 49

0 Answers0