-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Does not play nice with nginx WebDAV #523
Comments
|
I dug a little deeper into this, and Nginx returns the 404 status as a text field inside a multistatus response with a 207. Here's a full set of patches that gets Joplin to work with an unmodified nginx. |
|
See #541 which isn't pretty :( On the plus side, it works. |
|
Hi, thanks for the patch, but I wonder if there's a better way to fix it? In particular I don't get why nginx responds with a multistatus when only a single request has been made. And if they can randomly respond with multistatus then the code should be made more generic to deal with this. Do you have any test server that I could use by any chance to double-check all this? |
|
Thought you might feel that way. Relevant code is https://github.com/arut/nginx-dav-ext-module/blob/master/ngx_http_dav_ext_module.c starting near line 524. It doesn't distinguish between single and multi requests. That seems consistent with https://tools.ietf.org/html/rfc4918#page-35 section 9.1 ( the examples there do the same thing ), where it appears that the request level status code only addresses whether or not the request was legal, and then the individual D:propstat sections each contain the D:status for that item. Going back and looking at the Joplin code with that in mind, it appears the generic solution is to properly parse the status fields, examples: <D:status>HTTP/1.1 200 OK</D:status> or <D:status>HTTP/1.1 403 Forbidden</D:status> or <D:status>HTTP/1.1 404 Not Found</D:status> in order to retrieve the HTTP status for each file in all D:propstat sections of the response. Because exec() cannot know if it has sent a request resulting in multiple results or not, parsing the 404 at that level is rather hackish - it was useful for proving this could work, Would you prefer a solution in file-api-drive-webdav.js where statFromResource_ parses the 404s in the <D:status> responses? I'm actually a little more concerned about the other section of the patch, adding the trailing '/' on the MKCOL. While it appears that it's closer to the RFC, and how NGINX works, I haven't (and couldn't) try testing it against all the other DAV servers that Joplin works with. |
|
@bradmcl, your fix should be part of the latest releases (Desktop and Android) so I guess we can close this issue? |
|
Confirmed; release 1.0.100 synchronizes correctly with Nginx DAV running on Ubuntu from both an OSX desktop, and an Android phone. Thanks! |
Operating system
Application
Two issues so far:
The first is that the
MKCOLrequests for the.syncand.resourcedo not have a trailing/( meaning.sync/and the nginx WebDAV module is very picky. A work around for this is to add a rewrite likeif ($request_method = MKCOL) { rewrite ^(.*[^/])$ $1/ break; }to the nginx config, but it would be nice if Joplin was more conservative in its adherence to the RFC.The second issue is that Joplin does not like to parse PROPFIND responses of the form
resulting in the error
The text was updated successfully, but these errors were encountered: