Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

trouble writing a script for download

New Here ,
Jul 10, 2009 Jul 10, 2009

hello,

I am fairly new to Coldfusion and I need help. I recently wrote some code attaches to a button to let user download some soundfiles. The hosting company complaint that this page sometime runs for a long time (like a minute or longer). I think I am using some pretty standard techniques and have no idea of what's wrong, could someone help me to identify the problem?  Here are the codes:

(... codes to cfset shortsf and sf ...)

<cfoutput>
<cfheader name="content-disposition" value="attachment;filename=#shortsf#">
<cfcontent type="audio/x-ms-wma" file="#sf#">
</cfoutput>

Any help is much appreciated.

Kitling Cheung.

629
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 10, 2009 Jul 10, 2009

Ask the host for as much information as possible about the page requests that took a long time.  Then try to duplicate what happened.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2009 Jul 10, 2009

If your user is downloading the audio file and playing it at the same time, your download may last nearly as long as the file takes to play.  What's going on here is this:  the media player reads a block of data from the connection to the server, plays it, and reads the next block in time to play it. (In TCP parlance, this is called sliding-window flow control.)  It causes the server connection to stay open, and the server thread to remain dedicated to it, as the audio file trickles into your user's media player. CF will time out these connections automatically.

You can try overriding the page timeout by putting this cfsetting tag near the top of the cfm that delivers the audio file:

    <cfsetting requesttimeout="SECONDS" />

But, your hosting provider may not appreciate this trick because you're tying up a CF thread and user HTTP / TCP / IP connection.  Lots of people who deliver audio files use free server software like Apache directly.

Also, if your user is on a slow connection it may take a while to download.  The same remedy may help you.  Good luck.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2009 Jul 10, 2009

from a knowledge base article http://kb2.adobe.com/cps/194/tn_19438.html it said cfcontent will ignore the RequestTimeOut parameter of cfresetting tag. But even if there is no such restriction, there should be a default value set by the Administrator anyway for this, right? The fact that the page takes a long time to run indicates that it ignores this setting from the Administrator.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2009 Jul 10, 2009
LATEST

Right you are: the requesttimeout isn't going to take effect until cfcontent finishes.

There's a logging setting in the cf administrator UI - It looks like this in my system:

  Log slow pages taking longer than        


To help diagnose potential problems or bottlenecks in your site, you can have ColdFusion log the names of any pages that take longer than a specified length of time to return. When enabled, any output will be written to the "server.log".

I bet your hosting provider has this set to 60 seconds; and I bet you they're reading the server.log file to know to complain to you about the problem.  I know my server team does when my pages run slow.

If you rename your page to "deliver-audio-I-already-know-this-page-is-slow-so-you-dont-need-to-warn-me.cfm"  maybe they'll stop complaining to you.  But you probably should have a conversation with their support tech in any case.  They can do some configuration things to make your web site, and the others they're hosting, work better.

But the bottom line is that some or all user media players are going to stream (trickle) your audio file, so this long-running page is inherent in what you're trying to do.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources