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

Stephan Bergmann sbergmann at kemper.freedesktop.org
Tue Jun 12 09:21:20 PDT 2012


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

New commits:
commit d41f59ddbfafd3f9a2b26a7a9a2999b77095ae36
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
    (cherry picked from commit 4d0e3127ed2def7212bc05aa860cd06704bb1efe)

diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 0e0f34a..890f94b 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -1146,6 +1146,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