? ? Success

User tests: Successful: Unsuccessful:

avatar bembelimen
bembelimen
29 Apr 2016

Summary of Changes

At the moments it's not possible to connect to urls, which has a htaccess password protection. With this patch, you can provide login credentials

Testing Instructions

  1. Protect a url with a htaccess password
  2. call: (set the correct url instead of "http://your-url.tld")
$options = new \Joomla\Registry\Registry();

$http = JHttpFactory::getHttp($options);

$url = 'http://your-url.tld';
$result = $http->get($url);

print_r($result);
  1. The result code should be "401"
  2. Apply path
  3. call: (replace htaccessuser + htaccesspassword with your credentials + set the correct url)
$credentials = array('userauth' => 'htaccessuser', 'passwordauth' => 'htaccesspassword');
$options = new \Joomla\Registry\Registry($credentials);

$http = JHttpFactory::getHttp($options);

$url = 'http://your-url.tld';
$result = $http->get($url);

print_r($result);
  1. The result code should be "200"
avatar bembelimen bembelimen - open - 29 Apr 2016
avatar bembelimen bembelimen - change - 29 Apr 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 29 Apr 2016
Labels Added: ?
avatar bembelimen
bembelimen - comment - 29 Apr 2016

@andrepereiradasilva you're right. Thanks

avatar brianteeman brianteeman - change - 29 Apr 2016
Category Libraries
avatar andrepereiradasilva
andrepereiradasilva - comment - 29 Apr 2016

beside basic HTTP Auth, can this also be available also for other HTTP Auth methods?

https://curl.haxx.se/libcurl/c/CURLOPT_HTTPAUTH.html

https://tools.ietf.org/html/rfc7235

avatar bembelimen
bembelimen - comment - 29 Apr 2016

Hello,

it should be possible, but the other transport has to support it, too (I guess). First I had a parameter for such a case, but I wasn't sure about stream/socket, so I removed it for this PR (perhaps add it later)

avatar andrepereiradasilva
andrepereiradasilva - comment - 29 Apr 2016

ok. for another PR then.
I will test this when i have time.

avatar mbabker
mbabker - comment - 29 Apr 2016

If the transport doesn't support it, it doesn't support it. Sockets don't support (AFAIK) specifying a certificate file to verify SSL against, the others do and we have options for that.

avatar bembelimen
bembelimen - comment - 29 Apr 2016

OK, for the next PR :)

avatar andrepereiradasilva andrepereiradasilva - test_item - 29 Apr 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 29 Apr 2016

I have tested this item :white_check_mark: successfully on ddab83c

Tested with success with the 3 possible transport methods.

$options = new \Joomla\Registry\Registry(array('userauth' => 'user', 'passwordauth' => 'password'));
$url = 'http://domain.tld/auth/a.txt'; // this file contents is "abc". The "auth" dir is protected by HTTP Basic Auth

print_r(JHttpFactory::getHttp($options, 'curl')->get($url));
print_r(JHttpFactory::getHttp($options, 'socket')->get($url));
print_r(JHttpFactory::getHttp($options, 'stream')->get($url));

Results:

JHttpResponse Object
(
    [code] => 200
    [headers] => [...]
    [body] => abc
)
JHttpResponse Object
(
    [code] => 200
    [headers] => [...]
    [body] => abc
)
JHttpResponse Object
(
    [code] => 200
    [headers] => [...]
    [body] => abc
)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10128.

avatar chmst chmst - test_item - 30 Apr 2016 - Tested successfully
avatar chmst
chmst - comment - 30 Apr 2016

I have tested this item :white_check_mark: successfully on ddab83c

I have testet this successfully, following the testing instructions.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10128.

avatar brianteeman brianteeman - change - 30 Apr 2016
Status Pending Ready to Commit
avatar brianteeman
brianteeman - comment - 30 Apr 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10128.

avatar joomla-cms-bot joomla-cms-bot - change - 30 Apr 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 1 May 2016
Milestone Added:
Labels
avatar rdeutz rdeutz - change - 2 May 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-05-02 06:38:06
Closed_By rdeutz
Labels
avatar rdeutz rdeutz - close - 2 May 2016
avatar rdeutz rdeutz - merge - 2 May 2016
avatar joomla-cms-bot joomla-cms-bot - close - 2 May 2016
avatar brianteeman brianteeman - close - 2 May 2016
avatar joomla-cms-bot joomla-cms-bot - change - 2 May 2016
Labels Removed: ?
avatar brianteeman brianteeman - change - 9 May 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment