[Libreoffice-commits] .: ucb/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Tue Jun 12 09:18:10 PDT 2012


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

New commits:
commit 4d0e3127ed2def7212bc05aa860cd06704bb1efe
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

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