Solved

resume failed download, CFHTTP

Posted on 2007-03-27
10
892 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
Comment Utility
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
Comment Utility

 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
Comment Utility
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
 

Author Comment

by:liewsin
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 39

Expert Comment

by:gdemaria
Comment Utility

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
Comment Utility
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
Comment Utility

 ah, well done!
0
 
LVL 36

Expert Comment

by:SidFishes
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now