Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAV\Client: Request body missing on PROPFIND after HEAD request #649

Closed
cweiske opened this issue May 6, 2015 · 7 comments
Closed

DAV\Client: Request body missing on PROPFIND after HEAD request #649

cweiske opened this issue May 6, 2015 · 7 comments
Assignees
Labels

Comments

@cweiske
Copy link

cweiske commented May 6, 2015

When using the Sabre\DAV\Client to do a HEAD request, followed by a PROPFIND request, the latter fails because of a missing response body.

Reason for this problem is that the curl settings (including the CURLOPT_NOBODY option) are not cleared/reset between requests.

Test case:

<?php
require 'vendor/autoload.php';
use Sabre\DAV;

$client = new Sabre\DAV\Client(
    array(
        'userName' => 'admin',
        'password' => 'admin',
        'baseUri'  => 'http://wolke.bogo/remote.php/webdav/'
    )
);
//check if file exists
$client->request('HEAD', 'Notes');
//then fetch properties
$res = $client->propFind('Notes', array('{DAV:}resourcetype'), 1);
var_dump($res);
?>

Result:

PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message
 'The body passed to parseMultiStatus could not be parsed. Is it really xml?'

This happens with sabre/dav 2.1.3.

@andreaswolf
Copy link
Contributor

I also experienced this. I could fix it by recreating the cURL instance, but that is probably not the preferred way to do this.

@cweiske
Copy link
Author

cweiske commented May 7, 2015

@andreaswolf: You once fixed it by always setting the CURLOPT_NOBODY option; see andreaswolf@aefe0c9

@andreaswolf
Copy link
Contributor

@cweiske Uh, I did not remember that :D Would have saved me quite a bit of time recently…

@evert
Copy link
Member

evert commented May 7, 2015

uhoh :S so it looks like that fix never got ported to sabre/http when that split happened. Sorry about that

@evert
Copy link
Member

evert commented May 7, 2015

Closed in favor of sabre-io/http#47

@evert evert self-assigned this May 11, 2015
@evert
Copy link
Member

evert commented May 11, 2015

Hey guys, this is now fixed in sabre/http (tagged as 3.0.5) so you should be able to update this. If you could let me know it's not working for you, I will also prepare a full sabre/dav release.

@cweiske
Copy link
Author

cweiske commented May 11, 2015

The new sabre-http version makes it work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants