Bug #14916

t3lib_div::getURL() uses cURL only for http protocol

Added by Thorsten Kahler almost 10 years ago. Updated almost 5 years ago.

Status:Closed Start date:2005-08-10
Priority:Should have Due date:
Assigned To:Thorsten Kahler % Done:

0%

Category:- Spent time: -
Target version:-
TYPO3 Version:4.1 Is Regression:
PHP Version:4.3 Sprint Focus:
Complexity:

Description

t3lib_div::getURL($url) checks whether the string parameter $url starts with 'http://'. All URLs not fitting to this pattern are opened by fopen().
IMHO this restriction is not neccessary because cURL [1] is able to handle more than half a dozen protocols.
I appended a patch file as an example. It enables ftp, ftps, http, https, gopher and telnet to be red via cURL. cURL options may be set as TYPO3_CONF_VARS or as an optional second parameter of t3lib_div::getURL().

Are there any reasons not to use cURL for those other protocols?

[1] cURL: http://curl.haxx.se/
[2] cURL-functions of PHP: http://www.php.net/manual/en/ref.curl.php
(issue imported from #M1364)

t3lib_div.patch Magnifier (781 Bytes) Administrator Admin, 2005-08-10 13:55

bug_1364_v2.diff Magnifier (1.9 kB) Administrator Admin, 2007-07-06 18:06

bug_1364_v3.diff Magnifier (2 kB) Administrator Admin, 2007-07-06 18:25


Related issues

related to Core - Bug #16976: t3lib_div::getURL breaks on some options Closed 2007-02-12

History

#1 Updated by Michael Stucki over 9 years ago

I'm going to fix this. Forgive me Karsten ;-)

#2 Updated by Martin Kutschker over 8 years ago

I think so too. And IMHO this can safley be added - after one year - into 4.1RC2. I assume that CURL is stable for all protocols.

#3 Updated by Michael Stucki over 8 years ago

Thorsten or Martin, can one of you please take over?

#4 Updated by Michael Stucki about 8 years ago

Attached is a new version of the patch, made against Trunk @ revision 2377.

Note that other than in the first patch, I didn't remove the three first curl_setopt calls (because Iiii think that this would break the functionality).

Additionally, I have to mention that I can't test the patch right here, so I would be glad if Thorsten will take it over again...

#5 Updated by Michael Stucki about 8 years ago

Forget bug_1364_v2.diff please! It contained a syntax error.

I've fixed this in bug_1364_v3.diff and also modified the $TYPO3_CONF_VARS['SYS']['curl'] parameter to be a string (multiline). This way it can be possible to edit the settings using the install tool (see "setDBinit" property).

Last but not least, I think that the properties "curlUse" and "curl" could be merged into one. But this still needs to be done...

#6 Updated by Michael Stucki almost 8 years ago

Hi Thorsten, can you please test my patch and submit it to the core list, please?

#7 Updated by Ingmar Schlecht over 7 years ago

Stucki sent the reminder by accident to Thorsten Koensgen, it should have been Thorsten Kahler. So Thorsten, can you send the patch, please?

cheers
Ingmar

#8 Updated by Ingo Renner over 7 years ago

coul also be considered to be a featuer

#9 Updated by Martin Kutschker over 7 years ago

Fixed in SVN for http, https, ftp, ftps, sftp and scp. Other protocols like telnet won't work reasonably with getURL().

Also available in: Atom PDF