Solved

resume failed download, CFHTTP

Posted on 2007-03-27
10
940 Views
Last Modified: 2013-12-24
i'm trying to download a huge(i mean really huge, like 60MB) xml from a server to local using CFHTTP. but it failed and message from cf server is:

'The request has exceeded the allowable time limit Tag: cfhttp'.

how can i RESUME the file(broken download previously), instead of re-download it again?

my code:
-------------------------------------
<cfif NOT FileExists(DIRECTORY_XMLData & FILENAME_thisXML)>

<cfhttp
method="Get"
URL="#source_server#"
file="#FILENAME_thisXML#"
path="#DIRECTORY_XMLData#"
timeout="False" />

<cfset XMLPARSE_thisfile = DIRECTORY_XMLData & FILENAME_thisXML>

</cfif>
0
Comment
Question by:liewsin
  • 3
  • 3
  • 2
10 Comments
 
LVL 36

Accepted Solution

by:
SidFishes earned 250 total points
ID: 18799962
afaik , you can't

You can mess with the timeout attribute to prevent the failure. Sounds like one must be set somewhere or it would wait forever without TO.


"Value, in seconds, that is the maximum time the request can take. If the timeout passes without a response, ColdFusion considers the request to have failed.

If the client specifies a timeout in the URL search parameter (for example, ?RequestTime=120) ColdFusion uses the lesser of the URL timeout and the timeout attribute value; this ensures that the request times out before, or at the same time as, the page.

If the URL does not specify a timeout, ColdFusion uses the lesser of the Administrator timeout and the timeout attribute value.

If the timeout is not set in any of these, ColdFusion waits indefinitely for the cfhttp request to process."

http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=part_cfm.htm

0
 
LVL 39

Expert Comment

by:gdemaria
ID: 18799988

 the timeout parameter is not a boolean, it should be the number of seconds for the timeout.   If not specified, it defaults to the setting your CF administrator.

 I suggest setting your  timeout to something big enough and trying again.

 timeout="600"    ... unit is in seconds

 I don't believe there is anyway to continue from your last session
0
 

Author Comment

by:liewsin
ID: 18800857
it's not working and get the same error message. it'll still stopped after the sec set in cf-admin.

the code:
-------------------------------------------
<cfif NOT FileExists(DIRECTORY_XMLData & FILENAME_thisXML)>
      <cfhttp
            method="Get"
            URL="http://www.templatemonster.com/webapi/template_updates.php?from=#DATETIME_update_from#&to=#DATETIME_update_to#"
            file="#FILENAME_thisXML#"
            path="#DIRECTORY_XMLData#" timeout="600" />
</cfif>


cf debugging message:
-------------------------------------------
TOTAL TIME: 120031 ms (same as setting in cf_admin, 120 sec)
STARTUP, PARSING, COMPILING, LOADING, & SHUTDOWN: 79 ms


URL parameters:
-------------------------------------------
download.cfm?requestTime=600&day=3


server setting
-------------------------------------------
Timeout Requests after ( 120 ) in seconds under cf_admin/Server Settings > Settings. And, this option is Checked.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:liewsin
ID: 18808713
and, cause this cf_template's hosted on a shared-hosting server. so, the server's setting for Request Timeout will still be uses, unless they've it un-checked.
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 18808871

this statement seems odd to me:
ColdFusion uses the lesser of the Administrator timeout and the timeout attribute value.

You would think that the attribute would OVERRIDE the admin's setting.  That would make a lot more sense.

If that statement is true, you're best bet is to hope the administrator does not have it set.  Try removing the timeout attribute on the tag and see if that helps.  

Otherwise, according to that statement, you can't go beyond the admin settting !
0
 

Author Comment

by:liewsin
ID: 18812953
ok guys, found the answer. would like 2 share wif u.

"You may receive the error message “The request has exceeded
the allowable time limit” when executing an exceptionally long running template such as the code in Listing 5. To remedy this, you can use the “requesttimeout” attribute of the <CFSETTING>
tag to increase the timeout limit for the template and override the ColdFusion Administrator’s default timeout setting. Just insert the following code at the top of the template:
<CFSETTING REQUESTTIMEOUT = “360”
ENABLECFOUTPUTONLY = “no”>
This will reset the timeout limit for the template to six minutes
(i.e., 360 seconds) and preserve the ColdFusion Administrator’s
default timeout setting for all other templates on the server."


taken from CFDJ Mag.
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 18813355

 ah, well done!
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 24024725
Q: how can i RESUME the file(broken download previously), instead of re-download it again?

A:
you can't (resume dl)

You can mess with the timeout attribute to prevent the failure. (ie: "increase the timeout limit"


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question