I recently installed Lucee (126.96.36.199) for the first time and wrote some code that made a CFHTTP call to a 3rd party API that returned multiple JPG images in parallel with a
multipart/parallel content type. Lucee did much of the hard work and returned the file content of the cfhttp response as an array of structures containing the headers and binary data for each of the multipart content parts. After updating to Lucee 188.8.131.52-RC, Lucee no longer handles the multipart content in the same way.
It looks like the handling of multipart responses has been broken since 184.108.40.206 and I believe it is related to the resolution of issue LDEV-1723.
I created a simple test to show the difference between releases.
Here is the output of my test in 220.127.116.11 (working as expected):
Here is the output of my test in 18.104.22.168 (not working as expected):
Below is the code for a CFC with two methods. The first is for serving a test set of images with the
multipart/parallel content type. It serves a binary file (with three JPG images) that I created by hand, since I don’t know how to have Lucee build the
The second method is for downloading the multipart data from the first method, displaying the results, and saving the images contained in the response.
I have attached the MultiPartParallelResponseSmall.bin file used by my code.
MultiPartParallelResponseSmall.bin (3.9 KB)
It looks like the changes to
core/src/main/java/lucee/runtime/tag/Http.java may have caused this issue due to the changes in LDEV-1723. I tried searching for a way to debug the Java myself, but I couldn’t find any easy to follow instructions on how to do so.
Any help on this issue would be greatly appreciated as I don’t want to have to rewrite my code to work around this issue if it will be fixed in a future release.
<cfcomponent> <cffunction name="serveMultipart" access="remote" output="true" returntype="any"> <cfset var CurrentDirectory = getDirectoryFromPath(getCurrentTemplatePath())> <cfset var MultiPartParallelFileName = "MultiPartParallelResponseSmall.bin"> <cfset var MultiPartParallelFilePath = CurrentDirectory & MultiPartParallelFileName> <cfheader name="content-disposition" value='filename=""multipartData""'> <cfcontent file="#MultiPartParallelFilePath#" type='multipart/parallel; boundary="d45184e13358b5f2f76c9b5b33000fe1"; charset=utf-8'> </cffunction> <cffunction name="downloadMultipart" access="remote" output="true"> <cfcontent type="text/html"> <cfset var httpUrl = cgi.SERVER_NAME & cgi.SCRIPT_NAME & "?method=serveMultipart"> <cfhttp result="oHTTPResult" method="GET" encodeUrl = false url="#httpUrl#"> </cfhttp> <cfdump var="#server.coldfusion.productName & ' ' & (server.lucee.version ?: 'unknown lucee version')#" label="Lucee Version"> <cfdump var="#oHTTPResult.responseheader['Content-Type']#" label="oHTTPResult.responseheader.Content-Type"> <cfdump var="#oHTTPResult.Mimetype#" label="oHTTPResult.Mimetype"> <cfdump var="#oHTTPResult.filecontent.getClass().getName()#" label="oHTTPResult.filecontent Java Class"> <cfdump var="#arrayLen(oHTTPResult.filecontent)#" label="oHTTPResult.filecontent array length"> <cfdump var="#oHTTPResult.filecontent#" label="oHTTPResult.filecontent"> <br><br> <cfdump var="#oHTTPResult#" label="oHttpResult"> <cfset var CurrentDirectory = getDirectoryFromPath(getCurrentTemplatePath())> <cfloop array="#oHttpResult.fileContent#" index="element"> <cfset var photoId = element.headers["Object-ID"]> <cfset var filePath = "#CurrentDirectory#SavedImage#photoId#.jpg"> <cfset fileWrite(filePath, element.content, "iso-8859-1")> </cfloop> </cffunction> </cfcomponent>