Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 000c469

Browse files
committed
Fix wrong Content-Length on AsyncResponseStream: always return "null" and apply proper test in SapiEmitter.
1 parent 7c0cdba commit 000c469

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

core/src/core/src/pydio/Core/Http/Middleware/SapiMiddleware.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,14 @@ public function emitResponse(ServerRequestInterface $request, ResponseInterface
130130
$response = $response->withHeader("Content-type", "text/xml; charset=UTF-8");
131131
}
132132
}
133+
if($response === false){
134+
return;
135+
}
133136

134-
if($response !== false && ($response->getBody()->getSize() || $response instanceof \Zend\Diactoros\Response\EmptyResponse) || $response->getStatusCode() != 200) {
137+
if( $response->getBody()->getSize() === null
138+
|| $response->getBody()->getSize() > 0
139+
|| $response instanceof \Zend\Diactoros\Response\EmptyResponse
140+
|| $response->getStatusCode() != 200) {
135141
$emitter = new SapiEmitter();
136142
ShutdownScheduler::setCloseHeaders($response);
137143
$emitter->emit($response);

core/src/core/src/pydio/Core/Http/Response/AsyncResponseStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function detach()
100100
public function getSize()
101101
{
102102
// Return a non-null size if there's a pending callback.
103-
return (isSet($this->callback) && !$this->callbackExecuted ? 1 : null);
103+
return null;//(isSet($this->callback) && !$this->callbackExecuted ? 1 : null);
104104
}
105105

106106
/**

0 commit comments

Comments
 (0)