summaryrefslogtreecommitdiff
authorStephan Bergmann <sbergman@redhat.com>2012-06-12 16:17:37 (GMT)
committer Stephan Bergmann <sbergman@redhat.com>2012-06-12 16:17:58 (GMT)
commit4d0e3127ed2def7212bc05aa860cd06704bb1efe (patch) (side-by-side diff)
treef767a39a0851d95bf57222ba0e8028f7d74a0be9
parent39669162e06ae6ba6e65c0d8c453263a433a8142 (diff)
downloadcore-4d0e3127ed2def7212bc05aa860cd06704bb1efe.zip
core-4d0e3127ed2def7212bc05aa860cd06704bb1efe.tar.gz
rhbz#678440: Always include User-Agent to avoid 403 from picky servers
Change-Id: I4fa7b45062b0058427f77cf9dc0abebd6b26fb49
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx15
1 files changed, 15 insertions, 0 deletions
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" ) );
}
//=========================================================================