summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCarlos Silva <r3pek@r3pek.org>2019-08-16 06:14:20 +0100
committerBenjamin Brahmer <info@b-brahmer.de>2019-08-16 07:14:20 +0200
commit6c01164b9b23ee70544487484c23a1bd196ca3c4 (patch)
tree6c1d8d564f0e14a38156fb9477107fd3c51bd244 /lib
parent5118c5bf742a8a8eef4a9a197437abc47af7d0b3 (diff)
Add the 'Accept' header to the request (#525)
* Add the 'Accept' header to the request Some firewalls block requests without the Accept header on the HTTP(s) request as seen on issue #517, so, just add the header to all requests and say we accept anything. Signed-off-by: Carlos Mogas da Silva <r3pek@r3pek.org> * Use a more detailed Accept Header Signed-off-by: Carlos Mogas da Silva <r3pek@r3pek.org> * Split up long line Signed-off-by: Carlos Mogas da Silva <r3pek@r3pek.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/Config/FetcherConfig.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Config/FetcherConfig.php b/lib/Config/FetcherConfig.php
index 7631485f5..866f9a4f1 100644
--- a/lib/Config/FetcherConfig.php
+++ b/lib/Config/FetcherConfig.php
@@ -58,6 +58,14 @@ class FetcherConfig
const DEFAULT_USER_AGENT = 'NextCloud-News/1.0';
/**
+ * Acccept header for the client.
+ * @var string
+ */
+ const DEFAULT_ACCEPT = 'application/rss+xml, application/rdf+xml;q=0.8, ' .
+ 'application/atom+xml;q=0.6, application/xml;q=0.4, ' .
+ 'text/xml;q=0.4, */*;q=0.2';
+
+ /**
* Configure a guzzle client
*
* @return ClientInterface Legacy client to guzzle.
@@ -78,7 +86,7 @@ class FetcherConfig
{
$config = [
'timeout' => $this->client_timeout,
- 'headers' => ['User-Agent' => static::DEFAULT_USER_AGENT],
+ 'headers' => ['User-Agent' => static::DEFAULT_USER_AGENT, 'Accept' => static::DEFAULT_ACCEPT],
];
if (!empty($this->proxy)) {