Fixed basic auth headers for curl adapter #1048

merged 5 commits into from May 15, 2012


None yet

2 participants

darh commented Apr 14, 2012

Auth info needs to be pushed into curl in a special way

akrabat commented Apr 20, 2012

Can you supply a unit test that shows that this code works please?

darh commented Apr 21, 2012

Well this was kinda useless. I have no idea why auth headers didn't got set so I've added curl_setopt's as I've always did for http-auth. f406054 removes this "fix" + there is also a test for auth-headers if you wish to include it.

@akrabat akrabat commented on the diff May 1, 2012
@@ -313,4 +313,26 @@ public function testHeadRequest()
$this->assertEquals('', $this->client->getResponse()->getBody());
+ public function testAuthorizeHeader()
+ {
+ // We just need someone to talk to
+ $this->client->setUri($this->baseuri. 'testHttpAuth.php');
+ $adapter = new Adapter\Curl();
+ $this->client->setAdapter($adapter);
+ $uid = 'alice';
+ $pwd = 'secret';
+ $hash = base64_encode($uid . ':' . $pwd);
+ $header = 'Authorization: Basic ' . $hash;
akrabat May 1, 2012 Member

What are $hash and $header for?

darh May 1, 2012 Contributor

$hash is (last) part of $header and $header is for assertion in the last line of the test. Good enough?

@akrabat akrabat was assigned May 4, 2012
@akrabat akrabat merged commit f406054 into zendframework:master May 15, 2012
akrabat commented May 15, 2012

Thank you.

In general, you'll find it easier if you do each pull request within it's own branch:

git checkout -b hotfix/my-branch-name
... do the work ...
git commit
git push origin hotfix/my-branch-name

and then issue the pull request from github from your branch to the ZF2 master

See for full details

darh commented May 20, 2012

Thanks for info. Will try and follow the guide nex time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment