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

Downloads fail when Transfer-Encoding = chunked #113

Closed
josh4trunks opened this issue Jul 9, 2016 · 54 comments
Closed

Downloads fail when Transfer-Encoding = chunked #113

josh4trunks opened this issue Jul 9, 2016 · 54 comments
Labels
bug needs info Waiting for info from user(s). Issues with this label will auto-stale. stale

Comments

@josh4trunks
Copy link

Actual behaviour

  • Download failed - Download of test.txt could not be completed

Expected behaviour

  • File should be downloaded successfully

Steps to reproduce

  1. Setup server environment where files will be served with Transfer-Encoding = chunked
  2. Try downloading file using android app

Environment data

Nextcloud app version:
1.1.0

This bug is also present is the ownCloud android app. owncloud/android#1128
The fix seems to be discussed breifly there, though I don't see any commits referenced.

@tobiasKaminsky
Copy link
Member

Can you help me and and explain where and what to set in the server environment to reproduce this behaviour?

@josh4trunks
Copy link
Author

In my case chunking happens because I have Varnish in front of my nginx webserver compressing text files with gzip. I don't know how to reproduce this directly but maybe people in the owncloud bug know. possibly by enabling gzip chunked is used?

@tobiasKaminsky
Copy link
Member

I thought it is a supported server option...
With this I doubt that we can support this.

@josh4trunks
Copy link
Author

I believe there is a way to have chunked encoding without gzip enabled. It is part of the HTTP/1.1 specification.
But we can just wait till this is fixed in the ownCloud android client and apply the same changes.

@johnwmail
Copy link

Can you help me and and explain where and what to set in the server environment to reproduce this behaviour?

Hi, OpenBSD's httpd is enable/force chunked encoding by default.

@johnwmail
Copy link

I still have this problem, how to solve it.
Any workaround?

@josh4trunks
Copy link
Author

In my environment, where this problem was caused by some type of incompatibility with Varnish, I was able to get this working by setting beresp.do_stream = false whenever I enable gzip for content-type = text/application.

Maybe you can check what Varnish is doing wrong/weird with do_stream

@johnwmail
Copy link

So, still no fix on client side?

@mario
Copy link
Contributor

mario commented Mar 22, 2017

Does this happens only on 3/4g or also on wifi?

@mario
Copy link
Contributor

mario commented Mar 22, 2017

Also, can you inspect the headers and tell me what does it says for content-size?

@johnwmail
Copy link

Yes, both 3/4g and wifi also have this problem.

I don't know how to inspect the header, this is https, tcpdump not work, I will try to Google it later

Thanks

@johnwmail
Copy link

Hello, any idea how to fix it?

@tobiasKaminsky
Copy link
Member

@josh4trunks can you send us also credentials for a test account to android at nextcloud dot com?
Then I can have a look, but as oC also does not have a solution, I am unsure if we can do it...

@johnwmail
Copy link

@tobiasKaminsky I would also setup test account (with Transfer-Encoding = chunked) for this.
But I do not want to post login/password here, would you send email to me?

johnw.mail at gmail dot com

Thanks.

@josh4trunks
Copy link
Author

@tobiasKaminsky I already fixed this in my production environment. See #113 (comment)

Did you still want an account on my working Nextcloud install?

@tobiasKaminsky
Copy link
Member

Ahh, I overread that you have solved it and that is (more or less) a server/environment side problem.
So I will close this.

@mario
Copy link
Contributor

mario commented May 16, 2017 via email

@johnwmail
Copy link

@mario agree, this should be solved client side as well.
I tried talk to OpenBSD people,

http://marc.info/?l=openbsd-misc&m=149422158413997&w=2

They quoted RFC7230

"A recipient MUST be able to parse and decode the chunked transfer coding."

I would like to setup nextcloud AC with "chunked transfer coding" enabled.

Email me, if people who want/need the AC to debug/testing

johnw dot mail at gmail dot com

Thanks.

@johnwmail
Copy link

@tobiasKaminsky
Copy link
Member

tobiasKaminsky commented Jun 21, 2017

edit: to warm here...searching for httpclient "Chunked Transfer Encoding" gives enough :-)

https://stackoverflow.com/questions/6124233/how-to-handle-read-the-response-with-transfer-encodingchunked

@tdm4
Copy link

tdm4 commented Aug 3, 2017

Having the same problem here. Using nginx instead of httpd for now (on OpenBSD) with chunked_transfer_encoding off;
Not ideal, but it works. Android client breaks RFC7230 unfortunately. :(

@johnwmail
Copy link

Hi @tdm4

I written a dirty hack to disable chunked_transfer_encoding for OpenBSD httpd,
Maybe you will interesting

http://marc.info/?l=openbsd-misc&m=149422389314402&w=2

@rpcameron
Copy link

Is there any activity on this, or are the Nextcloud devs going to wait on Owncloud to fix this since the download function/code seems to be in their Android library code?

Until this issue is resolved, I cannot use either client. Yes, I see the patch for OpenBSD httpd, but I'm not going to modify my system software to fix a bug that exists in other third-party software because the third-party software is broken and doesn't properly implement their HTTP client.

@mario
Copy link
Contributor

mario commented Aug 24, 2017 via email

@rpcameron
Copy link

@mario Ah, sorry. When I was trying to sort through the code I must have followed a wrong reference when tracking source files and includes. Does this mean that Nextcloud will soon finally support this, so I no longer have field support problems from users using Android devices? Or will they still need to be redirected to some other app to access their files on their phones ...

@xstasi
Copy link

xstasi commented Nov 20, 2017

Hi there, poking in to say that I too am afflicted by this issue.

+1

@tobiasKaminsky
Copy link
Member

Can someone provide an test account on a server where this is happening?
Please send it to android at nextcloud dot com with a reference to this issue.

@rpcameron
Copy link

@tobiasKaminsky I just sent an email with login details for a test account on an OpenBSD 6.2 server running its httpd, which only serves with "transfer encoding = chunked". Maybe this means he Android client will finally support the HTTP spec ...

@tobiasKaminsky
Copy link
Member

@rpcameron thank you. I do my very best :-)

@tobiasKaminsky
Copy link
Member

@xstasi thank you also for the credentials 👍

@tobiasKaminsky
Copy link
Member

I guess I have a fix for this: nextcloud/android-library#98

We will soon have our dev version back again. This builds a nearly nightly snapshot from master. So once the fix is merged, you can give it a try and report back :-)

@AndyScherzinger AndyScherzinger added this to the Nextcloud App 2.1.0 milestone Nov 28, 2017
@rpcameron
Copy link

Just ran a quick test with the latest Dev version (20171204), and it appears to be downloaded files (at long last). Thanks to the devs for finally addressing this issue ... Hopefully a stable release will soon make its way out.

@AndyScherzinger
Copy link
Member

nextcloud/android-library#98 did fix it and has been integrated with master and with the new dev builds now been shipped for the dev version. The next stable version doesn't have a date yet but is also progressing quite well: https://github.com/nextcloud/android/milestones/Nextcloud%20App%202.1.0

@johnwmail
Copy link

Where can we download the dev app?

@AndyScherzinger
Copy link
Member

@johnwmail it is distributed via f-droid: https://f-droid.org/packages/com.nextcloud.android.beta/ (so best is to install the f-droid client and Search for "Nextcloud Dev").

@tobiasKaminsky
Copy link
Member

tobiasKaminsky commented Dec 5, 2017

Please note that fdroid currently does not have the latest version, it being built this day and will be available soon.

Or take a look here: https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md#dev-release

@levaidaniel
Copy link

Hi there!

Is it normal that version 3.5.1 (March, 18, 2019) still doesn't download anything from OpenBSD httpd(8)? Is this mentioned fix supposed to be in this version?

@johnwmail
Copy link

Hi, they fixed a year.

@tobiasKaminsky
Copy link
Member

Is it normal that version 3.5.1 (March, 18, 2019) still doesn't download anything from OpenBSD httpd(8)? Is this mentioned fix supposed to be in this version?

Can you create us a test account, test if the problem occurs also there and if so send the credentials to tobias at nextcloud dot com with a reference to this issue?

@tobiasKaminsky tobiasKaminsky reopened this Apr 2, 2019
@levaidaniel
Copy link

Sure thing, I sent the mail containing the info.

@levaidaniel
Copy link

levaidaniel commented Apr 7, 2019

In the meantime, here are the logs from the application and Chrome, respectively. Maybe these shed some light into the problem:

Android app
Chrome

@levaidaniel
Copy link

levaidaniel commented Apr 7, 2019

Interesting thing is using the same app on Android 7.1.1 yields more or less positive results over using the same v3.5.1 app on Android 9. The former only fails sometimes, usually after waiting for a while after a successful download -- it says the file couldn't be synced so using the downloaded version (or something along these lines).
But other than that, on older Android the success rate is definitely higher. On Android 9 I was never ever able to download anything (even though using the same application version: 3.5.1).

@tobiasKaminsky
Copy link
Member

Sure thing, I sent the mail containing the info.

I logged into testaccount and download Nextcloud Flyer.pdf and the AEG manual.
Both work fine with emulator and android 9.0.

@tobiasKaminsky tobiasKaminsky removed this from the Nextcloud App 3.0.0 milestone Apr 8, 2019
@tobiasKaminsky tobiasKaminsky added the needs info Waiting for info from user(s). Issues with this label will auto-stale. label Apr 8, 2019
@levaidaniel
Copy link

Thanks for trying it out!

Is there anything in the logs I pasted here that could point to an error that might cause this?

@levaidaniel
Copy link

Or better yet, can I enable something in the Android app that would log what goes wrong when I try to download something?

@tobiasKaminsky
Copy link
Member

The log you posted did not helped, unfortunately…

You can try to provide locgat infos: https://github.com/nextcloud/android/blob/master/README.md#getting-debug-info-via-logcat

@fmikker
Copy link

fmikker commented Apr 20, 2019

Experiencing the same issue.

Do you need a additional test account?

Platform: CentOS Linux release 7.6.1810 (Core
HTTP-server: httpd24-httpd-2.4.34-7.el7.x86_64
PHP: PHP 7.0.27

Edit: Can confirm that using Nextcloud-dev from f-droid mitigates the problem.

@stale
Copy link

stale bot commented May 18, 2019

This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

@stale stale bot added the stale label May 18, 2019
@stale stale bot closed this as completed Jun 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs info Waiting for info from user(s). Issues with this label will auto-stale. stale
Projects
None yet
Development

No branches or pull requests