[Libreoffice-commits] .: Branch 'libreoffice-3-5' - ucb/source

Fridrich Strba fridrich at kemper.freedesktop.org
Tue Jun 12 13:42:33 PDT 2012


 ucb/source/ucp/webdav/DAVResourceAccess.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 8dfbb8793407a103ef8c5fa109f0fdf15af9262b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 12 18:17:37 2012 +0200

    rhbz#678440: Always include User-Agent to avoid 403 from picky servers
    
    Change-Id: I4fa7b45062b0058427f77cf9dc0abebd6b26fb49
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 11b5251..e669245 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -1151,6 +1151,21 @@ void DAVResourceAccess::getUserRequestHeaders(
             }
         }
     }
+
+    // Make sure a User-Agent header is always included, as at least
+    // en.wikipedia.org:80 forces back 403 "Scripts should use an informative
+    // User-Agent string with contact information, or they may be IP-blocked
+    // without notice" otherwise:
+    for ( DAVRequestHeaders::iterator i(rRequestHeaders.begin());
+          i != rRequestHeaders.end(); ++i )
+    {
+        if ( i->first.equalsIgnoreAsciiCase( "User-Agent" ) )
+        {
+            return;
+        }
+    }
+    rRequestHeaders.push_back(
+        DAVRequestHeader( "User-Agent", "LibreOffice" ) );
 }
 
 //=========================================================================


More information about the Libreoffice-commits mailing list