Skip to content

[webdav] Handle redirections which add trailing slashes

Fabian Vogt requested to merge work/fvogt/webdavslash into master

KIO doesn't always send trailing slashes when referencing collections. The RFC (quoted in the comment) requires that such clients handle redirections, which KIO can't do correctly in this case.

Add explicit handling for such redirections in the http worker, such that KIO and applications don't need to be aware of this.

CCBUG: 484580

Tested with this Python script:

import http
import http.server

class DAVHandler(http.server.BaseHTTPRequestHandler):
	def do_PROPFIND(self):
		if self.path[-1] == '/':
			self.send_response(http.HTTPStatus.OK)
		else:
			self.send_response(http.HTTPStatus.TEMPORARY_REDIRECT)
			self.send_header("Location", self.path + "/")
			self.end_headers()

http.server.test(HandlerClass=DAVHandler)

Draft because I'd like to get some confirmation that this fix works in practice as well.

Edited by Fabian Vogt

Merge request reports

Loading