Broken content type
13 July 2007 00:07 (EST)
I’ve got an odd problem with CFMX server (at least version 7.0.1) recently — it looks like DateFormat function reset content type to text/html despite use of cfcontent tag for defining different mime type before.
See few short examples below:
Suddenly script returns text/html mime type instead of application/rss+xml as well as code below:
But following script does return correct (application/rss+xml) mime type:
Same happens with TimeFormat function. Is there anything specific around these functions? Can someone test last two examples with their CF instances?
See few short examples below:
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/rss+xml; charset=utf-8">
<cfoutput><?xml version="1.0" encoding="utf-8"?>
<date>#dateformat(now())#</date>
</cfoutput>
<cfcontent type="application/rss+xml; charset=utf-8">
<cfoutput><?xml version="1.0" encoding="utf-8"?>
<date>#dateformat(now())#</date>
</cfoutput>
Suddenly script returns text/html mime type instead of application/rss+xml as well as code below:
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/rss+xml; charset=utf-8">
<cfset xmldate = dateformat(now()) />
<cfoutput><?xml version="1.0" encoding="utf-8"?>
<date>#xmldate#</date>
</cfoutput>
<cfcontent type="application/rss+xml; charset=utf-8">
<cfset xmldate = dateformat(now()) />
<cfoutput><?xml version="1.0" encoding="utf-8"?>
<date>#xmldate#</date>
</cfoutput>
But following script does return correct (application/rss+xml) mime type:
<cfsetting enablecfoutputonly="true">
<cfset xmldate = dateformat(now()) />
<cfcontent type="application/rss+xml; charset=utf-8">
<cfoutput><?xml version="1.0" encoding="utf-8"?>
<date>#xmldate#</date>
</cfoutput>
<cfset xmldate = dateformat(now()) />
<cfcontent type="application/rss+xml; charset=utf-8">
<cfoutput><?xml version="1.0" encoding="utf-8"?>
<date>#xmldate#</date>
</cfoutput>
Same happens with TimeFormat function. Is there anything specific around these functions? Can someone test last two examples with their CF instances?
← Melbourne CFUG (July): Previous
Discussion (2 comments)