Copy link to clipboard
Copied
I am using CFHTTP to test for broken links. For some reason all youtube links return 408 Request Time-out error. Simply increasing the timeout value does not make any difference. Some other servers show the same behaviour.
Is there anything I can do to make it correctly detect if the link is OK? Maybe it requires a specific header to be sent with the request?
Here is the function I use:
<cffunction name="checkLink" access="remote" returnType="struct" returnFormat="json" output="no">
<cfargument name="link" type="string">
<cfset ret = structNew()>
<cfhttp url="#link#" method="head" timeout="1">
<cfset ret["code"] = cfhttp.statusCode>
<cfset ret["detail"] = cfhttp.errorDetail>
<cfreturn ret>
</cffunction>
These are some of the links that return the error:
Thank you!
Copy link to clipboard
Copied
I don't know why CFHTTP would get that error, but I would compare the request and response headers from CFHTTP to something else you know works (wget, curl). Because this is encrypted with TLS (HTTPS), you'll need to use a proxy that will let you get access to all the requests and responses. Fiddler will let you do that, and I think you can get a free or trial version still.
https://www.telerik.com/fiddler
If you have to use a trial version, be prepared for nonstop sales calls.
Dave Watts, Eidolon LLC
Find more inspiration, events, and resources on the new Adobe Community
Explore Now