I'll happily take a nosedive into the source code,...
# lucee
b
I'll happily take a nosedive into the source code, but does anyone know off the off to their head if the
cfhttp
tag, when used with the
file
attribute, writes the downloaded file out to disk as it receives it, as opposed to buffering the entire thing in memory first and then writing it. Imagine, downloading something like an 8 Gig file, etc. You'd want it to be flushed out to disk as it comes in.
👍🏾 1
Taking a look at this, it does not appear to work like I assumed/hoped. Lucee copies all the bytes from the http response into a ByteArrayOutputStream in memory and then copies all the bytes to disk 😕
And based on the largest possible size of an array in Java, that appears to effectively limit cfhttp to downloading binary files larger than 2 GB
When cfhttp is given a
file
attribute, it needs to be streaming the bytes directly to disk and not storing them anywhere. That's just terrible heap management there
Does cfhttp still return the
fileContent
variable even when you have it save the file to disk for you? I would think it unecessary.
Adobe at least got that part right
Now to test and see if they buffer the file in memory or not like Lucee or go straight to disk
Hot dang-- Adobe hit the nail on the head with this one. They stream the file right to disk and the memory graph never budges!
Lucee just chews up all the heap in the world buffering the darn thing.
Props to Adobe for having the right solution here. Looks like it's ticket time for Lucee!
cc/ @dcar7191
I'm quite confused why Lucee spent effort jacking around with non-standard hidden features of the cfhttp tag when all they had to do was make it work like Adobe CF already does!!!
What on earth... 😕
All they had to do was make it so when you specify a file/path attribute, it saves directly to disk which is already how Adobe CF does it.
Kind of makes me wish the TAG was still around so stuff like this would caught before time and effort was invested into the wrong solution.
b
@bdw429s - thanks for the in-depth analysis - very useful!
👍 2