java - ERR_INCOMPLETE_CHUNKED_ENCODING on Chrome when providing dynamic image content on HttpResponse -


when providing dynamic image content on http response, faced issue chrome (and chrome) return

net::err_incomplete_chunked_encoding error.

this script:

void downloadimage() {    httpresponse().setheader('cache-control', '');    httpresponse().setheader('pragma', '');    if notempty($media.mimetype)       httpresponse().setheader('content-type', $media.mimetype);    end    httpresponse().setheader('content-disposition', 'inline; filename=' & $media.name);    if $httpresponseoutputstream == null       $httpresponseoutputstream := httpresponse().getoutputstream();    end    copyfiletostream($media.path, $httpresponseoutputstream); } 

so image not displayed in google crome.

the fix flush , close output stream @ end.

void downloadimage() {     ...     $httpresponseoutputstream.flush();     $httpresponseoutputstream.close(); } 


Comments