From 6c01164b9b23ee70544487484c23a1bd196ca3c4 Mon Sep 17 00:00:00 2001 From: Carlos Silva Date: Fri, 16 Aug 2019 06:14:20 +0100 Subject: 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 * Use a more detailed Accept Header Signed-off-by: Carlos Mogas da Silva * Split up long line Signed-off-by: Carlos Mogas da Silva --- lib/Config/FetcherConfig.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/Config') 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 @@ -57,6 +57,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 * @@ -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)) { -- cgit v1.2.3