summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/webdav/DAVResourceAccess.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'ucb/source/ucp/webdav/DAVResourceAccess.cxx')
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 11b52518638e..f62ddaf98a33 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -1151,6 +1151,24 @@ 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.equalsIgnoreAsciiCaseAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "User-Agent" ) ) )
+ {
+ return;
+ }
+ }
+ rRequestHeaders.push_back(
+ DAVRequestHeader(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "User-Agent" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LibreOffice" ) ) ) );
}
//=========================================================================