Commit Graph

21 Commits

Author SHA1 Message Date
Morris Jobke dc479aae2d
Improve CertificateManager to not be user context dependent
* removes the ability for users to import their own certificates (for external storage)
* reliably returns the same certificate bundles system wide (and not depending on the user context and available sessions)

The user specific certificates were broken in some cases anyways, as they are only loaded if the specific user is logged in and thus causing unexpected behavior for background jobs and other non-user triggered code paths.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-11-03 00:13:01 +01:00
Morris Jobke 18b0d753f2
Do not read certificate bundle from data dir by default
Before the resources/config/ca-bundle.crt was only used when the list of custom
certificates was empty and the instance was not installed. But it should also
be used when the list is empty and the instance is installed.

This is inverting the logic to stop if the instance is not installed to use the
default bundle. And it also does this when the list is empty.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-05-25 16:57:56 +02:00
Morris Jobke 8bcd1c31da
Allow gzip encoded requests by default
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-05-20 13:37:28 +02:00
Joas Schilling fd0c1a3bb2
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-04-15 08:06:51 +02:00
Joas Schilling 5e402f8aae
Check all remotes for local access
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-04-14 18:56:06 +02:00
Mohammed Abdellatif 98d6415264 Add support for GuzzleHTTP 'no' proxy
The custom config allows to setup a proxy URI that is passed to
GuzzleHTTP client as request options. Guzzle has the option to receive
an array of proxies for each URI scheme as well as 'no' key value pair
to provide a list of host names that should not be proxied to.

Guzzle would automatically populate these options with HTTPS_PROXY
and NO_PROXY environment variables. However, when providing a 'proxy'
request option, default values will be overriden and it is required to
explicitly provide the 'no' value if needed.

More info:
http://docs.guzzlephp.org/en/stable/request-options.html#proxy

This commit will add support for a new config 'proxyexclude', which
takes a list of host names to be excluded.

It will also provide 'proxy' request option as an array instead of a
string to Guzzle, and populate 'http' and 'https' URI schemes with
proxy URI, and 'no' with 'proxyexclude' list.

Also, if no 'proxy' is configured, it will leave out 'proxy' request
option, so it won't override Guzzle default values.

Sample config file includes a hint on how to explicitly sync
'proxyexclude' with NO_PROXY, and a note about default values.

Signed-off-by: Mohammed Abdellatif <m.latief@gmail.com>
2020-02-29 19:19:23 +02:00
John Molakvoæ (skjnldsv) 0687b9ed8a
[3rdparty] Bump guzzlehttp/guzzle from 6.3.3 to 6.5.2
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2020-02-11 20:49:27 +01:00
Roeland Jago Douma 3a7cf40aaa
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-27 15:27:18 +01:00
Roeland Jago Douma c007ca624f
Make phpunit8 compatible
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-27 13:34:41 +01:00
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Daniel Kesselberg 773778dd8c
Add default timeout to expected request options
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-09-03 14:59:09 +02:00
Scott Shambarger edf946dfc7
Correctly handle emtpy string in proxyuserpwd config
As documented, the default value for config value proxyuserpwd is ''.
However, that value results in the error:
 "cURL error 5: Unsupported proxy syntax in '@'".
This patch handles the values of '' and null (the default in the code)
the same for config values proxyuserpwd and proxy.

Signed-off-by: Scott Shambarger <devel@shambarger.net>
2019-08-11 21:07:30 +02:00
Daniel Kesselberg 6c156d81ed
Fix testGetProxyUri
Changed the implementation for getProxyUri with
fd1d85365c

If proxy is already null then we don't ask for proxyuserpwd. Test
failed because we expected getSystemValue to be called once with
proxyuserpwd

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-04-16 21:33:56 +02:00
Daniel Kesselberg 2708d26407
Set User-Agent as header without middleware
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-04-16 21:13:29 +02:00
Daniel Calviño Sánchez 00c3a7eb4c Fix HTTP client given options being overriden by default options
According to the array_merge documentation, "If the input arrays have
the same string keys, then the later value for that key will overwrite
the previous one." Thus, the default options must be the first parameter
passed to array_merge.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-06-14 21:36:04 +02:00
Robin Appelman 9b25ff9fcb
adjust httpclient to guzzle6
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-02-09 17:13:21 +01:00
Lukas Reschke 1b8aae837c Merge pull request #2912 from nextcloud/increase-coverage-response.php
Add 100% coverage for response.php
2017-01-02 16:01:47 +01:00
Lukas Reschke 746fc3d3bf
Add 100% coverage for response.php
While already at https://github.com/nextcloud/server/pull/2911 I thought I can as well finish that one as well...

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-01-02 15:16:35 +01:00
Lukas Reschke 5679f04cb1
Rebrand to "Nextcloud" and add 100% coverage
Noticed while debugging https://github.com/nextcloud/server/issues/2910

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-01-02 14:51:16 +01:00
Roeland Jago Douma 97f6410ac8
Fix getMock Http Client 2016-09-07 20:42:37 +02:00
Joas Schilling 94ad54ec9b Move tests/ to PSR-4 (#24731)
* Move a-b to PSR-4

* Move c-d to PSR-4

* Move e+g to PSR-4

* Move h-l to PSR-4

* Move m-r to PSR-4

* Move s-u to PSR-4

* Move files/ to PSR-4

* Move remaining tests to PSR-4

* Remove Test\ from old autoloader
2016-05-20 15:38:20 +02:00