After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787656 - Do not use Transfer-Encoding:chunked for CalDAV/CardDAV PUT
Do not use Transfer-Encoding:chunked for CalDAV/CardDAV PUT
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Calendar
3.26.x (obsolete)
Other Linux
: Normal major
: ---
Assigned To: evolution-calendar-maintainers
Evolution QA team
: 788176 788239 789158 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-09-14 02:10 UTC by Adam Williamson
Modified: 2017-10-23 09:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Adam Williamson 2017-09-14 02:10:33 UTC
I have a personal calendar server set up running Radicale on my web server. I have this calendar configured via CalDAV in Evolution on all my Fedora systems. Up till recently they could all create and edit events in the calendar just fine; I upgraded my desktop to Fedora 27 with GNOME 3.25 and now it can't.

My other systems (running Fedora 25 and 26) can still edit the calendar just fine, but my desktop - currently running Evolution and e-d-s 3.25.92 - cannot. Whenever I try, I get an error like this:

Failed to create an event in the calendar “CalDAV : Personal”

Cannot create calendar object: Failed to put data: HTTP error code 411 (Length Required): The server responded with an HTML page, which can mean there’s an error on the server or with the client request. The used URI was: https://www.happyassassin.net/radicale/adamw/Personal.ics/(redacted).ics

where (redacted) is a long alphanumeric string, not sure if it's safe to post publicly.

In the server end Apache logs, I see this:

ssl_error_log:

[Wed Sep 13 19:08:20.852863 2017] [wsgi:error] [pid 2702:tid 139657651181312] [remote 192.168.1.5:39744] GET request at /adamw/Personal.ics/b432a15404b2b9cb289e3778ccb80c4bde4ef5ad.ics received
[Wed Sep 13 19:08:20.871993 2017] [wsgi:error] [pid 2702:tid 139657651181312] [remote 192.168.1.5:39746] GET request at /adamw/Personal.ics/b432a15404b2b9cb289e3778ccb80c4bde4ef5ad received
[Wed Sep 13 19:08:20.892056 2017] [wsgi:error] [pid 14481:tid 139656913311488] [client 192.168.1.5:39748] Received request requiring chunked transfer encoding, but optional support for chunked transfer encoding has not been enabled.: /usr/share/radicale/radicale.wsgi

ssl_access_log:

192.168.1.5 - adamw [13/Sep/2017:19:08:20 -0700] "GET /radicale/adamw/Personal.ics/b432a15404b2b9cb289e3778ccb80c4bde4ef5ad.ics HTTP/1.1" 404 -
192.168.1.5 - adamw [13/Sep/2017:19:08:20 -0700] "GET /radicale/adamw/Personal.ics/b432a15404b2b9cb289e3778ccb80c4bde4ef5ad HTTP/1.1" 404 -
192.168.1.5 - adamw [13/Sep/2017:19:08:20 -0700] "PUT /radicale/adamw/Personal.ics/b432a15404b2b9cb289e3778ccb80c4bde4ef5ad.ics HTTP/1.1" 411 238
Comment 1 Adam Williamson 2017-09-14 02:19:47 UTC
If I set 'WSGIChunkedRequest On' in Apache config, I now get a traceback from Radicale in ssl_error_log:

[Wed Sep 13 19:15:35.280628 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39856] GET request at /adamw/Personal.ics/514dec98e105a00807d64f3b3d5d9a4828459301.ics received
[Wed Sep 13 19:15:35.300320 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39858] GET request at /adamw/Personal.ics/514dec98e105a00807d64f3b3d5d9a4828459301 received
[Wed Sep 13 19:15:35.319997 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860] PUT request at /adamw/Personal.ics/514dec98e105a00807d64f3b3d5d9a4828459301.ics received
[Wed Sep 13 19:15:35.335016 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860] mod_wsgi (pid=32240): Exception occurred processing WSGI script '/usr/share/radicale/radicale.wsgi'.
[Wed Sep 13 19:15:35.337312 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860] Traceback (most recent call last):
[Wed Sep 13 19:15:35.337342 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]   File "/usr/lib/python3.6/site-packages/radicale/__init__.py", line 332, in __call__
[Wed Sep 13 19:15:35.337345 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]     user)
[Wed Sep 13 19:15:35.337349 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]   File "/usr/lib/python3.6/site-packages/radicale/__init__.py", line 588, in do_PUT
[Wed Sep 13 19:15:35.337351 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]     xmlutils.put(environ["PATH_INFO"], content, collection)
[Wed Sep 13 19:15:35.337354 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]   File "/usr/lib/python3.6/site-packages/radicale/xmlutils.py", line 453, in put
[Wed Sep 13 19:15:35.337358 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]     collection.append(name, ical_request)
[Wed Sep 13 19:15:35.337361 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]   File "/usr/lib/python3.6/site-packages/radicale/ical.py", line 357, in append
[Wed Sep 13 19:15:35.337363 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]     text, (Timezone, Event, Todo, Journal, Card), name)
[Wed Sep 13 19:15:35.337367 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]   File "/usr/lib/python3.6/site-packages/radicale/ical.py", line 324, in _parse
[Wed Sep 13 19:15:35.337368 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]     lines = unfold(text)
[Wed Sep 13 19:15:35.337372 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]   File "/usr/lib/python3.6/site-packages/radicale/ical.py", line 63, in unfold
[Wed Sep 13 19:15:35.337373 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]     return re.sub('\\r\\n( |\\t)', '', text).splitlines()
[Wed Sep 13 19:15:35.337382 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]   File "/usr/lib64/python3.6/re.py", line 191, in sub
[Wed Sep 13 19:15:35.337384 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860]     return _compile(pattern, flags).sub(repl, string, count)
[Wed Sep 13 19:15:35.337395 2017] [wsgi:error] [pid 32240:tid 139724945602304] [remote 192.168.1.5:39860] TypeError: expected string or bytes-like object
Comment 2 Milan Crha 2017-09-18 13:30:16 UTC
Thanks for a bug report. Looking into the headers being sent to the server, they are the same as with 3.24.5, only the latest version has these added:

> Cache-Control: no-cache
> Pragma: no-cache
> Transfer-Encoding: chunked

The new version also changes the way it has constructed the Content-Type header, but I do not think it has any impact on the issue. The old version uses:
> Content-Type: text/calendar; charset=utf-8
while the new version uses:
> Content-Type: text/calendar; charset="utf-8"

I'm pretty sure it's the Transfer-Encoding header which your server gets confused with. Looking into the description of the "chunked" encoding [1], it's either libsoup doing things in a way which Radicale doesn't understand (other servers like Google, DAViCal, Zimbra, Yandex, GMX,... have no issue with it) or the Radicale server has some bug in the chunked transfer encoding algorithm. [2]

I tried to configure radicale server on my machine, but no luck. I didn't try too hard, and I'm not an httpd expert either, which may explains things (it says Forbidden, when I try to access the virtual host, even the httpd successfully verifies my credentials). By the way, what is your radicale server version, please?

[1] https://tools.ietf.org/html/rfc2616#section-3.6.1
[2] https://tools.ietf.org/html/rfc2616#section-19.4.6
Comment 3 Adam Williamson 2017-09-19 16:56:00 UTC
I'm on 1.1.6. 2.x is packaged for F27+ but not for F26.

I'm on vacation ATM, but I'll try and send you details of my Radicale config a bit later...

Do you know *why* libsoup / evo has changed to request chunked transfers?
Comment 4 Milan Crha 2017-09-20 08:27:41 UTC
(In reply to Adam Williamson from comment #3)
> Do you know *why* libsoup / evo has changed to request chunked transfers?

I did it, kind of generalized use of streams. When writing EWebDAVSession and dealing with uploads I had on mind that people may eventually upload gigabytes of data, thus instead of loading it into the memory and trying to push it at once I decided to use the chunked API of libsoup. It's not needed for such small data like events, usually, but the code reuses the chunk API for consistency and simpler maintenance (instead of having two code branches for upload there's only one).

I managed to run Radicale locally and I can reproduce it too. The problem is in Radicale itself, they do not support chunked transfer encoding for some reason. Open:
   /usr/lib/python3.6/site-packages/radicale/__init__.py
and search for "CONTENT_LENGTH" there. They rely on it and they do not check for "HTTP_TRANSFER_ENCODING" value. I would expect something like:

        elif environ.get("HTTP_TRANSFER_ENCODING").upper() == "CHUNKED":

in that content reading part, but it's not there. Maybe they would be able to use something from wsgi [1], but python is not my language, thus I do not know how to do that.

I also had a look into the Radicale 2.1.6 sources and they have there a change in this part, they use (and define) _read_raw_content() now, but it still doesn't understand the chunked transfer encoding. Furthermore, they return empty string instead of None, which can have bad side effects, like silently putting empty components, instead of failing with (runtime) error. I didn't try it in action, thus it's possible the code fails gracefully on later checks, like when verifying that the content conforms to the expected collection data type.

You might ask them to add support for chunked transfer encoding. While I can change it on the eds side too, I would be unhappy to do it, for the reason from the top of this comment (large file upload). It's the only server (at the moment) which doesn't work with this, with compare of many other (I forgot to mention also ownCloud/nextCloud and Yahoo! in the list of tested servers).

[1] http://uwsgi-docs.readthedocs.io/en/latest/Chunked.html
Comment 5 Milan Crha 2017-09-26 11:48:43 UTC
*** Bug 788176 has been marked as a duplicate of this bug. ***
Comment 6 Milan Crha 2017-09-26 11:50:53 UTC
I'm reopening this. The bug above mentions a different server having trouble with the chunked Transfer-Encoding, thus I'll try to find some solution, the worse to use that chunked encoding only for stream and use the old way for non-stream PUTs (thus two code paths instead of one, as mentioned above).
Comment 7 Milan Crha 2017-09-26 12:23:28 UTC
I do not see anything other to use for the long streams, thus I copied part of the code to the other function which uses in-memory data. That is also used in both CalDAV and CardDAV, thus it fixes the issue.

Created commit 85543d399 in eds master (3.27.1+)
Created commit ef8b553fd in eds gnome-3-26 (3.26.1+)
Comment 8 Cédric Bellegarde 2017-09-28 19:38:27 UTC
It's fixed for my university Zimbra server, thanks ;)
Comment 9 Milan Crha 2017-09-29 12:28:10 UTC
*** Bug 788239 has been marked as a duplicate of this bug. ***
Comment 10 Adam Williamson 2017-10-10 17:00:49 UTC
Fix confirmed here with 3.26.1, thanks.
Comment 11 Milan Crha 2017-10-18 17:18:43 UTC
*** Bug 789158 has been marked as a duplicate of this bug. ***
Comment 12 Cédric Bellegarde 2017-10-23 08:22:52 UTC
Hello, is there something wrong with the 3.26.1 tarball?

ArchLinux is using git commit=cfd2bdb29f5bbb8b6cad90072011b23753122616 to build it package, bug is fixed.

Fedora 27 use 3.26.1 tarball and bug is not fixed.
Comment 13 Milan Crha 2017-10-23 09:31:30 UTC
(In reply to Cédric Bellegarde from comment #12)
> Hello, is there something wrong with the 3.26.1 tarball?

No, I do not think so. Tarballs are generated from (and by) git checkout.

> Fedora 27 use 3.26.1 tarball and bug is not fixed.

How did you install and test it, please? Adam uses Fedora and confirmed the fix at comment #10. If you verified it's broken, then installed new eds and tried to verify it's fixed, without restarting background processes (where the change had been done), then you've been still using old bits.