Title:
Add a "Content-Length: 0" header when returning a "204 No Content" response
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Evagoras Charalambous / Evagoras Charalambous (Evagoras Charalambous)
Created: 09/20/2016
Components: Language, Application Framework
Versions: 2016
Failure Type: Enhancement Request
Found In Build/Fixed In Build: CF2016_Update2 / 302165
Priority/Frequency: Major / All users will encounter
Locale/System: ALL / Win 2012 Server x64
Vote Count: 0
Problem Description: When returning a "204" HTTP status, all content is stripped out from the response, but no header "Content-Length: 0" is added. This causes the header "Transfer-Encoding ?chunked" to be added (possibly through web servers like IIS). The problem with this, is that some proxies and load balancers expect content to come through when they see the "chunked" header, and therefore get confused. They may extend one such request into the next one, making a mess of things and possibly end up returning 500s.
Steps to Reproduce:
create this index.cfm page:
<cfscript>
cfheader( name="Content-Type", value="application/json" );
cfheader( statuscode="204", statustext="No Content" );
writeoutput( '{"key": "value"}' );
</cfscript>
Actual Result:
The body contains no content, and the headers are:
Content-Type ?application/json;charset=UTF-8
Date ?Tue, 20 Sep 2016 08:45:31 GMT
Server ?Microsoft-IIS/8.5
Transfer-Encoding ?chunked
Expected Result:
No body content and the headers to be:
Content-Type ?application/json;charset=UTF-8
Date ?Tue, 20 Sep 2016 08:45:31 GMT
Server ?Microsoft-IIS/8.5
Content-Length ?0
Any Workarounds:
Add the header "Content-Length: 0" manually.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4190974
External Customer Info:
External Company:
External Customer Name: Evagoras Charalambous
External Customer Email:
External Test Config: My Hardware and Environment details:
IIS on Windows 2012 x64 Server, using ACF2016 Update 2, and using a ZXTM load balancer.
Attachments:
Comments: