Skip to content

Commit

Permalink
Use getTransferInfo().
Browse files Browse the repository at this point in the history
getReturnCode() only returns the result from the first request. If there is
some authenticated request, the first response is a 404. The final response
code from the second request is in the transfer info.
  • Loading branch information
yunosh committed Jan 14, 2015
1 parent fc61e50 commit 7cfcbd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions framework/Http/lib/Horde/Http/Response/Peclhttp2.php
Expand Up @@ -32,15 +32,18 @@ class Horde_Http_Response_Peclhttp2 extends Horde_Http_Response_Base
public function __construct($uri, \http\Client\Response $response)
{
try {
$parent = $response->getParentMessage();
$location = $parent->getHeader('Location');
$this->uri = $location;
} catch (HttpRuntimeException $e) {
$info = $response->getTransferInfo();
} catch (\http\Exception $e) {
throw new Horde_Http_Exception($e);
}
try {
$this->uri = $info->effective_url;
} catch (\http\Exception\RuntimeException $e) {
$this->uri = $uri;
}

$this->httpVersion = $response->getHttpVersion();
$this->code = $response->getResponseCode();
$this->code = $info->response_code;
$this->_response = $response;
$this->_headers = new Horde_Support_CaseInsensitiveArray(
$response->getHeaders()
Expand Down
4 changes: 2 additions & 2 deletions framework/Http/package.xml
Expand Up @@ -28,7 +28,7 @@
</stability>
<license uri="http://www.horde.org/licenses/bsd">BSD-2-Clause</license>
<notes>
*
* [jan] Fix return code from multi-request actions in Peclhttp2 driver.
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -507,7 +507,7 @@
<date>2015-01-08</date>
<license uri="http://www.horde.org/licenses/bsd">BSD-2-Clause</license>
<notes>
*
* [jan] Fix return code from multi-request actions in Peclhttp2 driver.
</notes>
</release>
</changelog>
Expand Down

0 comments on commit 7cfcbd7

Please sign in to comment.