lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I'm trying to get a JPEG image through an http.request call, but when I look at the body, something in the chain has gone and changed all the 0A bytes to 0D0A, corrupting the image.

Example code:

local http=require"socket.http"

local body, code, headers, status = http.request "";

local file ="corrupt-jpeg.jpg",'w')


You can open the file that outputs to see how it's being corrupted (and you can check that it's line-ending coercion in a hex editor).

Any ideas for how to fix?