Commits

Anonymous committed 37578b7

#i21599# - Set User-Agent request header.

Comments (0)

Files changed (1)

ucb/source/ucp/webdav/NeonSession.cxx

 #include <ne_compress.h>
 #include "libxml/parser.h"
 #include "rtl/ustrbuf.hxx"
+#include "rtl/bootstrap.hxx"
 #include "comphelper/sequence.hxx"
 #include "ucbhelper/simplecertificatevalidationrequest.hxx"
 
             m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this );
         ne_add_proxy_auth(
             m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this );
+
+        // Set User-Agent request header
+        rtl::OUString aBootstrapConfigFile;
+        rtl::Bootstrap::get(
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BRAND_BASE_DIR" ) ),
+            aBootstrapConfigFile );
+        aBootstrapConfigFile +=
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+               "/program/"SAL_CONFIGFILE( "bootstrap" ) ) );
+
+        rtl::Bootstrap aData( aBootstrapConfigFile );
+        rtl::OUString aProductKeyValue;
+        aData.getFrom(
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ProductKey" ) ),
+            aProductKeyValue,
+            rtl::OUString() );
+
+        sal_Int32 n = aProductKeyValue.lastIndexOf( sal_Unicode( ' ' ) );
+        if ( n != -1 )
+            aProductKeyValue
+                = aProductKeyValue.replaceAt(
+                    n, 1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) );
+
+        ne_set_useragent( m_pHttpSession,
+                          rtl::OUStringToOString(
+                                  aProductKeyValue,
+                                  RTL_TEXTENCODING_UTF8 ).getStr() );
     }
 }