HTTP Response Content-Length is "Correct" for binary file, but the actual response is wrong/too small

c0ldshadow

Well-Known Member
#1
Hi Guys,

First, this may be a bug in my C++ code, not a litespeed issue=) However, I want to make sure I am not missing anything because I have a feeling it could be something with my LS configuration causing me to not understand something

I have a C++ program that downloads a binary file over HTTPS on my Litespeed server. I have "compression" disabled on this vhost using https://www.litespeedtech.com/suppo...g:gzip-compression-enable-globally-disable-vh so I would think that means HTTP Response should be raw, not compressed or anything similar.

The HTTP Response I get is as follows:

Code:
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
content-type: application/octet-stream
last-modified: Thu, 24 Mar 2022 19:57:38 GMT
etag: "435400-623ccd32-218955b77ea082a1;;;"
accept-ranges: bytes
content-length: 4412416
date: Fri, 25 Mar 2022 02:52:49 GMT
server: LiteSpeed
alt-svc: h3=":443"; ma=2592000, h3-29=":443"; ma=2592000, h3-Q050=":443"; ma=2592000, h3-Q046=":443"; ma=2592000, h3-Q043=":443"; ma=2592000, quic=":443"; ma=2592000; v="43,46"

MZ...wrong binary data here... only 100K size or so...?
The "Content-Length" of 4412416 is correct though... that is the size of my binary file... I would "expect" the MZ data section to continue on with 4412416 bytes for the entire file..

The HTTP request is HTTP/1.1 and only has User-Agent and Host header, nothing else.

Are there any other options I should set in LSWS to make sure I am getting the raw HTTP response, not a compressed one? Want to make sure the LSWS config is correct for what I am doing.
Is there some other header I need to set in the GET request?

Thanks for any feedback.
Note: the code works correctly for "text-based" HTTP responses, only running into this problem with binary file

Best Regards,

-Avery
 

Pong

Administrator
Staff member
#2
How did you run the binary with LSWS? Just a file downable? What do you mean "MZ data section to continue "? Do you have an example URL for such file?
 
Top