It would be nice if
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=4d0e3127ed2def7212bc05aa860cd06704bb1efe>
"rhbz#678440: Always include User-Agent to avoid 403 from picky servers"
fixing <https://bugzilla.redhat.com/show_bug.cgi?id=678440> "opening
urls fails with error 403 on picky servers" could be reviewed for
inclusion into libreoffice-3-5 and libreoffice-3-5-5. I consider the
patch low-risk.
As the patch would not apply as-is to the 3.5 code line, find attached
an adapted 0001-rhbz-678440-Always-include-User-Agent-to-avoid-403-f.patch.
Thanks,
Stephan
From 909939dade45864b50aabbb9f3e4eed80e7dce82 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Tue, 12 Jun 2012 18:17:37 +0200
Subject: [PATCH] rhbz#678440: Always include User-Agent to avoid 403 from
picky servers
(cherry picked from commit 4d0e3127ed2def7212bc05aa860cd06704bb1efe,
with modifications)
Change-Id: I4fa7b45062b0058427f77cf9dc0abebd6b26fb49
---
ucb/source/ucp/webdav/DAVResourceAccess.cxx | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 11b5251..f62ddaf 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" ) ) ) );
}
//=========================================================================
--
1.7.10.2
Context
- [PATCH-3-5][PATCH-3-5-5] rhbz#678440: Always include User-Agent to avoid 403 from picky servers · Stephan Bergmann
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.