[TYPO3-core] RFC: getURL fix for error cases and curl

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Jul 31 17:50:54 CEST 2006

This is a SVN patch request.

When using "curl" with t3lib_div::getURL() and retrieving an URL that
returns an 404, you get the 404 error-page back as "content", instead of
a false that would indicate that there was an error in the transfer.

You can see the problem in "action" in this situation:

- configure a proxy and enable "curl" in the install tool
- Delete all *.zip files in typo3temp
- Go to "Ext.Manager" and to the "Translation handling"
- Select some languages
- "Update from repository"

You will get a couple of "ERR" "Unpacking the language pack failed".
This is because it is trying to unpack the html-error message, you can
see their contents in typo3temp after the errors.

The curl_setopt($ch, CURLOPT_FAILONERROR, 1) addition will make
curl_exec return "false" which is what getURL currently does without
curl on error situations. I am pretty sure this shouldn't break any
existing application, except if we want to get the 404 content back
(which would currently only work with curl anyway).

Future vision/todo:
Make getURL return an array where we can specify more information about
the error cases and not just "false". Or when refactoring for 5.0 this
could be an object that is also able to store the error message.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: getURL-curl-failure.patch
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060731/93a42590/attachment.pot 

More information about the TYPO3-team-core mailing list