How do I download a file using mbedTLS? I created a request that looks like this:
"GET /filename HTTP/1.1\r\n" \
"User-Agent: mbed-TLS-2.13.1\r\n" \
"Accept: */*\r\n" \
"Cache-Control: no-cache\r\n" \
"Host: project.hostname.com\r\n" \
"Accept-Encoding: gzip, deflate, br\r\n" \
"Connection: keep-alive\r\n\r\n"
What I got back was:
< Read from server: 555 bytes read
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 174553
Cache-Control: max-age=3600
Content-Encoding: gzip
Content-Type: application/octet-stream
Etag: b78b3fbb0cd2e0f915087f22dc6b55bbf0dbbe2084dc4d3063f662c951812427
Last-Modified: Fri, 24 Jan 2020 18:36:32 GMT
Strict-Transport-Security: max-age=31556926; includeSubDomains; preload
Accept-Ranges: bytes
Date: Tue, 11 Feb 2020 19:39:17 GMT
X-Served-By: cache-pdk17845-PDK
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1581449957.464767,VS0,VE1
Vary: x-fh-requested-host, accept-encoding
My data buffer is 1 MB and I was expecting a file about 260 KB in size. It looks like I all I got was a header, no binary file. Using the Chrome web browser, I can get the file from
https://project.hostname.com/filename
Chrome does ask where I want to put the file. Postman also works just fine with the GET request above and immediately returns the binary file. What am I missing?