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

Snap install doesn't allow `Transfer-Encoding: chunked` on PUT. #365

Open
ncw opened this Issue Oct 6, 2017 · 7 comments

Comments

Projects
None yet
6 participants
@ncw
Copy link

ncw commented Oct 6, 2017

Snap install doesn't allow Transfer-Encoding: chunked on PUT.

This does work with an owncloud I have installed manually though, leading me to think that this is a problem with the snap packaging, in particular the webserver config.

For example

Without chunked transfer encoding

$ curl -X PUT --user user:pass --data @file.txt "https://nextcloud.example.com/remote.php/webdav/file.txt"
$ curl -X PROPFIND --user user:pass "https://nextcloud.example.com/remote.php/webdav/file.txt"
[snip]
    <d:getlastmodified>Fri, 06 Oct 2017 14:43:22 GMT</d:getlastmodified>
    <d:getcontentlength>5</d:getcontentlength>  <-------------- length 5
[snip]

And with chunked transfer encoding the upload is truncated to 0 bytes with no warning.

$ curl -X PUT --user user:pass --data @file.txt --header "Transfer-Encoding: chunked" "https://nextcloud.example.com/remote.php/webdav/file.txt"
$ curl -X PROPFIND --user user:pass "https://nextcloud.example.com/remote.php/webdav/file.txt"
[snip]
    <d:getlastmodified>Fri, 06 Oct 2017 14:43:39 GMT</d:getlastmodified>
    <d:getcontentlength>0</d:getcontentlength>  <-------------- length 0!
[snip]

A possibly related problem is discussed in the SabreDav wiki which says

Finder uses Transfer-Encoding: Chunked in PUT request bodies. This is a little used HTTP feature, and therefore not implemented in a bunch of webservers. The only server I've seen so far that handles this reasonably well is Apache + mod_php. Nginx and Lighttpd respond with 411 Length Required, which is completely ignored by Finder. This was seen on nginx 0.7.63. It was recently reported that a development release (1.3.8) no longer had this issue.

When using this with Apache + FastCGI PHP completely drops the request body, so it will seem as if the PUT request was succesful, but the file will end up empty.

Diving down the rat-hole further I find this php bug which points the finger at apache's fast cgi implemention with this bug.

The symptoms of the above seem to be that of using Apache with FastCGI but I'm not sure exactly what is used in the snap. Is it possible to swap to using apache + mod_php?

@kyrofa

This comment has been minimized.

Copy link
Member

kyrofa commented Oct 6, 2017

We were initially using mod_php, but switched to php-fpm a while back for more fine-grained control over performance. I suspect we'll have to wait for those bugs to be fixed ☹️ .

@ncw

This comment has been minimized.

Copy link
Author

ncw commented Oct 6, 2017

That sounds reasonable. It isn't a big deal for me it just means rclone can't stream uploads to nextcloud for the moment.

@gbrault

This comment has been minimized.

Copy link

gbrault commented Apr 22, 2018

Hello there! Do we now if this is fixed now?

@r4co0n

This comment has been minimized.

Copy link
Collaborator

r4co0n commented May 15, 2018

The Apache bug blocking this issue is reported against mod_fcgid, not mod_proxy_fcgi which this snap is using and we will probably wait long for the fix landing, which won't change a thing.

@ncw Can you still reproduce this issue with the current version? How about the edge release channel?

Ha, I think I found the correct bug, it is still open.

@devurandom

This comment has been minimized.

Copy link

devurandom commented Jun 10, 2018

Does anyone know what the current status for php-fpm + nginx / lighttpd is? Are they affected? If not, which version / configuration is necessary for this to work?

@e-alfred

This comment has been minimized.

Copy link

e-alfred commented Aug 10, 2018

Does this only apply to Apache/Nginx + PHP-FPM? Or does it affect mod_php too? If not, the rclone documentation is misleading because this would only affect the Snap package, but not Nextcloud in general (if manually installed for example).

@r4co0n

This comment has been minimized.

Copy link
Collaborator

r4co0n commented Aug 17, 2018

This is an Apache httpd-2 bug.

@kyrofa kyrofa added the upstream label Oct 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.