Two requests using FolderSync (FolderSync uploads files twice) #21486

kayrus opened this Issue Jan 6, 2016 · 6 comments


None yet

7 participants

kayrus commented Jan 6, 2016

ownCloud 8.2.1 (stable) + nginx + fastcgi (with the following config: + fastcgi_buffering off;

I'm not sure to whom is it related but it seems like to ownCloud core, not to FolderSync.

The problem is that FolderSync tries to use cookies which were acquired by authentication. But for some reason these cookies are not valid.

As a result we receive following behavior: - - [06/Jan/2016:14:04:58 +0100] "PUT /remote.php/webdav/big.file.tacitpart HTTP/1.1" 401 278 "-" "android-cloud-api - Android 4.4.2" - user [06/Jan/2016:14:05:03 +0100] "PUT /remote.php/webdav/big.file.tacitpart HTTP/1.1" 201 25 "-" "android-cloud-api - Android 4.4.2"

Here is how I see its behavior (thanks tcpdump and HTTPS proxy):

  • At the very first request (not logs above) FolderSync tries to make a request with the old cookie and without "Authorization" header.

  • < ownCloud responds that credentials are invalid and set new "oc_sessionPassphrase" and "ocjutnjgekvm" cookies.
  • FolderSync saves this cookie and next request contains "Authorization" header.

  • < ownCloud responds with the non-error code.
  • FolderSync tries to make new request without "Authorization" header but with "oc_sessionPassphrase" and "ocjutnjgekvm" cookies.

  • < ownCloud responds with the 401 error code.
  • FolderSync tries to make next request with the "Authorization" header and so on...

As a result when you have 500Mb file it is uploaded twice. That takes extra time and traffic.

I'm not sure whether this behavior (using cookies instead of auth) is correct.

P.S. Probably relates to #18568 and #19969

guruz commented Jan 6, 2016

Very probably related: owncloud/client#4326 (comment)

kayrus commented Jan 6, 2016

@guruz is there any workaround available? I mean workaround for the server side, not client side.

PVince81 commented Jan 7, 2016

Looks like there is a fix here #21491 in case you want to help testing @kayrus

kayrus commented Jan 7, 2016

@PVince81 looks like I don't have "apps/dav/" directory in my ownCloud 8.2.1 installation...

PVince81 commented Jan 7, 2016

Ah sorry, the Webdav code has moved on master and changed slightly so the patch is unlikely to apply.

@kayrus kayrus added a commit to endocode/core that referenced this issue Jan 8, 2016
@kayrus kayrus Fixed double file upload on failed auth using WebDAV
  Backport of this fix: owncloud#21491
  Fixes owncloud#21486
@MorrisJobke MorrisJobke added this to the 9.0-current milestone Jan 20, 2016

I have owncloud 9.0.0 and using FolderSync It seems I still have this issue. Is it possible? If not, what could be the cause?

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