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

[Bug]: Sabre\Xml\ParseException: The input element to parse is empty. Do not attempt to parse #43609

Closed
5 of 8 tasks
autoantwort opened this issue Feb 16, 2024 · 7 comments · May be fixed by python-caldav/caldav#389
Closed
5 of 8 tasks
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug feature: caldav Related to CalDAV internals needs info stale Ticket or PR with no recent activity

Comments

@autoantwort
Copy link

⚠️ This issue respects the following points: ⚠️

Bug description

I am using the python caldav lib to search for Events:

import caldav
...

client = caldav.DAVClient(url)
principal = client.principal()
calendars = principal.calendars()
calendars[0].date_search(datetime(2010, 5, 1)) 

Then I get

[webdav] Fehler: Sabre\Xml\ParseException: The input element to parse is empty. Do not attempt to parse at <<closure>>

0. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 685
   Sabre\Xml\Service->parse("", "/remote.php/dav ... /", null)
1. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
   Sabre\DAV\CorePlugin->httpReport(["Sabre\\HTTP\\Request"], ["Sabre\\HTTP\\Response"])
2. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 472
   Sabre\DAV\Server->emit("method:REPORT", [["Sabre\\HTTP\\ ... ]])
3. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 253
   Sabre\DAV\Server->invokeMethod(["Sabre\\HTTP\\Request"], ["Sabre\\HTTP\\Response"])
4. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 321
   Sabre\DAV\Server->start()
5. /var/www/html/apps/dav/lib/Server.php line 365
   Sabre\DAV\Server->exec()
6. /var/www/html/apps/dav/appinfo/v2/remote.php line 35
   OCA\DAV\Server->exec()
7. /var/www/html/remote.php line 172
   require_once("/var/www/html/a ... p")

REPORT /remote.php/dav/calendars/verwaltung/veranstaltungen/
from 10.72.4.30 by Verwaltung at 2024-02-15T23:42:08+00:00
As Json

{
    "reqId": "QZOqE0VJzuVA91N9NGCw",
    "level": 3,
    "time": "2024-02-15T23:46:15+00:00",
    "remoteAddr": "10.72.4.30",
    "user": "Verwaltung",
    "app": "webdav",
    "method": "REPORT",
    "url": "/remote.php/dav/calendars/verwaltung/veranstaltungen/",
    "message": "The input element to parse is empty. Do not attempt to parse",
    "userAgent": "Mozilla/5.0",
    "version": "27.1.5.1",
    "exception": {
        "Exception": "Sabre\\Xml\\ParseException",
        "Message": "The input element to parse is empty. Do not attempt to parse",
        "Code": 0,
        "Trace": [
            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                "line": 685,
                "function": "parse",
                "class": "Sabre\\Xml\\Service",
                "type": "->",
                "args": [
                    "",
                    "/remote.php/dav/calendars/verwaltung/veranstaltungen/",
                    null
                ]
            },
            {
                "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                "line": 89,
                "function": "httpReport",
                "class": "Sabre\\DAV\\CorePlugin",
                "type": "->",
                "args": [
                    [
                        "Sabre\\HTTP\\Request"
                    ],
                    [
                        "Sabre\\HTTP\\Response"
                    ]
                ]
            },
            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 472,
                "function": "emit",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": [
                    "method:REPORT",
                    [
                        [
                            "Sabre\\HTTP\\Request"
                        ],
                        [
                            "Sabre\\HTTP\\Response"
                        ]
                    ]
                ]
            },
            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 253,
                "function": "invokeMethod",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": [
                    [
                        "Sabre\\HTTP\\Request"
                    ],
                    [
                        "Sabre\\HTTP\\Response"
                    ]
                ]
            },
            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 321,
                "function": "start",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/apps/dav/lib/Server.php",
                "line": 365,
                "function": "exec",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
                "line": 35,
                "function": "exec",
                "class": "OCA\\DAV\\Server",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/remote.php",
                "line": 172,
                "args": [
                    "/var/www/html/apps/dav/appinfo/v2/remote.php"
                ],
                "function": "require_once"
            }
        ],
        "File": "/var/www/html/3rdparty/sabre/xml/lib/Service.php",
        "Line": 122,
        "message": "The input element to parse is empty. Do not attempt to parse",
        "exception": [],
        "CustomMessage": "The input element to parse is empty. Do not attempt to parse"
    },
    "id": "65cea26de7c9a"
}

Steps to reproduce

  1. pip install caldav
import caldav
...

client = caldav.DAVClient(url)
principal = client.principal()
calendars = principal.calendars()
calendars[0].date_search(datetime(2010, 5, 1)) 

Expected behavior

No error

Installation method

Official All-in-One appliance

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

docker exec --user www-data -it nextcloud-aio-nextcloud php occ config:list system     
{
    "system": {
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "appsallowlist": [],
        "check_data_directory_permissions": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "cloud.hilton.rwth-aachen.de",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "cloud.hilton.rwth-aachen.de"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "27.1.5.1",
        "overwrite.cli.url": "https:\/\/cloud.hilton.rwth-aachen.de\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "loglevel": "2",
        "log_type": "file",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "log_rotate_size": "10485760",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "enabledPreviewProviders": {
            "1": "OC\\Preview\\Image",
            "2": "OC\\Preview\\MarkDown",
            "3": "OC\\Preview\\MP3",
            "4": "OC\\Preview\\TXT",
            "5": "OC\\Preview\\OpenDocument",
            "6": "OC\\Preview\\Movie",
            "7": "OC\\Preview\\Krita",
            "0": "OC\\Preview\\Imaginary"
        },
        "enable_previews": true,
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": "30",
        "simpleSignUpLink.shown": false,
        "share_folder": "\/Shared",
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726",
        "updatedirectory": "\/nc-updater",
        "allow_local_remote_servers": true,
        "davstorage.request_timeout": 3600,
        "htaccess.RewriteBase": "\/",
        "dbpersistent": false,
        "files_external_allow_create_new_local": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "preview_imaginary_url": "http:\/\/nextcloud-aio-imaginary:9000",
        "app_install_overwrite": [
            "files_3d"
        ]
    }
}

List of activated Apps

docker exec --user www-data -it nextcloud-aio-nextcloud php occ app:list                  
Enabled:
  - activity: 2.19.0
  - admin_audit: 1.17.0
  - calendar: 4.6.4
  - camerarawpreviews: 0.8.4
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contactsinteraction: 1.8.0
  - dav: 1.27.0
  - deck: 1.11.3
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_pdfviewer: 2.8.0
  - files_reminders: 1.0.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - forms: 3.4.5
  - group_everyone: 0.1.13
  - groupfolders: 15.3.4
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - nextcloud-aio: 0.4.0
  - notifications: 2.15.0
  - notify_push: 0.6.9
  - oauth2: 1.15.1
  - photos: 2.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - quota_warning: 1.18.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - richdocuments: 8.2.4
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - spreed: 17.1.5
  - support: 1.10.0
  - systemtags: 1.17.0
  - text: 3.8.0
  - theming: 2.2.0
  - theming_customcss: 1.15.0
  - twofactor_backupcodes: 1.16.0
  - user_ldap: 1.17.0
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - workflowengine: 2.9.0
Disabled:
  - apporder: 0.15.0 (installed 0.15.0)
  - bruteforcesettings: 2.7.0
  - circles: 27.0.1 (installed 27.0.1)
  - dashboard: 7.7.0 (installed 7.1.0)
  - encryption: 2.15.0
  - files_external: 1.19.0
  - firstrunwizard: 2.16.0 (installed 2.10.0)
  - nextcloud_announcements: 1.16.0 (installed 1.10.0)
  - password_policy: 1.17.0 (installed 1.11.0)
  - survey_client: 1.15.0 (installed 1.9.0)
  - suspicious_login: 5.0.0 (installed 4.1.0)
  - tasks: 0.15.0 (installed 0.15.0)
  - twofactor_totp: 9.0.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{
    "reqId": "QZOqE0VJzuVA91N9NGCw",
    "level": 3,
    "time": "2024-02-15T23:46:15+00:00",
    "remoteAddr": "10.72.4.30",
    "user": "Verwaltung",
    "app": "webdav",
    "method": "REPORT",
    "url": "/remote.php/dav/calendars/verwaltung/veranstaltungen/",
    "message": "The input element to parse is empty. Do not attempt to parse",
    "userAgent": "Mozilla/5.0",
    "version": "27.1.5.1",
    "exception": {
        "Exception": "Sabre\\Xml\\ParseException",
        "Message": "The input element to parse is empty. Do not attempt to parse",
        "Code": 0,
        "Trace": [
            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                "line": 685,
                "function": "parse",
                "class": "Sabre\\Xml\\Service",
                "type": "->",
                "args": [
                    "",
                    "/remote.php/dav/calendars/verwaltung/veranstaltungen/",
                    null
                ]
            },
            {
                "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                "line": 89,
                "function": "httpReport",
                "class": "Sabre\\DAV\\CorePlugin",
                "type": "->",
                "args": [
                    [
                        "Sabre\\HTTP\\Request"
                    ],
                    [
                        "Sabre\\HTTP\\Response"
                    ]
                ]
            },
            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 472,
                "function": "emit",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": [
                    "method:REPORT",
                    [
                        [
                            "Sabre\\HTTP\\Request"
                        ],
                        [
                            "Sabre\\HTTP\\Response"
                        ]
                    ]
                ]
            },
            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 253,
                "function": "invokeMethod",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": [
                    [
                        "Sabre\\HTTP\\Request"
                    ],
                    [
                        "Sabre\\HTTP\\Response"
                    ]
                ]
            },
            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 321,
                "function": "start",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/apps/dav/lib/Server.php",
                "line": 365,
                "function": "exec",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
                "line": 35,
                "function": "exec",
                "class": "OCA\\DAV\\Server",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/remote.php",
                "line": 172,
                "args": [
                    "/var/www/html/apps/dav/appinfo/v2/remote.php"
                ],
                "function": "require_once"
            }
        ],
        "File": "/var/www/html/3rdparty/sabre/xml/lib/Service.php",
        "Line": 122,
        "message": "The input element to parse is empty. Do not attempt to parse",
        "exception": [],
        "CustomMessage": "The input element to parse is empty. Do not attempt to parse"
    },
    "id": "65cea26de7c9a"
}

Additional info

Nextcloud all in one 27.1.5

@autoantwort autoantwort added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Feb 16, 2024
@joshtrichards joshtrichards added the feature: caldav Related to CalDAV internals label Feb 17, 2024
@autoantwort
Copy link
Author

Same error with 28.0.3

@autoantwort
Copy link
Author

I have finally found the "Bug": My server uses https (or the proxy), but i used http://Verwaltung:***@***.de/remote.php/dav/calendars/verwaltung/' as url. If I change that to httpsI don't get errors.

@autoantwort
Copy link
Author

The question is if that is intended behavior and if no, who is to blame.

@joshtrichards
Copy link
Member

According to this part of the stack trace, the body sent with the REPORT HTTP request is empty (i.e. the first argument is empty):

            {
                "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                "line": 685,
                "function": "parse",
                "class": "Sabre\\Xml\\Service",
                "type": "->",
                "args": [
                    "",
                    "/remote.php/dav/calendars/verwaltung/veranstaltungen/",
                    null
                ]
            },

And I don't see any indications that we modify it or anything before that. That's the first time we try to retrieve it. So maybe that library and the http versus https handling resulted in only a partial HTTP transaction. The ParseException saying The input element to parse is empty. Do not attempt to parse is just a reflection of the body being empty.

@autoantwort
Copy link
Author

Maybe https://github.com/nextcloud/all-in-one does the redirection wrong or the caldav python lib forgets to resend the body after redirection.

@autoantwort
Copy link
Author

I have debugged the code and caldav uses python requests to make the http requests. Nextcloud return 301 Found for the http url and request with follow_redirects does not send the body again after the redirect

@nextcloud-command
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

@nextcloud-command nextcloud-command added the stale Ticket or PR with no recent activity label May 6, 2024
@nextcloud-command nextcloud-command closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug feature: caldav Related to CalDAV internals needs info stale Ticket or PR with no recent activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants