Skip to content

Commit

Permalink
Proxy: do not set timeout for requests to ExApp (#357)
Browse files Browse the repository at this point in the history
We forgot to change this in this PR:
#277

For Proxy requests there should be no timeout, cause they are coming
from user or external services and not from Nextcloud

Even if they will take a long time, Nextcloud instance will be not slow
down

Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
  • Loading branch information
bigcat88 authored Aug 8, 2024
1 parent 42fdee1 commit 2374d55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Controller/ExAppProxyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function ExAppGet(string $appId, string $other): Response {
$exApp, '/' . $other, $this->userId, 'GET', queryParams: $_GET, options: [
RequestOptions::COOKIES => $this->buildProxyCookiesJar($_COOKIE, $this->service->getExAppDomain($exApp)),
RequestOptions::HEADERS => $this->buildHeadersWithExclude($exApp, $other, getallheaders()),
RequestOptions::TIMEOUT => 0,
],
request: $this->request,
);
Expand All @@ -112,6 +113,7 @@ public function ExAppPost(string $appId, string $other): Response {
$options = [
RequestOptions::COOKIES => $this->buildProxyCookiesJar($_COOKIE, $this->service->getExAppDomain($exApp)),
RequestOptions::HEADERS => $this->buildHeadersWithExclude($exApp, $other, getallheaders()),
RequestOptions::TIMEOUT => 0,
];
if (str_starts_with($this->request->getHeader('Content-Type'), 'multipart/form-data') || count($_FILES) > 0) {
unset($options['headers']['Content-Type']);
Expand Down Expand Up @@ -149,6 +151,7 @@ public function ExAppPut(string $appId, string $other): Response {
RequestOptions::COOKIES => $this->buildProxyCookiesJar($_COOKIE, $this->service->getExAppDomain($exApp)),
RequestOptions::BODY => $stream,
RequestOptions::HEADERS => $this->buildHeadersWithExclude($exApp, $other, getallheaders()),
RequestOptions::TIMEOUT => 0,
];
$response = $this->service->requestToExApp2(
$exApp, '/' . $other, $this->userId, 'PUT',
Expand All @@ -175,6 +178,7 @@ public function ExAppDelete(string $appId, string $other): Response {
RequestOptions::COOKIES => $this->buildProxyCookiesJar($_COOKIE, $this->service->getExAppDomain($exApp)),
RequestOptions::BODY => $stream,
RequestOptions::HEADERS => $this->buildHeadersWithExclude($exApp, $other, getallheaders()),
RequestOptions::TIMEOUT => 0,
];
$response = $this->service->requestToExApp2(
$exApp, '/' . $other, $this->userId, 'DELETE',
Expand Down
4 changes: 4 additions & 0 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<code><![CDATA[RequestOptions]]></code>
<code><![CDATA[RequestOptions]]></code>
<code><![CDATA[RequestOptions]]></code>
<code><![CDATA[RequestOptions]]></code>
<code><![CDATA[RequestOptions]]></code>
<code><![CDATA[RequestOptions]]></code>
<code><![CDATA[RequestOptions]]></code>
<code><![CDATA[SetCookie]]></code>
</UndefinedClass>
</file>
Expand Down

0 comments on commit 2374d55

Please sign in to comment.