[PATCH] Change in core[libreoffice-4-0]: CMIS: use the proxy settings from the options

Bosdonnat Cedric (via Code Review) gerrit at gerrit.libreoffice.org
Thu Jan 24 05:34:01 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1842

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/42/1842/1

CMIS: use the proxy settings from the options

Change-Id: I5b856ac166b67097e1921ec71eb5b7e1819fec41
---
M libcmis/UnpackedTarball_cmis.mk
A libcmis/libcmis-0.3.0-proxy.patch
M ucb/source/ucp/cmis/cmis_content.cxx
M ucb/source/ucp/cmis/cmis_repo_content.cxx
4 files changed, 1,107 insertions(+), 0 deletions(-)



diff --git a/libcmis/UnpackedTarball_cmis.mk b/libcmis/UnpackedTarball_cmis.mk
index ce10efe..a25c316 100644
--- a/libcmis/UnpackedTarball_cmis.mk
+++ b/libcmis/UnpackedTarball_cmis.mk
@@ -17,6 +17,7 @@
 	libcmis/libcmis-0.3.0-warnings.patch \
 	libcmis/libcmis-0.3.0-win.patch \
 	libcmis/libcmis-0.3.0.patch \
+	libcmis/libcmis-0.3.0-proxy.patch \
 ))
 
 ifeq ($(OS)$(COM),WNTMSC)
diff --git a/libcmis/libcmis-0.3.0-proxy.patch b/libcmis/libcmis-0.3.0-proxy.patch
new file mode 100644
index 0000000..7311b02
--- /dev/null
+++ b/libcmis/libcmis-0.3.0-proxy.patch
@@ -0,0 +1,1088 @@
+diff --git NEWS NEWS
+index 6e9c10d..0047613 100644
+--- NEWS
++++ NEWS
+@@ -50,3 +50,6 @@
+   * Session factory automatically detects which binding to use
+   * C wrapper API
+   * Unit tests are now split between quick ones and the ones needing a CMIS server
++
++0.3.1
++  * Added support for proxy configuration
+diff --git doc/cmis-client.xml doc/cmis-client.xml
+index b7dce51..2d6cdea 100644
+--- doc/cmis-client.xml
++++ doc/cmis-client.xml
+@@ -213,6 +213,41 @@
+ 						</para>
+           </listitem>
+         </varlistentry>
++        <varlistentry>
++          <term>--proxy <replaceable class="parameter">url</replaceable></term>
++          <listitem>
++            <para>
++                Use <replaceable class="parameter">url</replaceable> as the HTTP proxy.
++                Setting this value will override the system proxy settings.
++						</para>
++          </listitem>
++        </varlistentry>
++        <varlistentry>
++          <term>--proxy-username <replaceable class="parameter">login</replaceable></term>
++          <listitem>
++            <para>
++							Use <replaceable class="parameter">login</replaceable> to authenticate on the HTTP proxy.
++						</para>
++          </listitem>
++        </varlistentry>
++        <varlistentry>
++          <term>--proxy-password <replaceable class="parameter">secret</replaceable></term>
++          <listitem>
++            <para>
++							Use <replaceable class="parameter">secret</replaceable> to authenticate on the HTTP proxy.
++						</para>
++          </listitem>
++        </varlistentry>
++        <varlistentry>
++          <term>--noproxy <replaceable class="parameter">list</replaceable></term>
++          <listitem>
++            <para>
++                Proxy settings won't apply to hostnames and domain names listed 
++                in <replaceable class="parameter">list</replaceable>.
++                This value is a coma separated list.
++						</para>
++          </listitem>
++        </varlistentry>
+       </variablelist>
+     </refsect2>
+     <refsect2>
+diff --git src/cmis-client.cxx src/cmis-client.cxx
+index 587a05b..432e140 100644
+--- src/cmis-client.cxx
++++ src/cmis-client.cxx
+@@ -121,11 +121,32 @@ libcmis::Session* CmisClient::getSession( ) throw ( CommandException, libcmis::E
+             password = m_vm["password"].as< string >();
+     }
+ 
++    // Look for proxy settings
++    string proxyUrl;
++    string proxyUser;
++    string proxyPass;
++    string noproxy;
++    if ( m_vm.count( "proxy" ) > 0 )
++    {
++        proxyUrl = m_vm["proxy"].as< string >();
++
++        if ( m_vm.count( "proxy-user" ) > 0 )
++            proxyUser = m_vm["proxy-user"].as< string >();
++        
++        if ( m_vm.count( "proxy-password" ) > 0 )
++            proxyPass = m_vm["proxy-password"].as< string >();
++
++        if ( m_vm.count( "noproxy" ) > 0 )
++            noproxy = m_vm["noproxy"].as< string >();
++
++        libcmis::SessionFactory::setProxySettings( proxyUrl, noproxy, proxyUser, proxyPass );
++    }
+ 
+     bool verbose = m_vm.count( "verbose" ) > 0;
+ 
+     string repoId;
+-    list< libcmis::RepositoryPtr > repositories = libcmis::SessionFactory:: getRepositories( url, username, password, verbose );
++    list< libcmis::RepositoryPtr > repositories = libcmis::SessionFactory::getRepositories(
++            url, username, password, verbose );
+     if ( repositories.size( ) == 1 )
+         repoId = repositories.front( )->getId( );
+     else
+@@ -169,10 +190,31 @@ void CmisClient::execute( ) throw ( exception )
+                     password = m_vm["password"].as< string >();
+             }
+ 
++            // Look for proxy settings
++            string proxyUrl;
++            string proxyUser;
++            string proxyPass;
++            string noproxy;
++            if ( m_vm.count( "proxy" ) > 0 )
++            {
++                proxyUrl = m_vm["proxy"].as< string >();
++
++                if ( m_vm.count( "proxy-user" ) > 0 )
++                    proxyUser = m_vm["proxy-user"].as< string >();
++                
++                if ( m_vm.count( "proxy-password" ) > 0 )
++                    proxyPass = m_vm["proxy-password"].as< string >();
++
++                if ( m_vm.count( "noproxy" ) > 0 )
++                    noproxy = m_vm["noproxy"].as< string >();
++
++                libcmis::SessionFactory::setProxySettings( proxyUrl, noproxy, proxyUser, proxyPass );
++            }
+ 
+             bool verbose = m_vm.count( "verbose" ) > 0;
+ 
+-            list< libcmis::RepositoryPtr > repos = libcmis::SessionFactory::getRepositories( url, username, password, verbose );
++            list< libcmis::RepositoryPtr > repos = libcmis::SessionFactory::getRepositories(
++                    url, username, password, verbose );
+         
+             cout << "Repositories: name (id)" << endl;
+             for ( list< libcmis::RepositoryPtr >::iterator it = repos.begin(); it != repos.end(); ++it )
+@@ -828,6 +870,11 @@ options_description CmisClient::getOptionsDescription( )
+         ( "repository,r", value< string >(), "Name of the repository to use" )
+         ( "username,u", value< string >(), "Username used to authenticate to the repository" )
+         ( "password,p", value< string >(), "Password used to authenticate to the repository" )
++        ( "proxy", value< string >(), "HTTP proxy url to override the system settings" )
++        ( "noproxy", value< string >(), "Coma separated list if host and domain names not going"
++                                        "through the proxy" )
++        ( "proxy-username", value< string >(), "Username to authenticate on the proxy" )
++        ( "proxy-password", value< string >(), "Password to authenticate on the proxy" )
+     ;
+ 
+     options_description setcontentOpts( "modification operations options" );
+diff --git src/libcmis-c/session-factory.cxx src/libcmis-c/session-factory.cxx
+index a171c82..7ebb278 100644
+--- src/libcmis-c/session-factory.cxx
++++ src/libcmis-c/session-factory.cxx
+@@ -37,6 +37,33 @@
+ 
+ using namespace std;
+ 
++void libcmis_setProxySettings( char* proxy, char* noProxy,
++        char* proxyUser, char* proxyPass )
++{
++    libcmis::SessionFactory::setProxySettings( string( proxy ), string( noProxy ),
++            string( proxyUser ), string( proxyPass ) );
++}
++
++const char* libcmis_getProxy( )
++{
++    return libcmis::SessionFactory::getProxy( ).c_str();
++}
++
++const char* libcmis_getNoProxy( )
++{
++    return libcmis::SessionFactory::getNoProxy( ).c_str();
++}
++
++const char* libcmis_getProxyUser( )
++{
++    return libcmis::SessionFactory::getProxyUser( ).c_str();
++}
++
++const char* libcmis_getProxyPass( )
++{
++    return libcmis::SessionFactory::getProxyPass( ).c_str();
++}
++
+ libcmis_SessionPtr libcmis_createSession(
+         char* bindingUrl,
+         char* repositoryId,
+@@ -49,7 +76,8 @@ libcmis_SessionPtr libcmis_createSession(
+ 
+     try
+     {
+-        libcmis::Session* handle = libcmis::SessionFactory::createSession( bindingUrl, username, password, repositoryId, verbose );
++        libcmis::Session* handle = libcmis::SessionFactory::createSession( bindingUrl, username,
++                password, repositoryId, verbose );
+         session = new libcmis_session( );
+         session->handle = handle;
+     }
+diff --git src/libcmis-c/session-factory.h src/libcmis-c/session-factory.h
+index ad95acc..d28059e 100644
+--- src/libcmis-c/session-factory.h
++++ src/libcmis-c/session-factory.h
+@@ -34,6 +34,17 @@ extern "C" {
+ 
+ #include "types.h"
+ 
++void libcmis_setProxySettings(
++        char* proxy,
++        char* noProxy,
++        char* proxyUser,
++        char* proxyPass );
++
++const char* libcmis_getProxy( );
++const char* libcmis_getNoProxy( );
++const char* libcmis_getProxyUser( );
++const char* libcmis_getProxyPass( );
++
+ libcmis_SessionPtr libcmis_createSession(
+         char* bindingUrl,
+         char* repositoryId,
+diff --git src/libcmis/atom-session.cxx src/libcmis/atom-session.cxx
+index 1716755..1f8ac2d 100644
+--- src/libcmis/atom-session.cxx
++++ src/libcmis/atom-session.cxx
+@@ -39,7 +39,7 @@
+ 
+ using namespace std;
+ 
+-AtomPubSession::AtomPubSession( string atomPubUrl, string repositoryId, 
++AtomPubSession::AtomPubSession( string atomPubUrl, string repositoryId,
+         string username, string password, bool verbose ) throw ( libcmis::Exception ) :
+     BaseSession( atomPubUrl, repositoryId, username, password, verbose ),
+     m_repository( )
+@@ -139,7 +139,8 @@ void AtomPubSession::initialize( ) throw ( libcmis::Exception )
+ 
+ }
+ 
+-list< libcmis::RepositoryPtr > AtomPubSession::getRepositories( string url, string username, string password, bool verbose ) throw ( libcmis::Exception )
++list< libcmis::RepositoryPtr > AtomPubSession::getRepositories( string url, string username,
++        string password, bool verbose ) throw ( libcmis::Exception )
+ {
+     AtomPubSession session( url, string(), username, password, verbose );
+     return session.m_repositories;
+diff --git src/libcmis/atom-session.hxx src/libcmis/atom-session.hxx
+index 568b9b0..29eb359 100644
+--- src/libcmis/atom-session.hxx
++++ src/libcmis/atom-session.hxx
+@@ -39,7 +39,7 @@ class AtomPubSession : public BaseSession
+     public:
+         AtomPubSession( std::string sAtomPubUrl, std::string repositoryId,
+                         std::string username, std::string password,
+-                        bool verbose ) throw ( libcmis::Exception );
++                        bool verbose =false ) throw ( libcmis::Exception );
+         AtomPubSession( const AtomPubSession& copy );
+         ~AtomPubSession( );
+ 
+diff --git src/libcmis/base-session.cxx src/libcmis/base-session.cxx
+index adc030e..b007a9d 100644
+--- src/libcmis/base-session.cxx
++++ src/libcmis/base-session.cxx
+@@ -33,6 +33,7 @@
+ #include <libxml/xpath.h>
+ 
+ #include "base-session.hxx"
++#include "session-factory.hxx"
+ #include "xml-utils.hxx"
+ 
+ using namespace std;
+@@ -105,11 +106,12 @@ namespace
+     }
+ }
+ 
+-BaseSession::BaseSession( string atomPubUrl, string repositoryId, 
+-        string username, string password, bool verbose ) throw ( libcmis::Exception ) :
++BaseSession::BaseSession( string atomPubUrl, string repositoryId, string username,
++        string password, bool verbose ) throw ( libcmis::Exception ) :
+     Session( ),
+     m_authProvider( ),
+     m_curlHandle( NULL ),
++    m_no100Continue( false ),
+     m_bindingUrl( atomPubUrl ),
+     m_repositoryId( repositoryId ),
+     m_username( username ),
+@@ -127,6 +129,7 @@ BaseSession::BaseSession( const BaseSession& copy ) :
+     Session( ),
+     m_authProvider( copy.m_authProvider ),
+     m_curlHandle( NULL ),
++    m_no100Continue( copy.m_no100Continue ),
+     m_bindingUrl( copy.m_bindingUrl ),
+     m_repositoryId( copy.m_repositoryId ),
+     m_username( copy.m_username ),
+@@ -141,11 +144,11 @@ BaseSession::BaseSession( const BaseSession& copy ) :
+     m_curlHandle = curl_easy_init( );
+ }
+ 
+-
+ BaseSession& BaseSession::operator=( const BaseSession& copy )
+ {
+     m_authProvider = copy.m_authProvider;
+     m_curlHandle = NULL;
++    m_no100Continue = copy.m_no100Continue;
+     m_bindingUrl = copy.m_bindingUrl;
+     m_repositoryId = copy.m_repositoryId;
+     m_username = copy.m_username;
+@@ -186,7 +189,7 @@ string BaseSession::createUrl( const string& pattern, map< string, string > vari
+         if ( pos != string::npos )
+         {
+             // Escape the URL by chunks
+-#if LIBCURL_VERSION_VALUE >= 0x071504
++#if LIBCURL_VERSION_VALUE >= 0x070F04
+             char* escaped = curl_easy_escape( m_curlHandle, value.c_str(), value.length() );
+ #else
+             char* escaped = curl_escape( value.c_str(), value.length() );
+@@ -215,6 +218,9 @@ string BaseSession::createUrl( const string& pattern, map< string, string > vari
+ 
+ libcmis::HttpResponsePtr BaseSession::httpGetRequest( string url ) throw ( CurlException )
+ {
++    // Reset the handle for the request
++    curl_easy_reset( m_curlHandle );
++
+     libcmis::HttpResponsePtr response( new libcmis::HttpResponse( ) );
+ 
+     curl_easy_setopt( m_curlHandle, CURLOPT_WRITEFUNCTION, lcl_bufferData );
+@@ -244,6 +250,9 @@ libcmis::HttpResponsePtr BaseSession::httpGetRequest( string url ) throw ( CurlE
+ 
+ libcmis::HttpResponsePtr BaseSession::httpPutRequest( string url, istream& is, vector< string > headers ) throw ( CurlException )
+ {
++    // Reset the handle for the request
++    curl_easy_reset( m_curlHandle );
++
+     libcmis::HttpResponsePtr response( new libcmis::HttpResponse( ) );
+ 
+     curl_easy_setopt( m_curlHandle, CURLOPT_WRITEFUNCTION, lcl_bufferData );
+@@ -266,12 +275,32 @@ libcmis::HttpResponsePtr BaseSession::httpPutRequest( string url, istream& is, v
+     struct curl_slist *headers_slist = NULL;
+     for ( vector< string >::iterator it = headers.begin( ); it != headers.end( ); ++it )
+         headers_slist = curl_slist_append( headers_slist, it->c_str( ) );
++
++    // 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_slist = curl_slist_append( headers_slist, "Expect:" );
+     curl_easy_setopt( m_curlHandle, CURLOPT_HTTPHEADER, headers_slist );
+ 
+     try
+     {
+         httpRunRequest( url );
+         response->getData( )->finish();
++
++        /** 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 ( getHttpStatus() == 417 )
++        {
++            headers_slist = curl_slist_append( headers_slist, "Expect:" );
++            curl_easy_setopt( m_curlHandle, CURLOPT_HTTPHEADER, headers_slist );
++            httpRunRequest( url );
++            response->getData( )->finish();
++
++            // Remember that we don't want 100-Continue for the future requests
++            m_no100Continue = true;
++        }
+     }
+     catch ( CurlException& e )
+     {
+@@ -286,6 +315,9 @@ libcmis::HttpResponsePtr BaseSession::httpPutRequest( string url, istream& is, v
+ 
+ libcmis::HttpResponsePtr BaseSession::httpPostRequest( string url, istringstream& is, string contentType ) throw ( CurlException )
+ {
++    // Reset the handle for the request
++    curl_easy_reset( m_curlHandle );
++
+     libcmis::HttpResponsePtr response( new libcmis::HttpResponse( ) );
+ 
+     curl_easy_setopt( m_curlHandle, CURLOPT_WRITEFUNCTION, lcl_bufferData );
+@@ -308,12 +340,32 @@ libcmis::HttpResponsePtr BaseSession::httpPostRequest( string url, istringstream
+     struct curl_slist *headers_slist = NULL;
+     string contentTypeHeader = string( "Content-Type:" ) + contentType;
+     headers_slist = curl_slist_append( headers_slist, contentTypeHeader.c_str( ) );
++
++    // 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_slist = curl_slist_append( headers_slist, "Expect:" );
+     curl_easy_setopt( m_curlHandle, CURLOPT_HTTPHEADER, headers_slist );
+ 
+     try
+     {
+         httpRunRequest( url );
+         response->getData( )->finish();
++
++        /** 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 ( getHttpStatus() == 417 )
++        {
++            headers_slist = curl_slist_append( headers_slist, "Expect:" );
++            curl_easy_setopt( m_curlHandle, CURLOPT_HTTPHEADER, headers_slist );
++            httpRunRequest( url );
++            response->getData( )->finish();
++
++            // Remember that we don't want 100-Continue for the future requests
++            m_no100Continue = true;
++        }
+     }
+     catch ( const CurlException& e )
+     {
+@@ -328,6 +380,9 @@ libcmis::HttpResponsePtr BaseSession::httpPostRequest( string url, istringstream
+ 
+ void BaseSession::httpDeleteRequest( string url ) throw ( CurlException )
+ {
++    // Reset the handle for the request
++    curl_easy_reset( m_curlHandle );
++
+     curl_easy_setopt( m_curlHandle, CURLOPT_CUSTOMREQUEST, "DELETE" );
+     httpRunRequest( url );
+ }
+@@ -351,7 +406,7 @@ void BaseSession::httpRunRequest( string url ) throw ( CurlException )
+     {
+         curl_easy_setopt( m_curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
+ 
+-#if LIBCURL_VERSION_VALUE >= 0x071901
++#if LIBCURL_VERSION_VALUE >= 0x071301
+         curl_easy_setopt( m_curlHandle, CURLOPT_USERNAME, m_username.c_str() );
+         curl_easy_setopt( m_curlHandle, CURLOPT_PASSWORD, m_password.c_str() );
+ #else
+@@ -360,6 +415,28 @@ void BaseSession::httpRunRequest( string url ) throw ( CurlException )
+ #endif
+     }
+ 
++    // Set the proxy configuration if any
++    if ( !libcmis::SessionFactory::getProxy( ).empty() )
++    {
++        curl_easy_setopt( m_curlHandle, CURLOPT_PROXY, libcmis::SessionFactory::getProxy( ).c_str() );
++#if LIBCURL_VERSION_VALUE >= 0x071304
++        curl_easy_setopt( m_curlHandle, CURLOPT_NOPROXY, libcmis::SessionFactory::getNoProxy( ).c_str() );
++#endif
++        const string& proxyUser = libcmis::SessionFactory::getProxyUser( );
++        const string& proxyPass = libcmis::SessionFactory::getProxyPass( );
++        if ( !proxyUser.empty( ) && !proxyPass.empty( ) )
++        {
++            curl_easy_setopt( m_curlHandle, CURLOPT_PROXYAUTH, CURLAUTH_ANY ); 
++#if LIBCURL_VERSION_VALUE >= 0X071301
++            curl_easy_setopt( m_curlHandle, CURLOPT_PROXYUSERNAME, proxyUser.c_str( ) );
++            curl_easy_setopt( m_curlHandle, CURLOPT_PROXYPASSWORD, proxyPass.c_str( ) );
++#else
++            string userpwd = proxyUser + ":" + proxyPass;
++            curl_easy_setopt( m_curlHandle, CURLOPT_PROXYUSERPWD, userpwd.c_str( ) );
++#endif
++        }
++    }
++
+     // Get some feedback when something wrong happens
+     char errBuff[CURL_ERROR_SIZE];
+     curl_easy_setopt( m_curlHandle, CURLOPT_ERRORBUFFER, errBuff );
+@@ -373,9 +450,6 @@ void BaseSession::httpRunRequest( string url ) throw ( CurlException )
+ 
+     // Perform the query
+     CURLcode errCode = curl_easy_perform( m_curlHandle );
+-    
+-    // Reset the handle for the next request
+-    curl_easy_reset( m_curlHandle );
+ 
+     bool isHttpError = errCode == CURLE_HTTP_RETURNED_ERROR;
+     if ( CURLE_OK != errCode && !( m_noHttpErrors && isHttpError ) )
+diff --git src/libcmis/base-session.hxx src/libcmis/base-session.hxx
+index fb95ba7..0b90c1f 100644
+--- src/libcmis/base-session.hxx
++++ src/libcmis/base-session.hxx
+@@ -94,6 +94,7 @@ class BaseSession : public libcmis::Session
+         libcmis::AuthProviderPtr m_authProvider;
+ 
+         CURL* m_curlHandle;
++        bool  m_no100Continue;
+ 
+     protected:
+         std::string m_bindingUrl;
+@@ -110,7 +111,7 @@ class BaseSession : public libcmis::Session
+     public:
+         BaseSession( std::string sBindingUrl, std::string repository,
+                         std::string username, std::string password,
+-                        bool verbose ) throw ( libcmis::Exception );
++                        bool verbose = false ) throw ( libcmis::Exception );
+         BaseSession( const BaseSession& copy );
+         ~BaseSession( );
+ 
+@@ -137,8 +138,6 @@ class BaseSession : public libcmis::Session
+         libcmis::HttpResponsePtr httpPostRequest( std::string url, std::istringstream& is, std::string contentType ) throw ( CurlException );
+         void httpDeleteRequest( std::string url ) throw ( CurlException );
+ 
+-        void httpRunRequest( std::string url ) throw ( CurlException );
+-
+         long getHttpStatus( );
+ 
+         // Session methods
+@@ -148,6 +147,8 @@ class BaseSession : public libcmis::Session
+         virtual libcmis::FolderPtr getFolder( std::string id ) throw ( libcmis::Exception );
+ 
+         virtual void setAuthenticationProvider( libcmis::AuthProviderPtr provider ) { m_authProvider = provider; }
++    private:
++        void httpRunRequest( std::string url ) throw ( CurlException );
+ };
+ 
+ #endif
+diff --git src/libcmis/session-factory.cxx src/libcmis/session-factory.cxx
+index d7d886b..afe6943 100644
+--- src/libcmis/session-factory.cxx
++++ src/libcmis/session-factory.cxx
+@@ -33,8 +33,23 @@ using namespace std;
+ 
+ namespace libcmis
+ {
++    string SessionFactory::s_proxy;
++    string SessionFactory::s_noProxy;
++    string SessionFactory::s_proxyUser;
++    string SessionFactory::s_proxyPass;
++
++    void SessionFactory::setProxySettings( string proxy, string noProxy,
++            string proxyUser, string proxyPass )
++    {
++        SessionFactory::s_proxy = proxy;
++        SessionFactory::s_noProxy = noProxy;
++        SessionFactory::s_proxyUser = proxyUser;
++        SessionFactory::s_proxyPass = proxyPass;
++    }
++
+     Session* SessionFactory::createSession( string bindingUrl, string username,
+-            string password, string repository, bool verbose ) throw ( Exception )
++            string password, string repository,
++            bool verbose ) throw ( Exception )
+     {
+         Session* session = NULL;
+         
+@@ -68,8 +83,8 @@ namespace libcmis
+         return session;
+     }
+ 
+-    list< RepositoryPtr > SessionFactory::getRepositories( string bindingUrl, string username,
+-            string password, bool verbose ) throw ( Exception )
++    list< RepositoryPtr > SessionFactory::getRepositories( string bindingUrl,
++            string username, string password, bool verbose ) throw ( Exception )
+     {
+         list< RepositoryPtr > repos;
+ 
+diff --git src/libcmis/session-factory.hxx src/libcmis/session-factory.hxx
+index 677c2ab..598497f 100644
+--- src/libcmis/session-factory.hxx
++++ src/libcmis/session-factory.hxx
+@@ -40,8 +40,24 @@ namespace libcmis
+ {
+     class SessionFactory
+     {
++        private:
++            static std::string s_proxy;
++            static std::string s_noProxy;
++            static std::string s_proxyUser;
++            static std::string s_proxyPass;
++
+         public:
+ 
++            static void setProxySettings( std::string proxy,
++                    std::string noProxy,
++                    std::string proxyUser,
++                    std::string proxyPass );
++
++            static const std::string& getProxy() { return s_proxy; }
++            static const std::string& getNoProxy() { return s_noProxy; }
++            static const std::string& getProxyUser() { return s_proxyUser; }
++            static const std::string& getProxyPass() { return s_proxyPass; }
++
+             /** Create a session from the given parameters. The binding type is automatically
+                 detected based on the provided URL.
+ 
+diff --git src/libcmis/test-atom.cxx src/libcmis/test-atom.cxx
+index 4ee64ea..624078d 100644
+--- src/libcmis/test-atom.cxx
++++ src/libcmis/test-atom.cxx
+@@ -211,7 +211,7 @@ class TestAuthProvider : public libcmis::AuthProvider
+ 
+ void AtomTest::authCallbackTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, string( ), false);
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, string( ) );
+ 
+     // Test cancelled authentication
+     {
+@@ -239,7 +239,7 @@ void AtomTest::authCallbackTest( )
+ 
+ void AtomTest::getUnexistantTypeTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     
+     try
+     {
+@@ -254,7 +254,7 @@ void AtomTest::getUnexistantTypeTest( )
+ 
+ void AtomTest::getNormalTypeTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     
+     libcmis::ObjectTypePtr type = session.getType( TEST_TYPE_ID );
+ 
+@@ -265,7 +265,7 @@ void AtomTest::getNormalTypeTest( )
+ 
+ void AtomTest::getTypeChildrenTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     
+     libcmis::ObjectTypePtr type = session.getType( CHILDREN_TEST_TYPE_ID );
+     vector< libcmis::ObjectTypePtr > children = type->getChildren( );
+@@ -275,7 +275,7 @@ void AtomTest::getTypeChildrenTest( )
+ 
+ void AtomTest::getUnexistantFolderTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     try
+     {
+@@ -290,7 +290,7 @@ void AtomTest::getUnexistantFolderTest( )
+ 
+ void AtomTest::getUnexistantObjectTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     
+     try
+     {
+@@ -305,7 +305,7 @@ void AtomTest::getUnexistantObjectTest( )
+ 
+ void AtomTest::getFolderFromOtherNodeTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr folder = session.getFolder( TEST_DOCUMENT_ID );
+ 
+     CPPUNIT_ASSERT_MESSAGE( "Nothing should be returned: not a folder",
+@@ -314,7 +314,7 @@ void AtomTest::getFolderFromOtherNodeTest( )
+ 
+ void AtomTest::getFolderCreationFromUrlTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr folder = session.getFolder( TEST_FOLDER_ID );
+ 
+     AtomFolder* atomFolder = dynamic_cast< AtomFolder* >( folder.get( ) );
+@@ -336,7 +336,7 @@ void AtomTest::getFolderCreationFromUrlTest( )
+ 
+ void AtomTest::getDocumentCreationFromUrlTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::ObjectPtr object = session.getObject( TEST_DOCUMENT_ID );
+ 
+     AtomDocument* atomDocument = dynamic_cast< AtomDocument* >( object.get( ) );
+@@ -359,7 +359,7 @@ void AtomTest::getDocumentCreationFromUrlTest( )
+ 
+ void AtomTest::getByPathValidTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     try
+     {
+         libcmis::ObjectPtr object = session.getObjectByPath( TEST_PATH_VALID );
+@@ -376,7 +376,7 @@ void AtomTest::getByPathValidTest( )
+ 
+ void AtomTest::getByPathInvalidTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     try
+     {
+         libcmis::ObjectPtr object = session.getObjectByPath( TEST_PATH_INVALID );
+@@ -391,7 +391,7 @@ void AtomTest::getByPathInvalidTest( )
+         
+ void AtomTest::getAllowableActionsTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr folder = session.getRootFolder( );
+ 
+     boost::shared_ptr< libcmis::AllowableActions > toCheck = folder->getAllowableActions( );
+@@ -405,7 +405,7 @@ void AtomTest::getAllowableActionsTest( )
+ 
+ void AtomTest::getChildrenTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr folder = session.getRootFolder( );
+ 
+     vector< libcmis::ObjectPtr > children = folder->getChildren( );
+@@ -429,7 +429,7 @@ void AtomTest::getChildrenTest( )
+ 
+ void AtomTest::getObjectParentsTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::ObjectPtr object = session.getObject( TEST_DOCUMENT_ID );
+     libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get() );
+     
+@@ -445,7 +445,7 @@ void AtomTest::getObjectParentsTest( )
+ 
+ void AtomTest::getContentStreamTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::ObjectPtr object = session.getObject( TEST_DOCUMENT_ID );
+     libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get() );
+     
+@@ -467,7 +467,7 @@ void AtomTest::getContentStreamTest( )
+ 
+ void AtomTest::setContentStreamTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::ObjectPtr object = session.getObject( TEST_DOCUMENT_ID );
+     libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get() );
+     
+@@ -503,7 +503,7 @@ void AtomTest::setContentStreamTest( )
+ 
+ void AtomTest::updatePropertiesTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // Values for the test
+     libcmis::ObjectPtr object = session.getObject( "114" );
+@@ -530,7 +530,7 @@ void AtomTest::updatePropertiesTest( )
+ 
+ void AtomTest::createFolderTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr parent = session.getFolder( session.getRootId( ) );
+ 
+     // Prepare the properties for the new object, object type is cmis:folder
+@@ -564,7 +564,7 @@ void AtomTest::createFolderTest( )
+ 
+ void AtomTest::createFolderBadTypeTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr parent = session.getFolder( session.getRootId( ) );
+ 
+     // Prepare the properties for the new object, object type is cmis:document to trigger the exception
+@@ -603,7 +603,7 @@ void AtomTest::createFolderBadTypeTest( )
+ 
+ void AtomTest::createDocumentTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr parent = session.getFolder( session.getRootId( ) );
+ 
+     // Prepare the properties for the new object, object type is cmis:folder
+@@ -647,7 +647,7 @@ void AtomTest::createDocumentTest( )
+ 
+ void AtomTest::deleteDocumentTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     string id( "130" );
+     libcmis::ObjectPtr object = session.getObject( id );
+@@ -669,7 +669,7 @@ void AtomTest::deleteDocumentTest( )
+ 
+ void AtomTest::deleteTreeTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     string id( "117" );
+     libcmis::ObjectPtr object = session.getObject( id );
+@@ -691,7 +691,7 @@ void AtomTest::deleteTreeTest( )
+ 
+ void AtomTest::checkOutTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // First create a document of type VersionableType
+     libcmis::DocumentPtr doc = test::createVersionableDocument( &session, "checkOutTest" );
+@@ -709,7 +709,7 @@ void AtomTest::checkOutTest( )
+ 
+ void AtomTest::cancelCheckOutTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // First create a versionable document and check it out
+     libcmis::DocumentPtr doc = test::createVersionableDocument( &session, "cancelCheckOutTest" );
+@@ -734,7 +734,7 @@ void AtomTest::cancelCheckOutTest( )
+ 
+ void AtomTest::checkInTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // First create a versionable document and check it out
+     libcmis::DocumentPtr doc = test::createVersionableDocument( &session, "checkInTest" );
+@@ -770,7 +770,7 @@ void AtomTest::checkInTest( )
+ 
+ void AtomTest::getAllVersionsTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // First create a versionable document and check it out
+     libcmis::DocumentPtr doc = test::createVersionableDocument( &session, "getAllVersionsTest" );
+@@ -795,7 +795,7 @@ void AtomTest::getAllVersionsTest( )
+ 
+ void AtomTest::moveTest( )
+ {
+-    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD, false );
++    AtomPubSession session( SERVER_ATOM_URL, SERVER_REPOSITORY, SERVER_USERNAME, SERVER_PASSWORD );
+     
+     string id( "135" );
+     libcmis::ObjectPtr object = session.getObject( id );
+diff --git src/libcmis/test-ws.cxx src/libcmis/test-ws.cxx
+index 1b5dfee..ad564bc 100644
+--- src/libcmis/test-ws.cxx
++++ src/libcmis/test-ws.cxx
+@@ -136,19 +136,19 @@ void WSTest::getRepositoriesTest()
+ 
+ void WSTest::sessionCreationTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "", SERVER_USERNAME, SERVER_PASSWORD );
+     CPPUNIT_ASSERT_MESSAGE( "No RepositoryService URL", !session.getServiceUrl( "RepositoryService" ).empty( ) );
+ }
+ 
+ void WSTest::getRepositoryTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Repository info badly retrieved", string( "100" ), session.getRepository()->getRootId( ) );
+ }
+ 
+ void WSTest::getRepositoryBadTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "", SERVER_USERNAME, SERVER_PASSWORD );
+     try
+     {
+         session.getRepositoryService( ).getRepositoryInfo( "bad" );
+@@ -164,7 +164,7 @@ void WSTest::getRepositoryBadTest( )
+ 
+ void WSTest::getTypeDefinitionTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     string id( "ComplexType" ); 
+     libcmis::ObjectTypePtr actual = session.getType( id );
+ 
+@@ -175,7 +175,7 @@ void WSTest::getTypeDefinitionTest( )
+ 
+ void WSTest::getTypeDefinitionErrorTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     
+     string id( "bad_type" );
+     try
+@@ -192,7 +192,7 @@ void WSTest::getTypeDefinitionErrorTest( )
+ 
+ void WSTest::getTypeChildrenTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::ObjectTypePtr actual = session.getType( "cmis:document" );
+ 
+     vector< libcmis::ObjectTypePtr > children = actual->getChildren( );
+@@ -202,7 +202,7 @@ void WSTest::getTypeChildrenTest( )
+ 
+ void WSTest::getObjectTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     string id( "101" ); 
+     libcmis::ObjectPtr actual = session.getObject( id );
+ 
+@@ -217,7 +217,7 @@ void WSTest::getObjectTest( )
+ 
+ void WSTest::getObjectDocumentTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     string id( "114" ); 
+     libcmis::ObjectPtr actual = session.getObject( id );
+ 
+@@ -232,7 +232,7 @@ void WSTest::getObjectDocumentTest( )
+ 
+ void WSTest::getObjectParentsTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::ObjectPtr object = session.getObject( "116" );
+     libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get() );
+     
+@@ -248,7 +248,7 @@ void WSTest::getObjectParentsTest( )
+ 
+ void WSTest::getChildrenTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr folder = session.getRootFolder( );
+ 
+     vector< libcmis::ObjectPtr > children = folder->getChildren( );
+@@ -270,7 +270,7 @@ void WSTest::getChildrenTest( )
+ 
+ void WSTest::getByPathValidTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     try
+     {
+         libcmis::ObjectPtr object = session.getObjectByPath( "/My_Folder-0-0/My_Document-1-2" );
+@@ -287,7 +287,7 @@ void WSTest::getByPathValidTest( )
+ 
+ void WSTest::getByPathInvalidTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     try
+     {
+         libcmis::ObjectPtr object = session.getObjectByPath( "/some/dummy/path" );
+@@ -302,7 +302,7 @@ void WSTest::getByPathInvalidTest( )
+ 
+ void WSTest::updatePropertiesTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     
+     // Values for the test
+     libcmis::ObjectPtr object = session.getObject( "114" );
+@@ -329,7 +329,7 @@ void WSTest::updatePropertiesTest( )
+ 
+ void WSTest::createFolderTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr parent = session.getFolder( session.getRootId( ) );
+ 
+     // Prepare the properties for the new object, object type is cmis:folder
+@@ -363,7 +363,7 @@ void WSTest::createFolderTest( )
+ 
+ void WSTest::createFolderBadTypeTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr parent = session.getFolder( session.getRootId( ) );
+ 
+     // Prepare the properties for the new object, object type is cmis:document to trigger the exception
+@@ -401,7 +401,7 @@ void WSTest::createFolderBadTypeTest( )
+ 
+ void WSTest::createDocumentTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::FolderPtr parent = session.getFolder( session.getRootId( ) );
+ 
+     // Prepare the properties for the new object, object type is cmis:folder
+@@ -444,7 +444,7 @@ void WSTest::createDocumentTest( )
+ 
+ void WSTest::deleteObjectTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // Get the object to remove
+     string id( "130" );
+@@ -467,7 +467,7 @@ void WSTest::deleteObjectTest( )
+ 
+ void WSTest::deleteTreeTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     string id( "117" );
+     libcmis::ObjectPtr object = session.getObject( id );
+@@ -489,7 +489,7 @@ void WSTest::deleteTreeTest( )
+ 
+ void WSTest::moveTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     
+     string id( "135" );
+     libcmis::ObjectPtr object = session.getObject( id );
+@@ -508,7 +508,7 @@ void WSTest::moveTest( )
+ 
+ void WSTest::getContentStreamTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::ObjectPtr object = session.getObject( "116" );
+     libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get() );
+     
+@@ -532,7 +532,7 @@ void WSTest::getContentStreamTest( )
+ 
+ void WSTest::setContentStreamTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+     libcmis::ObjectPtr object = session.getObject( "116" );
+     libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get() );
+     
+@@ -570,7 +570,7 @@ void WSTest::setContentStreamTest( )
+ 
+ void WSTest::checkOutTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // First create a document of type VersionableType
+     libcmis::DocumentPtr doc = test::createVersionableDocument( &session, "checkOutTest" );
+@@ -588,7 +588,7 @@ void WSTest::checkOutTest( )
+ 
+ void WSTest::cancelCheckOutTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // First create a versionable document and check it out
+     libcmis::DocumentPtr doc = test::createVersionableDocument( &session, "cancelCheckOutTest" );
+@@ -613,7 +613,7 @@ void WSTest::cancelCheckOutTest( )
+ 
+ void WSTest::checkInTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // First create a versionable document and check it out
+     libcmis::DocumentPtr doc = test::createVersionableDocument( &session, "checkInTest" );
+@@ -649,7 +649,7 @@ void WSTest::checkInTest( )
+ 
+ void WSTest::getAllVersionsTest( )
+ {
+-    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD, false );
++    WSSession session( SERVER_WSDL_URL, "A1", SERVER_USERNAME, SERVER_PASSWORD );
+ 
+     // First create a versionable document and check it out
+     libcmis::DocumentPtr doc = test::createVersionableDocument( &session, "getAllVersionsTest" );
+diff --git src/libcmis/ws-relatedmultipart.cxx src/libcmis/ws-relatedmultipart.cxx
+index 37f133a..ef91b4d 100644
+--- src/libcmis/ws-relatedmultipart.cxx
++++ src/libcmis/ws-relatedmultipart.cxx
+@@ -299,7 +299,7 @@ boost::shared_ptr< istream > getStreamFromNode( xmlNodePtr node, RelatedMultipar
+             {
+                 id = href.substr( 4 );
+                 // URL-decode the id
+-#if LIBCURL_VERSION_VALUE >= 0x071504
++#if LIBCURL_VERSION_VALUE >= 0x070F04
+                 char* escaped = curl_easy_unescape( NULL, id.c_str(), id.length(), NULL );
+ #else
+                 char* escaped = curl_unescape( id.c_str(), id.length() );
+diff --git src/libcmis/ws-session.cxx src/libcmis/ws-session.cxx
+index b906a5a..f551109 100644
+--- src/libcmis/ws-session.cxx
++++ src/libcmis/ws-session.cxx
+@@ -39,8 +39,8 @@
+ 
+ using namespace std;
+ 
+-WSSession::WSSession( string bindingUrl, string repositoryId, 
+-        string username, string password, bool verbose ) throw ( libcmis::Exception ) :
++WSSession::WSSession( string bindingUrl, string repositoryId, string username,
++        string password, bool verbose ) throw ( libcmis::Exception ) :
+     BaseSession( bindingUrl, repositoryId, username, password, verbose ),
+     m_servicesUrls( ),
+     m_navigationService( NULL ),
+@@ -336,7 +336,8 @@ VersioningService& WSSession::getVersioningService( )
+     return *m_versioningService;
+ }
+ 
+-list< libcmis::RepositoryPtr > WSSession::getRepositories( string url, string username, string password, bool verbose ) throw ( libcmis::Exception )
++list< libcmis::RepositoryPtr > WSSession::getRepositories( string url, string username,
++        string password, bool verbose ) throw ( libcmis::Exception )
+ {
+     WSSession session( url, string(), username, password, verbose );
+     return session.m_repositories;
+diff --git src/libcmis/ws-session.hxx src/libcmis/ws-session.hxx
+index 952e914..e8b806a 100644
+--- src/libcmis/ws-session.hxx
++++ src/libcmis/ws-session.hxx
+@@ -52,7 +52,7 @@ class WSSession : public BaseSession, public SoapSession
+     public:
+         WSSession( std::string bindingUrl, std::string repositoryId,
+                    std::string username, std::string password,
+-                   bool verbose ) throw ( libcmis::Exception );
++                   bool verbose = false ) throw ( libcmis::Exception );
+         WSSession( const WSSession& copy );
+         ~WSSession( );
+ 
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 6757694..a8b1c86 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -60,6 +60,7 @@
 #include <ucbhelper/std_inputstream.hxx>
 #include <ucbhelper/std_outputstream.hxx>
 #include <ucbhelper/propertyvalueset.hxx>
+#include <ucbhelper/proxydecider.hxx>
 
 #include "auth_provider.hxx"
 #include "cmis_content.hxx"
@@ -256,6 +257,14 @@
 
     libcmis::Session* Content::getSession( const uno::Reference< ucb::XCommandEnvironment >& xEnv )
     {
+        // Set the proxy if needed. We are doing that all times as the proxy data shouldn't be cached.
+        ucbhelper::InternetProxyDecider aProxyDecider( m_xContext );
+        INetURLObject aBindingUrl( m_aURL.getBindingUrl( ) );
+        const ucbhelper::InternetProxyServer& rProxy = aProxyDecider.getProxy(
+                INetURLObject::GetScheme( aBindingUrl.GetProtocol( ) ), aBindingUrl.GetHost(), aBindingUrl.GetPort() );
+        rtl::OUString sProxy = rProxy.aName + ":" + rtl::OUString::valueOf( rProxy.nPort );
+        libcmis::SessionFactory::setProxySettings( OUSTR_TO_STDSTR( sProxy ), string(), string(), string() );
+
         // Look for a cached session, key is binding url + repo id
         rtl::OUString sSessionId = m_aURL.getBindingUrl( ) + m_aURL.getRepositoryId( );
         if ( NULL == m_pSession )
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index c37d590..afd503c 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -41,6 +41,7 @@
 #include <ucbhelper/commandenvironment.hxx>
 #include <ucbhelper/contentidentifier.hxx>
 #include <ucbhelper/propertyvalueset.hxx>
+#include <ucbhelper/proxydecider.hxx>
 
 #include "auth_provider.hxx"
 #include "cmis_content.hxx"
@@ -138,6 +139,14 @@
 
     void RepoContent::getRepositories( const uno::Reference< ucb::XCommandEnvironment > & xEnv )
     {
+        // Set the proxy if needed. We are doing that all times as the proxy data shouldn't be cached.
+        ucbhelper::InternetProxyDecider aProxyDecider( m_xContext );
+        INetURLObject aBindingUrl( m_aURL.getBindingUrl( ) );
+        const ucbhelper::InternetProxyServer& rProxy = aProxyDecider.getProxy(
+                INetURLObject::GetScheme( aBindingUrl.GetProtocol( ) ), aBindingUrl.GetHost(), aBindingUrl.GetPort() );
+        rtl::OUString sProxy = rProxy.aName + ":" + rtl::OUString::valueOf( rProxy.nPort );
+        libcmis::SessionFactory::setProxySettings( OUSTR_TO_STDSTR( sProxy ), string(), string(), string() );
+
         if ( m_aRepositories.empty() )
         {
             // Get the auth credentials

-- 
To view, visit https://gerrit.libreoffice.org/1842
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b856ac166b67097e1921ec71eb5b7e1819fec41
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Bosdonnat Cedric <cedric.bosdonnat at free.fr>



More information about the LibreOffice mailing list