Bug #20770
closed[t3lib_div::getURL][curl] CURLOPT_HTTPAUTH missing
0%
Description
When using a basic authentication (Apache) on site curl won't get the content because of missing CURLOPT_HTTPAUTH/CURLOPT_USERPWD setopts.
I have attached a patch of t3lib_div which requires a "curl" user with a password generated from data "curl" hashed with the "encryptionKey" (see getURL). I don't know if this is very handy.
(issue imported from #M11559)
Files
Updated by Marcus Krause over 15 years ago
The general idea is nice. However, username and password being hardcoded isn't handy at all and this patch won't make it to TYPO3 Core as such.
Updated by Philipp Gampe over 13 years ago
- Target version deleted (
0)
I think t3lib_http_request handles this as well.
This should be set to feedback for a month and then be closed.
Updated by Thorsten Kahler over 13 years ago
- Status changed from New to Needs Feedback
- Assignee set to Amar Bouchibane
- Priority changed from Should have to Could have
- TYPO3 Version changed from 4.2 to 4.6
- Complexity set to hard
Hi Amar, could you please give some more details on this issue? Perhaps you could also provide the patch as unified diff?
Updated by Amar Bouchibane over 13 years ago
Hi Thorsten,
I had (and still have) turned into a portal where Apaches' Basic Authentication is activated. My site uses the "mnogosearch" extension (and thus the "pagepath" extension).
I can still reproduce the problem when I change and then save one record in the TYPO3 BE that has to be indexed.
The mnogosearch extension calls (via tx_mnogosearch_tcemain::processDatamap_afterDatabaseOperations) the tx_pagepath_api::getPagePath method. Within this method t3lib_div::getURL will be called. When I debug the code, I notice that the return value of getURL (= curl_exec) is always FALSE:
When I use the "$report" in getURL, I get back this array:
$report : array (
error: 22,
message: "The requested URL returned error: 401",
lib: "CURL)
The two lines I've added (which worked then on a simple HTTP server without proxy) were these:
modified t3lib_div::getURL:
--------------------------
...
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
// Added: Amar --- begin
curl_setopt($ch, CURLOPT_USERPWD, 'curl:'.hash_hmac('md5', 'curl', $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']));
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
// Added: Amar --- end
// May fail (PHP 5.2.0 + and 5.1.5 +) when open_basedir or safe_mode are enabled
$followLocation = @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
...
On the other hand the "Retrieve/Update" in the ExtManager although uses getURL(), but works perfectly... even with a "curlProxyServer".
Anyway my workaround doesn't work for me anymore (in TYPO3 4.4.7). I got to admit that I use SSL and a curl-Proxy now.
But it worked for me at that time with a simple HTTP-Server without a curl-Proxy.
Updated by Alexander Opitz about 11 years ago
Hi,
as this issue is very old. Does the problem still exists within newer versions of TYPO3 CMS (6.1)?
Updated by Alexander Opitz almost 11 years ago
- Status changed from Needs Feedback to Closed
- Assignee deleted (
Amar Bouchibane) - Is Regression set to No
No feedback within the last 90 days => closing this ticket.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.