Skip to content
Permalink
Browse files
[ExternalStorage] add WebDAV external storage implementation
  • Loading branch information
troopa81 committed Aug 23, 2021
1 parent 0ce7f90 commit 96eb75a1189c09fc94d429f61a1fffdc9b62fb38
@@ -11,12 +11,20 @@ services:
httpbin:
image: kennethreitz/httpbin:latest

webdav:
image: nginx
volumes:
- ${GH_WORKSPACE}/.docker/webdav/nginx.conf:/etc/nginx/conf.d/default.conf
- ${GH_WORKSPACE}/.docker/webdav/passwords.list:/etc/nginx/.passwords.list
- /tmp/webdav_tests:/tmp/webdav_tests_root/webdav_tests

qgis-deps:
tty: true
image: qgis3-build-deps-binary-image
volumes:
- ${GH_WORKSPACE}:/root/QGIS
# links:
links:
- webdav
# - mssql
links:
- httpbin
@@ -20,3 +20,6 @@ QGIS_CONTINUOUS_INTEGRATION_RUN=true
PUSH_TO_CDASH=false

XDG_RUNTIME_DIR=/tmp

QGIS_WEBDAV_HOST=webdav
QGIS_WEBDAV_PORT=80
@@ -0,0 +1,21 @@
server {
listen 80;
listen [::]:80;
server_name localhost;

location /webdav_tests {

auth_basic realm_name;
auth_basic_user_file /etc/nginx/.passwords.list;

dav_methods PUT DELETE MKCOL COPY MOVE;
#dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:r;

autoindex on;

client_max_body_size 0;
create_full_put_path on;
root /tmp/webdav_tests_root;
}
}
@@ -0,0 +1 @@
qgis:$apr1$cxID/nB1$3tG4J0FkYvEHyWAB.yqjo.
@@ -386,4 +386,5 @@ jobs:
[[ ${{ matrix.test-batch }} == "ORACLE" ]] && sudo rm -rf /usr/share/dotnet/sdk
echo "TEST_BATCH=$TEST_BATCH"
echo "DOCKERFILE=$DOCKERFILE"
mkdir -p /tmp/webdav_tests && chmod 777 /tmp/webdav_tests
docker-compose -f .docker/$DOCKERFILE run qgis-deps /root/QGIS/.docker/docker-qgis-test.sh $TEST_BATCH
@@ -69,7 +69,7 @@ can be retrieved by calling :py:func:`~QgsBlockingNetworkRequest.errorMessage`.
.. seealso:: :py:func:`post`
%End

ErrorCode post( QNetworkRequest &request, const QByteArray &data, bool forceRefresh = false, QgsFeedback *feedback = 0 );
ErrorCode post( QNetworkRequest &request, QIODevice *data, bool forceRefresh = false, QgsFeedback *feedback = 0 );
%Docstring
Performs a "post" operation on the specified ``request``, using the given ``data``.

@@ -89,6 +89,15 @@ If an error was encountered then a specific ErrorCode will be returned, and a de
can be retrieved by calling :py:func:`~QgsBlockingNetworkRequest.errorMessage`.

.. seealso:: :py:func:`get`

.. versionadded:: 3.22
%End

ErrorCode post( QNetworkRequest &request, const QByteArray &data, bool forceRefresh = false, QgsFeedback *feedback = 0 );
%Docstring
This is an overloaded function.

Performs a "post" operation on the specified ``request``, using the given ``data``.
%End

ErrorCode head( QNetworkRequest &request, bool forceRefresh = false, QgsFeedback *feedback = 0 );
@@ -113,7 +122,7 @@ can be retrieved by calling :py:func:`~QgsBlockingNetworkRequest.errorMessage`.
.. versionadded:: 3.18
%End

ErrorCode put( QNetworkRequest &request, const QByteArray &data, QgsFeedback *feedback = 0 );
ErrorCode put( QNetworkRequest &request, QIODevice *data, QgsFeedback *feedback = 0 );
%Docstring
Performs a "put" operation on the specified ``request``, using the given ``data``.

@@ -129,6 +138,15 @@ by calling :py:func:`~QgsBlockingNetworkRequest.reply`.
If an error was encountered then a specific ErrorCode will be returned, and a detailed error message
can be retrieved by calling :py:func:`~QgsBlockingNetworkRequest.errorMessage`.

.. versionadded:: 3.22
%End

ErrorCode put( QNetworkRequest &request, const QByteArray &data, QgsFeedback *feedback = 0 );
%Docstring
This is an overloaded function.

Performs a "put" operation on the specified ``request``, using the given ``data``.

.. versionadded:: 3.18
%End

@@ -192,6 +210,13 @@ Emitted when when data arrives during a request.
void downloadFinished();
%Docstring
Emitted once a request has finished downloading.
%End

void uploadProgress( qint64, qint64 );
%Docstring
Emitted when when data are sent during a request.

.. versionadded:: 3.22
%End

};
@@ -95,6 +95,14 @@ Emitted when content has loaded
Emitted when data is received.

.. versionadded:: 3.2
%End

void errorOccurred( QNetworkReply::NetworkError code, const QString &errorMsg );
%Docstring
Emitted when an error with ``code`` error occured while processing the request
``errorMsg`` is a textual description of the error

.. versionadded:: 3.22
%End

};
@@ -32,7 +32,8 @@ FetchedContent holds useful information about a network content being fetched
Failed
};

explicit QgsFetchedContent( const QString &url, QTemporaryFile *file = 0, ContentStatus status = NotStarted );
explicit QgsFetchedContent( const QString &url, QTemporaryFile *file = 0, ContentStatus status = NotStarted,
const QString &authConfig = QString() );
%Docstring
Constructs a FetchedContent with pointer to the downloaded file and status of the download
%End
@@ -54,6 +55,11 @@ Returns the status of the download
QNetworkReply::NetworkError error() const;
%Docstring
Returns the potential error of the download
%End

QString authConfig() const;
%Docstring
Returns the authentication configuration id use for this fetched content
%End

public slots:
@@ -74,6 +80,14 @@ Cancel the download operation.
void fetched();
%Docstring
Emitted when the file is fetched and accessible
%End

void errorOccurred( QNetworkReply::NetworkError code, const QString &errorMsg );
%Docstring
Emitted when an error with ``code`` error occured while processing the request
``errorMsg`` is a textual description of the error

.. versionadded:: 3.22
%End

};
@@ -103,12 +117,13 @@ Create the registry for temporary downloaded files

~QgsNetworkContentFetcherRegistry();

const QgsFetchedContent *fetch( const QString &url, Qgis::ActionStart fetchingMode = Qgis::ActionStart::Deferred );
QgsFetchedContent *fetch( const QString &url, Qgis::ActionStart fetchingMode = Qgis::ActionStart::Deferred, const QString &authConfig = QString() );
%Docstring
Initialize a download for the given URL

:param url: the URL to be fetched
:param fetchingMode: defines if the download will start immediately or shall be manually triggered
:param authConfig: authentication configuration id to be used while fetching

.. note::

@@ -91,6 +91,14 @@ of whether the fetch was successful or not.
Users of QgsNetworkContentFetcherTask should connect to this signal,
and from the associated slot they can then safely access the network :py:func:`~QgsNetworkContentFetcherTask.reply`
without danger of the task being first removed by the :py:class:`QgsTaskManager`.
%End

void errorOccurred( QNetworkReply::NetworkError code, const QString &errorMsg );
%Docstring
Emitted when an error with ``code`` error occured while processing the request
``errorMsg`` is a textual description of the error

.. versionadded:: 3.22
%End

};
@@ -133,6 +133,7 @@ set(QGIS_CORE_SRCS
externalstorage/qgsexternalstorage.cpp
externalstorage/qgsexternalstorageregistry.cpp
externalstorage/qgssimplecopyexternalstorage.cpp
externalstorage/qgswebdavexternalstorage.cpp

layertree/qgscolorramplegendnode.cpp
layertree/qgscolorramplegendnodesettings.cpp
@@ -1750,8 +1751,8 @@ set(QGIS_CORE_PRIVATE_HDRS
qgsspatialindexkdbush_p.h

editform/qgseditformconfig_p.h

externalstorage/qgssimplecopyexternalstorage_p.h
externalstorage/qgswebdavexternalstorage_p.h

proj/qgscoordinatereferencesystem_p.h
proj/qgscoordinatetransformcontext_p.h
@@ -17,10 +17,12 @@

#include "qgsexternalstorage.h"
#include "qgssimplecopyexternalstorage_p.h"
#include "qgswebdavexternalstorage_p.h"

QgsExternalStorageRegistry::QgsExternalStorageRegistry()
{
registerExternalStorage( new QgsSimpleCopyExternalStorage() );
registerExternalStorage( new QgsWebDAVExternalStorage() );
}

QgsExternalStorageRegistry::~QgsExternalStorageRegistry()

0 comments on commit 96eb75a

Please sign in to comment.