From nobody Tue Nov 28 13:58:43 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SfkZW2TQDz52Tbs; Tue, 28 Nov 2023 13:58:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SfkZW224tz4f3Q; Tue, 28 Nov 2023 13:58:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701179923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WVFp/+/R2qOY8WlolISnX6viz/Efm6hFFXRRlySvukQ=; b=SW95/EHDQWQQGaZCnotPmU0qcnmbbSaqfHnQKao43BJsnpJEf00xDEUR+W5Es3TXv5KB/W aWjfAwBNGjrSRGrUvWD+oBGkuGHvJX5F9ySosCzcXvIHKlzbupDb/CRLK9no1cEXql7fEh f2FSMmtjxyW1ShpUkPBaJaf7X6dKNoGGcS3tqqZzeDLrWdxcV4HdDfjQ0ubcZT6RZbInzA rspVkKoh7yjvWnRyStJE8NiqY4QUeNw+uJemo3obQFhhHVBqsb8glk2XF8GavZUMKu3EVz xogk3n7s2muJQYTfbm51QLvFmUMEg47buqRrwFFhMROit0k72ifBnA/Q00uG3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701179923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WVFp/+/R2qOY8WlolISnX6viz/Efm6hFFXRRlySvukQ=; b=mK8r5HvJDyOKBgbZfNQ5L3zpt9FT2RNobrpzet5n5RLe0Qe2UJPVcACud+kUTDVWopncXV kv+8a67rgyrwwfhu3a5Vn9gH3t4bUaoVsMt6vEBl0nTTGy/fYqJJGqy76ydHoY78L640vt +8ih1TFrJ2L+EUPNx1K+66m4X++vjpX8gw3cAFn2LDzfEY2MrzYu4mLODYu66e+dKqq51S F726kOcapeSbk1wUbgNI8GOUJpxxcUkuT+Mk0WVLjC0dY/YtOiDx8x8h0SlhUGxi3+2fdv HFIzHUD9hOmTDFLfH8SZbVm2jVKYsClRvsafzEX4zp0ihxtU1AQqixtgYAsoNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701179923; a=rsa-sha256; cv=none; b=d+jDngPPBzONofrweCxlDvphmUvapBlBM+If8Du9ir84WjRgrDfBCibk1U+DwuAhFTTwHN fThCfC8BAHBi8GbwM18SB7TpYr0KiNnEYb65bplnpLOOfpaVhAkK66GDISS9DJGcr/PUIY H/Dep6P92CXBnMI38SDHgP4mBr2TSzLBUpcYvZCHau7iP3FMprIwkE7fhacvc07rSUQLgt HO4BJdBQJnx6kHGAdq/zHjVdVvTS9XAVYgKK8HRvnrRmos/VFK6h9d3Ca7dC3LrHDooTzn 8hKBBYf9ckzqDTE+YL/nEv0RZVAQlu2gftNgC6i7RgzX8DT2w7dVBKyQbhbXdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SfkZW153Qz8d9; Tue, 28 Nov 2023 13:58:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3ASDwhBl059805; Tue, 28 Nov 2023 13:58:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ASDwhKH059802; Tue, 28 Nov 2023 13:58:43 GMT (envelope-from git) Date: Tue, 28 Nov 2023 13:58:43 GMT Message-Id: <202311281358.3ASDwhKH059802@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Dima Panov Subject: git: 9f872cfb48a3 - main - net/libcmis: update to 0.6.2 release List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fluffy X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f872cfb48a3f0ef747430c55297d5fbf6e00a05 Auto-Submitted: auto-generated The branch main has been updated by fluffy: URL: https://cgit.FreeBSD.org/ports/commit/?id=9f872cfb48a3f0ef747430c55297d5fbf6e00a05 commit 9f872cfb48a3f0ef747430c55297d5fbf6e00a05 Author: Dima Panov AuthorDate: 2023-11-28 13:44:56 +0000 Commit: Dima Panov CommitDate: 2023-11-28 13:58:31 +0000 net/libcmis: update to 0.6.2 release Changelog: https://github.com/tdf/libcmis/releases/tag/v0.6.2 https://github.com/tdf/libcmis/releases/tag/v0.6.1 https://github.com/tdf/libcmis/releases/tag/v0.6.0 Sponsored by: Serenity Cybersecurity, LLC --- net/libcmis/Makefile | 5 +- net/libcmis/distinfo | 6 +- ...-class-GetObject-to-avoid-name-clash-on-Windows | 69 -- net/libcmis/files/patch-0002-onedrive | 445 ------------- .../files/patch-0003-oauth_pw_as_refreshtoken | 185 ------ net/libcmis/files/patch-0004-gdrive | 702 --------------------- net/libcmis/pkg-plist | 8 +- 7 files changed, 9 insertions(+), 1411 deletions(-) diff --git a/net/libcmis/Makefile b/net/libcmis/Makefile index 6c58dac69871..1fd52d8af794 100644 --- a/net/libcmis/Makefile +++ b/net/libcmis/Makefile @@ -1,6 +1,5 @@ PORTNAME= libcmis -PORTVERSION= 0.5.2 -PORTREVISION= 9 +PORTVERSION= 0.6.2 CATEGORIES= net devel MASTER_SITES= https://github.com/tdf/libcmis/releases/download/v${PORTVERSION}/ \ https://dev-www.libreoffice.org/src/ @@ -28,7 +27,7 @@ GNU_CONFIGURE= yes INSTALL_TARGET= install-strip USE_LDCONFIG= yes -PLIST_SUB= MAJVER=${PORTVERSION:R} +PLIST_SUB= MAJVER=${PORTVERSION:R} SHLIBVER=${PORTVERSION:R:E} post-patch: @${REINPLACE_CMD} -e "s|@WITH_LIBCMIS_MAN_FALSE@|#|g" \ diff --git a/net/libcmis/distinfo b/net/libcmis/distinfo index 980bb6410bee..4d586b56f6d2 100644 --- a/net/libcmis/distinfo +++ b/net/libcmis/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1566266977 -SHA256 (libcmis-0.5.2.tar.xz) = d7b18d9602190e10d437f8a964a32e983afd57e2db316a07d87477a79f5000a2 -SIZE (libcmis-0.5.2.tar.xz) = 484404 +TIMESTAMP = 1700147751 +SHA256 (libcmis-0.6.2.tar.xz) = 1b5c2d7258ff93eb5f9958ff0e4dfd7332dc75a071bb717dde2217a26602a644 +SIZE (libcmis-0.6.2.tar.xz) = 488736 diff --git a/net/libcmis/files/patch-0001-rename-class-GetObject-to-avoid-name-clash-on-Windows b/net/libcmis/files/patch-0001-rename-class-GetObject-to-avoid-name-clash-on-Windows deleted file mode 100644 index c317a7b0acff..000000000000 --- a/net/libcmis/files/patch-0001-rename-class-GetObject-to-avoid-name-clash-on-Windows +++ /dev/null @@ -1,69 +0,0 @@ -From 219e6d6586c8280dfd9c4851cee0d14d68b6ad65 Mon Sep 17 00:00:00 2001 -From: David Tardon -Date: Fri, 28 Dec 2018 15:26:28 +0100 -Subject: [PATCH] rename class GetObject to avoid name clash on Windows - ---- - src/libcmis/ws-objectservice.cxx | 2 +- - src/libcmis/ws-requests.cxx | 2 +- - src/libcmis/ws-requests.hxx | 7 +++---- - 3 files changed, 5 insertions(+), 6 deletions(-) - -diff --git src/libcmis/ws-objectservice.cxx src/libcmis/ws-objectservice.cxx -index 9e40085..d57f3cc 100644 ---- src/libcmis/ws-objectservice.cxx -+++ src/libcmis/ws-objectservice.cxx -@@ -71,7 +71,7 @@ libcmis::ObjectPtr ObjectService::getObject( string repoId, string id ) - { - libcmis::ObjectPtr object; - -- class GetObject request( repoId, id ); -+ GetObjectRequest request( repoId, id ); - vector< SoapResponsePtr > responses = m_session->soapRequest( m_url, request ); - if ( responses.size( ) == 1 ) - { -diff --git src/libcmis/ws-requests.cxx src/libcmis/ws-requests.cxx -index f8bc245..408d053 100644 ---- src/libcmis/ws-requests.cxx -+++ src/libcmis/ws-requests.cxx -@@ -269,7 +269,7 @@ SoapResponsePtr GetTypeChildrenResponse::create( xmlNodePtr node, RelatedMultipa - return SoapResponsePtr( response ); - } - --void GetObject::toXml( xmlTextWriterPtr writer ) -+void GetObjectRequest::toXml( xmlTextWriterPtr writer ) - { - xmlTextWriterStartElement( writer, BAD_CAST( "cmism:getObject" ) ); - xmlTextWriterWriteAttribute( writer, BAD_CAST( "xmlns:cmis" ), BAD_CAST( NS_CMIS_URL ) ); -diff --git src/libcmis/ws-requests.hxx src/libcmis/ws-requests.hxx -index 2c4ae92..534d9a4 100644 ---- src/libcmis/ws-requests.hxx -+++ src/libcmis/ws-requests.hxx -@@ -203,21 +203,20 @@ class GetTypeChildrenResponse : public SoapResponse - std::vector< libcmis::ObjectTypePtr > getChildren( ) { return m_children; } - }; - --#undef GetObject --class GetObject : public SoapRequest -+class GetObjectRequest : public SoapRequest - { - private: - std::string m_repositoryId; - std::string m_id; - - public: -- GetObject( std::string repoId, std::string id ) : -+ GetObjectRequest( std::string repoId, std::string id ) : - m_repositoryId( repoId ), - m_id( id ) - { - } - -- ~GetObject( ) { } -+ ~GetObjectRequest( ) { } - - void toXml( xmlTextWriterPtr writer ); - }; --- -2.19.2 - diff --git a/net/libcmis/files/patch-0002-onedrive b/net/libcmis/files/patch-0002-onedrive deleted file mode 100644 index f42fafa3f139..000000000000 --- a/net/libcmis/files/patch-0002-onedrive +++ /dev/null @@ -1,445 +0,0 @@ -diff --git src/libcmis/http-session.cxx src/libcmis/http-session.cxx -index 2638482..227667e 100644 ---- src/libcmis/http-session.cxx -+++ src/libcmis/http-session.cxx -@@ -293,6 +293,94 @@ libcmis::HttpResponsePtr HttpSession::httpGetRequest( string url ) - return response; - } - -+libcmis::HttpResponsePtr HttpSession::httpPatchRequest( string url, istream& is, vector< string > headers ) -+{ -+ checkOAuth2( url ); -+ -+ // Duplicate istream in case we need to retry -+ string isStr( static_cast< stringstream const&>( stringstream( ) << is.rdbuf( ) ).str( ) ); -+ -+ istringstream isOriginal( isStr ), isBackup( isStr ); -+ -+ // Reset the handle for the request -+ curl_easy_reset( m_curlHandle ); -+ initProtocols( ); -+ -+ libcmis::HttpResponsePtr response( new libcmis::HttpResponse( ) ); -+ -+ curl_easy_setopt( m_curlHandle, CURLOPT_WRITEFUNCTION, lcl_bufferData ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_WRITEDATA, response->getData( ).get( ) ); -+ -+ curl_easy_setopt( m_curlHandle, CURLOPT_HEADERFUNCTION, &lcl_getHeaders ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_WRITEHEADER, response.get() ); -+ -+ curl_easy_setopt( m_curlHandle, CURLOPT_MAXREDIRS, 20); -+ -+ // Get the stream length -+ is.seekg( 0, ios::end ); -+ long size = is.tellg( ); -+ is.seekg( 0, ios::beg ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_INFILESIZE, size ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_READDATA, &isOriginal ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_READFUNCTION, lcl_readStream ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_UPLOAD, 1 ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_CUSTOMREQUEST, "PATCH" ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_IOCTLFUNCTION, lcl_ioctlStream ); -+ curl_easy_setopt( m_curlHandle, CURLOPT_IOCTLDATA, &isOriginal ); -+ -+ // If we know for sure that 100-Continue won't be accepted, -+ // don't even try with it to save one HTTP request. -+ if ( m_no100Continue ) -+ headers.push_back( "Expect:" ); -+ try -+ { -+ httpRunRequest( url, headers ); -+ response->getData( )->finish(); -+ } -+ catch ( const CurlException& ) -+ { -+ long status = getHttpStatus( ); -+ /** If we had a HTTP 417 response, this is likely to be due to some -+ HTTP 1.0 proxy / server not accepting the "Expect: 100-continue" -+ header. Try to disable this header and try again. -+ */ -+ if ( status == 417 && !m_no100Continue) -+ { -+ // Remember that we don't want 100-Continue for the future requests -+ m_no100Continue = true; -+ response = httpPutRequest( url, isBackup, headers ); -+ } -+ -+ // If the access token is expired, we get 401 error, -+ // Need to use the refresh token to get a new one. -+ if ( status == 401 && !getRefreshToken( ).empty( ) && !m_refreshedToken ) -+ { -+ -+ // Refresh the token -+ oauth2Refresh(); -+ -+ // Resend the query -+ try -+ { -+ // Avoid infinite recursive call -+ m_refreshedToken = true; -+ response = httpPutRequest( url, isBackup, headers ); -+ m_refreshedToken = false; -+ } -+ catch (const CurlException&) -+ { -+ m_refreshedToken = false; -+ throw; -+ } -+ } -+ // Has tried but failed -+ if ( ( status != 417 || m_no100Continue ) && -+ ( status != 401 || getRefreshToken( ).empty( ) || m_refreshedToken ) ) throw; -+ } -+ m_refreshedToken = false; -+ return response; -+} -+ - libcmis::HttpResponsePtr HttpSession::httpPutRequest( string url, istream& is, vector< string > headers ) - { - checkOAuth2( url ); -diff --git src/libcmis/http-session.hxx src/libcmis/http-session.hxx -index 851d52d..29de64d 100644 ---- src/libcmis/http-session.hxx -+++ src/libcmis/http-session.hxx -@@ -132,6 +132,9 @@ class HttpSession - virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 ); - - libcmis::HttpResponsePtr httpGetRequest( std::string url ); -+ libcmis::HttpResponsePtr httpPatchRequest( std::string url, -+ std::istream& is, -+ std::vector< std::string > headers ); - libcmis::HttpResponsePtr httpPutRequest( std::string url, - std::istream& is, - std::vector< std::string > headers ); -diff --git src/libcmis/oauth2-handler.cxx src/libcmis/oauth2-handler.cxx -index a3320e3..842769f 100644 ---- src/libcmis/oauth2-handler.cxx -+++ src/libcmis/oauth2-handler.cxx -@@ -91,8 +91,8 @@ void OAuth2Handler::fetchTokens( string authCode ) - string post = - "code=" + authCode + - "&client_id=" + m_data->getClientId() + -- "&client_secret=" + m_data->getClientSecret() + - "&redirect_uri=" + m_data->getRedirectUri() + -+ "&scope=" + libcmis::escape( m_data->getScope() ) + - "&grant_type=authorization_code" ; - - istringstream is( post ); -@@ -121,7 +121,6 @@ void OAuth2Handler::refresh( ) - string post = - "refresh_token=" + m_refresh + - "&client_id=" + m_data->getClientId() + -- "&client_secret=" + m_data->getClientSecret() + - "&grant_type=refresh_token" ; - - istringstream is( post ); -diff --git src/libcmis/oauth2-providers.cxx src/libcmis/oauth2-providers.cxx -index 8cf9652..654021f 100644 ---- src/libcmis/oauth2-providers.cxx -+++ src/libcmis/oauth2-providers.cxx -@@ -312,7 +312,7 @@ OAuth2Parser OAuth2Providers::getOAuth2Parser( const std::string& url ) - return OAuth2Alfresco; - else if ( boost::starts_with( url, "https://www.googleapis.com/drive/v2" ) ) - return OAuth2Gdrive; -- else if ( boost::starts_with( url, "https://apis.live.net/v5.0" ) ) -+ else if ( boost::starts_with( url, "https://graph.microsoft.com/v1.0" ) ) - return OAuth2Onedrive; - - return OAuth2Gdrive; -diff --git src/libcmis/onedrive-document.cxx src/libcmis/onedrive-document.cxx -index f753b42..863a92f 100644 ---- src/libcmis/onedrive-document.cxx -+++ src/libcmis/onedrive-document.cxx -@@ -73,7 +73,7 @@ boost::shared_ptr< istream > OneDriveDocument::getContentStream( string /*stream - boost::shared_ptr< istream > stream; - string streamUrl = getStringProperty( "source" ); - if ( streamUrl.empty( ) ) -- throw libcmis::Exception( "can not found stream url" ); -+ throw libcmis::Exception( "could not find stream url" ); - - try - { -@@ -89,15 +89,15 @@ boost::shared_ptr< istream > OneDriveDocument::getContentStream( string /*stream - void OneDriveDocument::setContentStream( boost::shared_ptr< ostream > os, - string /*contentType*/, - string fileName, -- bool /*overwrite*/ ) -+ bool bReplaceExisting ) - { - if ( !os.get( ) ) - throw libcmis::Exception( "Missing stream" ); -- -+ - string metaUrl = getUrl( ); - - // Update file name meta information -- if ( !fileName.empty( ) && fileName != getContentFilename( ) ) -+ if ( bReplaceExisting && !fileName.empty( ) && fileName != getContentFilename( ) ) - { - Json metaJson; - Json fileJson( fileName.c_str( ) ); -@@ -108,7 +108,7 @@ void OneDriveDocument::setContentStream( boost::shared_ptr< ostream > os, - headers.push_back( "Content-Type: application/json" ); - try - { -- getSession()->httpPutRequest( metaUrl, is, headers ); -+ getSession()->httpPatchRequest( metaUrl, is, headers ); - } - catch ( const CurlException& e ) - { -@@ -117,9 +117,9 @@ void OneDriveDocument::setContentStream( boost::shared_ptr< ostream > os, - } - - fileName = libcmis::escape( getStringProperty( "cmis:name" ) ); -- string putUrl = getSession( )->getBindingUrl( ) + "/" + -- getStringProperty( "cmis:parentId" ) + "/files/" + -- fileName + "?overwrite=true"; -+ string putUrl = getSession( )->getBindingUrl( ) + "/me/drive/items/" + -+ getStringProperty( "cmis:parentId" ) + ":/" + -+ fileName + ":/content"; - - // Upload stream - boost::shared_ptr< istream> is ( new istream ( os->rdbuf( ) ) ); -@@ -142,6 +142,7 @@ void OneDriveDocument::setContentStream( boost::shared_ptr< ostream > os, - libcmis::DocumentPtr OneDriveDocument::checkOut( ) - { - // OneDrive doesn't have CheckOut, so just return the same document here -+ // TODO: no longer true - onedrive now has checkout/checkin - libcmis::ObjectPtr obj = getSession( )->getObject( getId( ) ); - libcmis::DocumentPtr checkout = - boost::dynamic_pointer_cast< libcmis::Document > ( obj ); -diff --git src/libcmis/onedrive-folder.cxx src/libcmis/onedrive-folder.cxx -index a9ae694..c1980c8 100644 ---- src/libcmis/onedrive-folder.cxx -+++ src/libcmis/onedrive-folder.cxx -@@ -57,7 +57,9 @@ OneDriveFolder::~OneDriveFolder( ) - vector< libcmis::ObjectPtr > OneDriveFolder::getChildren( ) - { - vector< libcmis::ObjectPtr > children; -- string query = getSession( )->getBindingUrl( ) + "/" + getId( ) + "/files"; -+ // TODO: limited to 200 items by default - to get more one would have to -+ // follow @odata.nextLink or change pagination size -+ string query = getSession( )->getBindingUrl( ) + "/me/drive/items/" + getId( ) + "/children"; - - string res; - try -@@ -70,7 +72,7 @@ vector< libcmis::ObjectPtr > OneDriveFolder::getChildren( ) - } - - Json jsonRes = Json::parse( res ); -- Json::JsonVector objs = jsonRes["data"].getList( ); -+ Json::JsonVector objs = jsonRes["value"].getList( ); - - // Create children objects from Json objects - for(unsigned int i = 0; i < objs.size(); i++) -@@ -85,8 +87,7 @@ libcmis::FolderPtr OneDriveFolder::createFolder( - const PropertyPtrMap& properties ) - { - Json propsJson = OneDriveUtils::toOneDriveJson( properties ); -- -- string uploadUrl = getSession( )->getBindingUrl( ) + "/" + getId( ); -+ string uploadUrl = getSession( )->getBindingUrl( ) + "/me/drive/items/" + getId( ) + "/children"; - - std::istringstream is( propsJson.toString( ) ); - string response; -@@ -126,9 +127,10 @@ libcmis::DocumentPtr OneDriveFolder::createDocument( - } - } - -+ // TODO: limited to 4MB, larger uploads need dedicated UploadSession - fileName = libcmis::escape( fileName ); -- string newDocUrl = getSession( )->getBindingUrl( ) + "/" + -- getId( ) + "/files/" + fileName; -+ string newDocUrl = getSession( )->getBindingUrl( ) + "/me/drive/items/" + -+ getId( ) + ":/" + fileName + ":/content"; - boost::shared_ptr< istream> is ( new istream ( os->rdbuf( ) ) ); - vector< string > headers; - string res; -diff --git src/libcmis/onedrive-object.cxx src/libcmis/onedrive-object.cxx -index 976a97b..8deb591 100644 ---- src/libcmis/onedrive-object.cxx -+++ src/libcmis/onedrive-object.cxx -@@ -65,7 +65,7 @@ void OneDriveObject::initializeFromJson ( Json json, string /*id*/, string /*nam - Json::JsonObject objs = json.getObjects( ); - Json::JsonObject::iterator it; - PropertyPtr property; -- bool isFolder = json["type"].toString( ) == "folder"; -+ bool isFolder = json["folder"].toString( ) != ""; - for ( it = objs.begin( ); it != objs.end( ); ++it) - { - property.reset( new OneDriveProperty( it->first, it->second ) ); -@@ -74,7 +74,12 @@ void OneDriveObject::initializeFromJson ( Json json, string /*id*/, string /*nam - { - property.reset( new OneDriveProperty( "cmis:contentStreamFileName", it->second ) ); - m_properties[ property->getPropertyType( )->getId()] = property; -- } -+ } else if ( it->first == "parentReference" ) { -+ if (it->second["id"].toString() != "") { -+ property.reset( new OneDriveProperty( "cmis:parentId", it->second["id"] ) ); -+ m_properties[ property->getPropertyType( )->getId()] = property; -+ } -+ } - } - - m_refreshTimestamp = time( NULL ); -@@ -122,7 +127,7 @@ void OneDriveObject::remove( bool /*allVersions*/ ) - - string OneDriveObject::getUrl( ) - { -- return getSession( )->getBindingUrl( ) + "/" + getId( ); -+ return getSession( )->getBindingUrl( ) + "/me/drive/items/" + getId( ); - } - - string OneDriveObject::getUploadUrl( ) -@@ -152,7 +157,7 @@ libcmis::ObjectPtr OneDriveObject::updateProperties( - { - vector< string > headers; - headers.push_back( "Content-Type: application/json" ); -- response = getSession( )->httpPutRequest( getUrl( ), is, headers ); -+ response = getSession( )->httpPatchRequest( getUrl( ), is, headers ); - } - catch ( const CurlException& e ) - { -diff --git src/libcmis/onedrive-repository.cxx src/libcmis/onedrive-repository.cxx -index 3eaac9c..b01f5c2 100644 ---- src/libcmis/onedrive-repository.cxx -+++ src/libcmis/onedrive-repository.cxx -@@ -35,7 +35,7 @@ OneDriveRepository::OneDriveRepository( ) : - m_description = "One Drive repository"; - m_productName = "One Drive"; - m_productVersion = "v5"; -- m_rootId = "me/skydrive"; -+ m_rootId = "/me/drive/root"; - - m_capabilities[ ACL ] = "discover"; - m_capabilities[ AllVersionsSearchable ] = "true"; -diff --git src/libcmis/onedrive-session.cxx src/libcmis/onedrive-session.cxx -index c6f4270..a603278 100644 ---- src/libcmis/onedrive-session.cxx -+++ src/libcmis/onedrive-session.cxx -@@ -79,7 +79,9 @@ libcmis::ObjectPtr OneDriveSession::getObject( string objectId ) - { - // Run the http request to get the properties definition - string res; -- string objectLink = m_bindingUrl + "/" + objectId; -+ string objectLink = m_bindingUrl + "/me/drive/items/" + objectId; -+ if (objectId == getRootId()) -+ objectLink = m_bindingUrl + objectId; - try - { - res = httpGetRequest( objectLink )->getStream()->str(); -@@ -95,12 +97,11 @@ libcmis::ObjectPtr OneDriveSession::getObject( string objectId ) - libcmis::ObjectPtr OneDriveSession::getObjectFromJson( Json& jsonRes ) - { - libcmis::ObjectPtr object; -- string kind = jsonRes["type"].toString( ); -- if ( kind == "folder" || kind == "album" ) -+ if ( jsonRes["folder"].toString() != "" ) - { - object.reset( new OneDriveFolder( this, jsonRes ) ); - } -- else if ( kind == "file" ) -+ else if ( jsonRes["file"].toString() != "" ) - { - object.reset( new OneDriveDocument( this, jsonRes ) ); - } -@@ -113,44 +114,18 @@ libcmis::ObjectPtr OneDriveSession::getObjectFromJson( Json& jsonRes ) - - libcmis::ObjectPtr OneDriveSession::getObjectByPath( string path ) - { -- string id; -- if ( path == "/" ) -- { -- id = "me/skydrive"; -- } -- else -+ string res; -+ string objectQuery = m_bindingUrl + "/me/drive/root:" + libcmis::escape( path ); -+ try - { -- path = "/SkyDrive" + path; -- size_t pos = path.rfind("/"); -- string name = libcmis::escape( path.substr( pos + 1, path.size( ) ) ); -- string res; -- string objectQuery = m_bindingUrl + "/me/skydrive/search?q=" + name; -- try -- { -- res = httpGetRequest( objectQuery )->getStream( )->str( ); -- } -- catch ( const CurlException& e ) -- { -- throw e.getCmisException( ); -- } -- Json jsonRes = Json::parse( res ); -- Json::JsonVector objs = jsonRes["data"].getList( ); -- -- // Searching for a match in the path to the object -- for ( unsigned int i = 0; i < objs.size( ); i++ ) -- { -- if ( isAPathMatch( objs[i], path ) ) -- { -- id = objs[i]["id"].toString( ); -- break; -- } -- } -+ res = httpGetRequest( objectQuery )->getStream( )->str( ); - } -- if ( id.empty( ) ) -+ catch ( const CurlException& e ) - { -- throw libcmis::Exception( "No file could be found" ); -+ throw libcmis::Exception( "No file could be found for path " + path + ": " + e.what() ); - } -- return getObject( id ); -+ Json jsonRes = Json::parse( res ); -+ return getObjectFromJson( jsonRes ); - } - - bool OneDriveSession::isAPathMatch( Json objectJson, string path ) -diff --git src/libcmis/onedrive-utils.cxx src/libcmis/onedrive-utils.cxx -index dc6ec5d..17ed324 100644 ---- src/libcmis/onedrive-utils.cxx -+++ src/libcmis/onedrive-utils.cxx -@@ -44,16 +44,16 @@ string OneDriveUtils::toCmisKey( const string& key ) - convertedKey = "cmis:createdBy"; - else if ( key == "description" ) - convertedKey = "cmis:description"; -- else if ( key == "created_time" ) -+ else if ( key == "createdDateTime" ) - convertedKey = "cmis:creationDate"; -- else if ( key == "updated_time" ) -+ else if ( key == "lastModifiedDateTime" ) - convertedKey = "cmis:lastModificationDate"; - else if ( key == "name" ) - convertedKey = "cmis:name"; - else if ( key == "size" ) - convertedKey = "cmis:contentStreamLength"; -- else if ( key == "parent_id" ) -- convertedKey = "cmis:parentId"; -+ else if ( key == "@microsoft.graph.downloadUrl" ) -+ convertedKey = "source"; - else convertedKey = key; - return convertedKey; - } -@@ -75,8 +75,6 @@ string OneDriveUtils::toOneDriveKey( const string& key ) - convertedKey = "name"; - else if ( key == "cmis:contentStreamLength" ) - convertedKey = "file_size"; -- else if ( key == "cmis:parentId" ) -- convertedKey = "parent_id"; - else convertedKey = key; - return convertedKey; - } -diff --git src/libcmis/session-factory.cxx src/libcmis/session-factory.cxx -index ba55cd9..e740afb 100644 ---- src/libcmis/session-factory.cxx -+++ src/libcmis/session-factory.cxx -@@ -71,7 +71,7 @@ namespace libcmis - session = new GDriveSession( bindingUrl, username, password, - oauth2, verbose ); - } -- else if ( bindingUrl == "https://apis.live.net/v5.0" ) -+ else if ( bindingUrl == "https://graph.microsoft.com/v1.0" ) - { - session = new OneDriveSession( bindingUrl, username, password, - oauth2, verbose); diff --git a/net/libcmis/files/patch-0003-oauth_pw_as_refreshtoken b/net/libcmis/files/patch-0003-oauth_pw_as_refreshtoken deleted file mode 100644 index ffc34f0943b7..000000000000 --- a/net/libcmis/files/patch-0003-oauth_pw_as_refreshtoken +++ /dev/null @@ -1,185 +0,0 @@ -diff -ur inc/libcmis/session.hxx inc/libcmis/session.hxx ---- inc/libcmis/session.hxx 2021-07-27 19:09:42.580249917 +0200 -+++ inc/libcmis/session.hxx 2021-07-27 19:10:02.368249199 +0200 -@@ -95,6 +95,8 @@ - certificate exception feature available on common web browser. - */ - virtual void setNoSSLCertificateCheck( bool noCheck ) = 0; -+ -+ virtual std::string getRefreshToken() { return ""; }; - }; - } - -diff -ur src/libcmis/gdrive-session.cxx src/libcmis/gdrive-session.cxx ---- src/libcmis/gdrive-session.cxx 2021-07-27 19:09:42.581249917 +0200 -+++ src/libcmis/gdrive-session.cxx 2021-07-27 19:10:02.369249198 +0200 -@@ -70,6 +70,46 @@ - { - } - -+ -+void GDriveSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 ) -+{ -+ m_oauth2Handler = new OAuth2Handler( this, oauth2 ); -+ m_oauth2Handler->setOAuth2Parser( OAuth2Providers::getOAuth2Parser( getBindingUrl( ) ) ); -+ -+ oauth2Authenticate( ); -+} -+ -+void GDriveSession::oauth2Authenticate() -+{ -+ // treat the supplied password as refresh token -+ if (!m_password.empty()) -+ { -+ try -+ { -+ m_inOAuth2Authentication = true; -+ -+ m_oauth2Handler->setRefreshToken(m_password); -+ // Try to get new access tokens using the stored refreshtoken -+ m_oauth2Handler->refresh(); -+ m_inOAuth2Authentication = false; -+ } -+ catch (const CurlException &e) -+ { -+ m_inOAuth2Authentication = false; -+ // refresh token expired or invalid, trigger initial auth (that in turn will hit the fallback with copy'n'paste method) -+ BaseSession::oauth2Authenticate(); -+ } -+ } -+ else -+ { -+ BaseSession::oauth2Authenticate(); -+ } -+} -+ -+string GDriveSession::getRefreshToken() { -+ return HttpSession::getRefreshToken(); -+} -+ - libcmis::RepositoryPtr GDriveSession::getRepository( ) - { - // Return a dummy repository since GDrive doesn't have that notion -diff -ur src/libcmis/gdrive-session.hxx src/libcmis/gdrive-session.hxx ---- src/libcmis/gdrive-session.hxx 2021-07-27 19:09:42.583249917 +0200 -+++ src/libcmis/gdrive-session.hxx 2021-07-27 19:10:02.369249198 +0200 -@@ -57,8 +57,14 @@ - - virtual std::vector< libcmis::ObjectTypePtr > getBaseTypes( ); - -+ virtual std::string getRefreshToken(); -+ - private: - GDriveSession( ); -+ -+ virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 ); -+ -+ void oauth2Authenticate( ); - }; - - #endif /* _GDRIVE_SESSION_HXX_ */ -diff -ur src/libcmis/http-session.hxx src/libcmis/http-session.hxx ---- src/libcmis/http-session.hxx 2021-07-27 19:09:42.582249917 +0200 -+++ src/libcmis/http-session.hxx 2021-07-27 19:10:02.369249198 +0200 -@@ -148,7 +148,7 @@ - - void setNoSSLCertificateCheck( bool noCheck ); - -- std::string getRefreshToken( ); -+ virtual std::string getRefreshToken( ); - - protected: - HttpSession( ); -diff -ur src/libcmis/oauth2-handler.cxx src/libcmis/oauth2-handler.cxx ---- src/libcmis/oauth2-handler.cxx 2021-07-27 19:09:42.582249917 +0200 -+++ src/libcmis/oauth2-handler.cxx 2021-07-27 19:10:02.369249198 +0200 -@@ -158,6 +158,11 @@ - return m_refresh; - } - -+void OAuth2Handler::setRefreshToken( string refreshToken ) -+{ -+ m_refresh = refreshToken; -+} -+ - string OAuth2Handler::getHttpHeader( ) - { - string header; -diff -ur src/libcmis/oauth2-handler.hxx src/libcmis/oauth2-handler.hxx ---- src/libcmis/oauth2-handler.hxx 2021-07-27 19:09:42.582249917 +0200 -+++ src/libcmis/oauth2-handler.hxx 2021-07-27 19:10:02.370249198 +0200 -@@ -61,6 +61,7 @@ - - std::string getAccessToken( ) ; - std::string getRefreshToken( ) ; -+ void setRefreshToken( std::string refreshToken ) ; - - // adding HTTP auth header - std::string getHttpHeader( ) ; -diff -ur src/libcmis/onedrive-session.cxx src/libcmis/onedrive-session.cxx ---- src/libcmis/onedrive-session.cxx 2021-07-27 19:09:42.583249917 +0200 -+++ src/libcmis/onedrive-session.cxx 2021-07-27 19:10:02.370249198 +0200 -@@ -68,6 +68,45 @@ - { - } - -+void OneDriveSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 ) -+{ -+ m_oauth2Handler = new OAuth2Handler( this, oauth2 ); -+ m_oauth2Handler->setOAuth2Parser( OAuth2Providers::getOAuth2Parser( getBindingUrl( ) ) ); -+ -+ oauth2Authenticate( ); -+} -+ -+void OneDriveSession::oauth2Authenticate() -+{ -+ // treat the supplied password as refresh token -+ if (!m_password.empty()) -+ { -+ try -+ { -+ m_inOAuth2Authentication = true; -+ -+ m_oauth2Handler->setRefreshToken(m_password); -+ // Try to get new access tokens using the stored refreshtoken -+ m_oauth2Handler->refresh(); -+ m_inOAuth2Authentication = false; -+ } -+ catch (const CurlException &e) -+ { -+ m_inOAuth2Authentication = false; -+ // refresh token expired or invalid, trigger initial auth (that in turn will hit the fallback with copy'n'paste method) -+ BaseSession::oauth2Authenticate(); -+ } -+ } -+ else -+ { -+ BaseSession::oauth2Authenticate(); -+ } -+} -+ -+string OneDriveSession::getRefreshToken() { -+ return HttpSession::getRefreshToken(); -+} -+ - libcmis::RepositoryPtr OneDriveSession::getRepository( ) - { - // Return a dummy repository since OneDrive doesn't have that notion -diff -ur src/libcmis/onedrive-session.hxx src/libcmis/onedrive-session.hxx ---- src/libcmis/onedrive-session.hxx 2021-07-27 19:09:42.583249917 +0200 -+++ src/libcmis/onedrive-session.hxx 2021-07-27 19:10:02.370249198 +0200 -@@ -62,8 +62,14 @@ - - bool isAPathMatch( Json objectJson, std::string path ); - -+ virtual std::string getRefreshToken(); -+ - private: - OneDriveSession( ); -+ -+ virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 ); -+ -+ void oauth2Authenticate( ); - }; - - #endif /* _ONEDRIVE_SESSION_HXX_ */ diff --git a/net/libcmis/files/patch-0004-gdrive b/net/libcmis/files/patch-0004-gdrive deleted file mode 100644 index 0239184be4a8..000000000000 --- a/net/libcmis/files/patch-0004-gdrive +++ /dev/null @@ -1,702 +0,0 @@ -diff -ur src/libcmis/gdrive-document.cxx src/libcmis/gdrive-document.cxx ---- src/libcmis/gdrive-document.cxx 2021-07-27 19:11:02.679247008 +0200 -+++ src/libcmis/gdrive-document.cxx 2021-07-27 19:11:18.873246420 +0200 -@@ -145,23 +145,17 @@ - { - if ( !os.get( ) ) - throw libcmis::Exception( "Missing stream" ); -- if ( !isImmutable( ) ) -- throw libcmis::Exception( string ( "Document " + getId( )+ -- " is not editable" ) ); -- string putUrl = getUploadUrl( ) + getId( ); -- putUrl += "?uploadType=media"; -- -- // If it's a Google document, convert it -- if ( isGoogleDoc( ) ) -- putUrl += "&convert=true"; -+ -+ string putUrl = GDRIVE_UPLOAD_LINK + getId( ) + "?uploadType=media"; - - // Upload stream - boost::shared_ptr< istream> is ( new istream ( os->rdbuf( ) ) ); - vector headers; - headers.push_back( string( "Content-Type: " ) + contentType ); -+ string res; - try - { -- getSession()->httpPutRequest( putUrl, *is, headers ); -+ res = getSession()->httpPatchRequest( putUrl, *is, headers )->getStream()->str(); - } - catch ( const CurlException& e ) - { -@@ -181,35 +175,10 @@ - { - if ( !os.get( ) ) - throw libcmis::Exception( "Missing stream" ); -- -- if ( !isImmutable( ) ) -- throw libcmis::Exception( string ( "Document " + getId( )+ -- " is not editable" ) ); -- string metaUrl = getUrl( ); -- -- // If it's a Google document, convert it -- if ( isGoogleDoc( ) ) -- metaUrl += "?convert=true"; -- -- // Update file name meta information -- if ( !fileName.empty( ) && fileName != getContentFilename( ) ) -- { -- Json metaJson; -- Json fileJson( fileName.c_str( ) ); -- metaJson.add("title", fileJson ); -- -- std::istringstream is( metaJson.toString( ) ); -- vector headers; -- headers.push_back( "Content-Type: application/json" ); -- try -- { -- getSession()->httpPutRequest( metaUrl, is, headers ); -- } -- catch ( const CurlException& e ) -- { -- throw e.getCmisException( ); -- } -- } -+ -+ // TODO: when would the filename need an update? -+ if (!fileName.empty() && fileName != getContentFilename()) -+ std::cout << "filename change is not implemented in setContentStream" << std::endl; - - // Upload stream - uploadStream( os, contentType ); -@@ -251,7 +220,7 @@ - vector< libcmis::DocumentPtr > GDriveDocument::getAllVersions( ) - { - vector< libcmis::DocumentPtr > revisions; -- string versionUrl = getUrl( ) + "/revisions"; -+ string versionUrl = GDRIVE_METADATA_LINK + getId( ) + "/revisions"; - // Run the http request to get the properties definition - string res; - try -@@ -263,7 +232,7 @@ - throw e.getCmisException( ); - } - Json jsonRes = Json::parse( res ); -- Json::JsonVector objs = jsonRes["items"].getList( ); -+ Json::JsonVector objs = jsonRes["revisions"].getList( ); - - string parentId = getStringProperty( "cmis:parentId" ); - -diff -ur src/libcmis/gdrive-folder.cxx src/libcmis/gdrive-folder.cxx ---- src/libcmis/gdrive-folder.cxx 2021-07-27 19:11:02.678247008 +0200 -+++ src/libcmis/gdrive-folder.cxx 2021-07-27 19:11:18.874246420 +0200 -@@ -62,8 +62,8 @@ - // Instead of sending multiple queries for children, - // we send a single query to search for objects where parents - // include the folderID. -- string query = getSession( )->getBindingUrl( ) + -- "/files?q=\"" + getId( ) + "\"+in+parents+and+trashed+=+false"; -+ string query = GDRIVE_METADATA_LINK + "?q=\"" + getId( ) + "\"+in+parents+and+trashed+=+false" + -+ "&fields=files(kind,id,name,parents,mimeType,createdTime,modifiedTime,thumbnailLink,size)"; - - string res; - try -@@ -76,7 +76,7 @@ - } - - Json jsonRes = Json::parse( res ); -- Json::JsonVector objs = jsonRes["items"].getList( ); -+ Json::JsonVector objs = jsonRes["files"].getList( ); - - // Create children objects from Json objects - for(unsigned int i = 0; i < objs.size(); i++) -@@ -95,7 +95,7 @@ - string GDriveFolder::uploadProperties( Json properties ) - { - // URL for uploading meta data -- string metaUrl = getSession()->getBindingUrl() + "/files/"; -+ string metaUrl = GDRIVE_METADATA_LINK + "?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime"; - - // add parents to the properties - properties.add( "parents", GdriveUtils::createJsonFromParentId( getId( ) ) ); -@@ -147,9 +147,15 @@ - - Json propsJson = GdriveUtils::toGdriveJson( properties ); - -- // Add filename to properties -- Json jsonFilename( fileName.c_str( ) ); -- propsJson.add( "title", jsonFilename ); -+ if(!fileName.empty()) { -+ // use provided filename -+ Json jsonFilename( fileName.c_str( ) ); -+ -+ propsJson.add( "name", jsonFilename ); -+ } -+ if(!contentType.empty()) { -+ propsJson.add( "mimeType", Json(contentType.c_str())); -+ } - - // Upload meta-datas - string res = uploadProperties( propsJson); -@@ -171,12 +177,9 @@ - libcmis::UnfileObjects::Type /*unfile*/, - bool /*continueOnError*/ ) - { -- // Object remove doesn't work with folder -- // Using trash instead - try - { -- istringstream is( "" ); -- getSession( )->httpPostRequest( getUrl( ) + "/trash", is, "" ); -+ getSession( )->httpDeleteRequest( GDRIVE_METADATA_LINK + getId( ) ); - } - catch ( const CurlException& e ) - { -diff -ur src/libcmis/gdrive-object.cxx src/libcmis/gdrive-object.cxx ---- src/libcmis/gdrive-object.cxx 2021-07-27 19:11:02.675247009 +0200 -+++ src/libcmis/gdrive-object.cxx 2021-07-27 19:11:18.874246420 +0200 -@@ -89,8 +89,8 @@ - property.reset( new GDriveProperty( it->first, it->second ) ); - m_properties[ property->getPropertyType( )->getId()] = property; - -- // we map "title" to both "cmis:name" and "cmis:getContentStreamFileName" -- if ( it->first == "title" ) -+ // we map "name" to both "cmis:name" and "cmis:getContentStreamFileName" -+ if ( it->first == "name" ) - { - property.reset( new GDriveProperty( "cmis:name", it->second) ); - m_properties[ property->getPropertyType( )->getId()] = property; -@@ -142,16 +142,13 @@ - { - if ( m_renditions.empty( ) ) - { -- string downloadUrl = getStringProperty( "downloadUrl" ); -- if ( !downloadUrl.empty( ) ) -- { -- string mimeType = getStringProperty( "cmis:contentStreamMimeType" ); -- if ( !mimeType.empty( ) ) -- { -- RenditionPtr rendition( -- new Rendition( mimeType, mimeType, mimeType, downloadUrl )); -- m_renditions.push_back( rendition ); -- } -+ string downloadUrl = GDRIVE_METADATA_LINK + getId( ) + "?alt=media"; -+ string mimeType = getStringProperty( "cmis:contentStreamMimeType" ); -+ if ( !mimeType.empty( ) ) -+ { -+ RenditionPtr rendition( -+ new Rendition( mimeType, mimeType, mimeType, downloadUrl )); -+ m_renditions.push_back( rendition ); - } - - vector< string > exportLinks = getMultiStringProperty( "exportLinks" ); -@@ -192,7 +189,7 @@ - { - vector< string > headers; - headers.push_back( "Content-Type: application/json" ); -- response = getSession( )->httpPutRequest( getUrl( ), is, headers ); -+ response = getSession( )->httpPatchRequest( getUrl( ), is, headers ); - } - catch ( const CurlException& e ) - { -@@ -228,7 +225,7 @@ - { - try *** 518 LINES SKIPPED ***