Solved

resume failed download, CFHTTP

Posted on 2007-03-27
10
908 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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
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 …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

24 Experts available now in Live!

Get 1:1 Help Now