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

CURLOPT_INFILESIZE curl header option #153

Closed
ovidiul opened this issue Sep 29, 2020 · 3 comments
Closed

CURLOPT_INFILESIZE curl header option #153

ovidiul opened this issue Sep 29, 2020 · 3 comments

Comments

@ovidiul
Copy link

ovidiul commented Sep 29, 2020

Hi there. We've recently encountered a problem in connecting the sabre dav client with an owncloud server, it seems that when we pass the body of Request as a php stream resource, the CURLOPT_INFILE is being set in this file

https://github.com/sabre-io/http/blob/master/lib/Client.php

$settings[CURLOPT_PUT] = true;
$settings[CURLOPT_INFILE] = $request->getBody();

but the CURLOPT_INFILESIZE is not added to it, the result being that the uploaded file has 0 bytes in size.

If i add the missing code as:

$file_stats = fstat($settings[CURLOPT_INFILE]);
if( isset($file_stats['size']) ) {
  $settings[CURLOPT_INFILESIZE] = $file_stats['size'];
}

then the upload works ok. It works however if we set the target webdav server to yandex for instance, i am guessing they do not process the CURLOPT_INFILESIZE header.

Would you consider implementing this option or accepting a pull request? Thank you

@phil-davis
Copy link
Contributor

@ovidiul does the codde merged in #175 work for you?

@ovidiul
Copy link
Author

ovidiul commented Nov 3, 2021

@ovidiul does the codde merged in #175 work for you?

Seems to work well on my part, thanks for adding the fixes @phil-davis .

@phil-davis
Copy link
Contributor

Good. I will close this issue. I will make a release when I have finished sorting out the GitHub workflow CI changes for each of the repos...

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

Successfully merging a pull request may close this issue.

2 participants