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

report with time-range #389

Closed
remyd1 opened this issue May 3, 2016 · 11 comments
Closed

report with time-range #389

remyd1 opened this issue May 3, 2016 · 11 comments

Comments

@remyd1
Copy link

remyd1 commented May 3, 2016

Hi,

I made some little bash scripts to query a caldav server:
https://gist.github.com/remyd1/a353b07219884c5878cc27d04aab9d96

However, I am not able to have the REPORT queries working correctly with our radicale server, contrary to GET or PROPFIND request.

It returns the following output:

A server error occurred.  Please contact the administrator.

I do not know if it really comes from radicale. Anyway, here are the debug informations, I found:

## on server output
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/lib/python2.7/dist-packages/radicale/__init__.py", line 332, in __call__
    user)
  File "/usr/lib/python2.7/dist-packages/radicale/__init__.py", line 612, in do_REPORT
    answer = xmlutils.report(environ["PATH_INFO"], content, collection)
  File "/usr/lib/python2.7/dist-packages/radicale/xmlutils.py", line 466, in report
    root = ET.fromstring(xml_request.encode("utf8"))
AttributeError: 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/lib/python2.7/dist-packages/radicale/__init__.py", line 332, in __call__
    user)
  File "/usr/lib/python2.7/dist-packages/radicale/__init__.py", line 612, in do_REPORT
    answer = xmlutils.report(environ["PATH_INFO"], content, collection)
  File "/usr/lib/python2.7/dist-packages/radicale/xmlutils.py", line 466, in report
    root = ET.fromstring(xml_request.encode("utf8"))
AttributeError: 'NoneType' object has no attribute 'encode'

=> 'CONTENT_LENGTH' seems to be equals to "".

2016-05-03 13:55:56,896 - DEBUG: Answer status: 200 OK
2016-05-03 13:56:13,723 - INFO: REPORT request at /remy/calendar.ics/ received
2016-05-03 13:56:13,725 - DEBUG: Request headers:
{'CONTENT_LENGTH': '',
 'CONTENT_TYPE': 'application/xml; charset=utf-8',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_<C': 'calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> <D:prop> <D:getetag/> <C:calendar-data> <C:comp name="VCALENDAR"> <C:prop name="VERSION"/> <C:comp name="VEVENT"> <C:prop name="SUMMARY"/> <C:prop name="UID"/> <C:prop name="DTSTART"/> <C:prop name="DTEND"/> <C:prop name="DURATION"/> </C:comp> <C:comp name="VTIMEZONE" /> </C:comp> </C:calendar-data> </D:prop> <C:filter> <C:comp-filter name="VCALENDAR"> <C:comp-filter name="VEVENT"> <C:time-range start="20160501T110000" /> </C:comp-filter> </C:comp-filter> </C:filter></C:calendar-query>',
 'HTTP_ACCEPT': '*/*',
 'HTTP_DEPTH': '1',
 'HTTP_HOST': 'localhost:5232',
 'HTTP_PREFER': 'return-minimal',
 'HTTP_USER_AGENT': 'curl/7.47.0',
 'PATH_INFO': '/remy/calendar.ics/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': 'localhost',
 'REQUEST_METHOD': 'REPORT',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'atlas',
 'SERVER_PORT': '5232',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7.11+',
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7fb6bb6181e0>,
 'wsgi.file_wrapper': <class wsgiref.util.FileWrapper at 0x7fb6b95bcb48>,
 'wsgi.input': <socket._fileobject object at 0x7fb6b9538c50>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}
apt show radicale
Package: radicale
Version: 1.1.1-1
Priority: optional
Section: universe/web
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Jonas Smedegaard <dr@jones.dk>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 65,5 kB
Depends: python-radicale (= 1.1.1-1), python, adduser
Suggests: apache2-utils, python-ldap, python-pampy, python-passlib, courier-authdaemon, python-requests, python-sqlalchemy, python-dulwich
Homepage: http://radicale.org/
Download-Size: 18,8 kB
APT-Manual-Installed: yes
APT-Sources: http://fr.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Description: simple calendar and addressbook server - daemon
 Radicale is a CalDAV (calendar) and CardDAV (contact) server.
 .
 Calendars and address books are available for both local and remote
 access, possibly limited through authentication policies. They can be
 viewed and edited by calendar and contact clients on mobile phones or
 computers.
 .
 This package contains the radicale daemon.
 .
 Some authentication schemes require either of the packages
 apache2-utils,
 python-ldap,
 python-passlib,
 python-pampy,
 courier-authdaemon or
 python-requests.
 .
 SQL storage requires the package python-sqlalchemy.

I have the same error, even with more basics REPORT request like:

curl --silent -X REPORT --header 'Depth: 1' --header 'Prefer: return-minimal' --header 'Content-Type: application/xml; charset=utf-8' --header '<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> <d:prop> <d:getetag /> <c:calendar-data /> </d:prop> <c:filter> <c:comp-filter name="VCALENDAR" /> </c:filter> </c:calendar-query>' --url http://localhost:5232/remy/calendar.ics/

Regards
Rémy

@liZe
Copy link
Member

liZe commented May 3, 2016

Hi! Thanks for your report!

Radicale is really bad at handling HTTP requests, because it's focused on real-life CalDAV and CardDAV clients. It's really easy to make it crash with HTTP requests as you did, but that's not a bug we want to fix.

But.

The next version (defined in #372) should be more solid. The current git version is known to work with some WebDAV clients for example, and uses a real iCal parser. But it's probably easy to make it crash too with HTTP requests!

@untitaker
Copy link
Contributor

@liZe What do you consider "real-life"?

@liZe
Copy link
Member

liZe commented May 3, 2016

What do you consider "real-life"?

😄. I mean "CalDAV and CardDAV clients" (without "real-life").

@untitaker
Copy link
Contributor

In this case, all that is missing from the HTTP requests is the Content-Length header. While there are valid reasons to reject requests missing that header to protect from DoS, Radicale doesn't make use of any of those.

@liZe
Copy link
Member

liZe commented May 3, 2016

Radicale uses the Content-Length header to read the content of the request, that's why it fails.

@remyd1
Copy link
Author

remyd1 commented May 3, 2016 via email

@remyd1
Copy link
Author

remyd1 commented May 4, 2016

Hi,

I just read the RFC, but I did not find any information on Content-Length. How do you set this value ? Is this value is corresponding to the number of characters of all headers ?

Thanks for help,

Best,
Remy

@liZe
Copy link
Member

liZe commented May 4, 2016

@remyd1 It's in one of the HTTP RFCs: https://tools.ietf.org/html/rfc7230#section-3.3.2

@remyd1
Copy link
Author

remyd1 commented May 4, 2016

Ok, thanks, it works now (not a problem with Content-Length). Sorry, I was trying to put the payload in a header...

@liZe
Copy link
Member

liZe commented May 4, 2016

@remyd1 can we close the bug?

@remyd1
Copy link
Author

remyd1 commented May 4, 2016 via email

@liZe liZe closed this as completed May 4, 2016
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

No branches or pull requests

3 participants