pramsey/pgsql-http

Handle data with non-standard methods

Closed this issue · 1 comments

robe2 commented

This is a continuation of #159

I realize now as I suspected, I'm throwing out the data part for UNKNOWN.

So this kind of request will be properly handled

Following examples from https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html

SELECT h.content::xml FROM http((
    'PROPFIND',
    'https://nextcloud.osgeo.org/remote.php/dav/files/username',
    ARRAY [
        http_header('Authorization', 'Basic ' || encode('username:passwordhere'::bytea, 'base64'))
        ],
    'text/xml',
   '<?xml version="1.0" encoding="UTF-8"?>
    <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
      <d:prop>
        <d:getcontenttype/>
        <oc:size />
        <oc:owner-display-name />
      </d:prop>
    </d:propfind>'
    )::http_request) AS h;

Right now the data part is ignored, so I always get all the default elements back. So I think for UNKNOWN with content, the best course of action is to follow the HTTP_PUT AND HTTP_PATCH paths. I think there are some that have extra bits we might need to handle explicitly but can handle those later.

I'll send another pull request in soon.

robe2 commented

I tested with PROPFIND. No issue with PROPFIND and result had the extra owner-display-name I was expecting and other items I left out no longer there.

I also tested this with PROPPATCH command using the example here - https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html#settings-favorites

and it worked in that the document I chose to favorite showed a nice star on it when I logged into nextcloud.
However even though it worked it showed a timeout on the http call.

ERROR:  Operation timed out after 5001 milliseconds with 0 bytes received 

Not sure if that is a misconfiguration on nextcloud or we need to do something extra to return some outputs..

I haven't looked at the nextcloud logs to see if it registered any error.