CFHTTP Handling of Multipart Response No Longer Working as Expected

I recently installed Lucee ( 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, Lucee no longer handles the multipart content in the same way.

It looks like the handling of multipart responses has been broken since 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 (working as expected):

Here is the output of my test in (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 multipart/parallel content.

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/ 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.


    <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""'>
            type='multipart/parallel; boundary="d45184e13358b5f2f76c9b5b33000fe1"; charset=utf-8'>

	<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" 
				encodeUrl = false

            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">


        <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")>
1 Like

bug filed [LDEV-3545] Multipart http response doesn't handle quoted boundary - Lucee

1 Like

I added a patch for this issue [LDEV-3545] Multipart http response doesn't handle quoted boundary - Lucee