Permalink
Browse files

Fix wrong Content-Length on AsyncResponseStream: always return "null"…

… and apply proper test in SapiEmitter.
  • Loading branch information...
1 parent 7c0cdba commit 000c4692a04b64c31aee50fb1f20da0c30aaf9ce @cdujeu cdujeu committed Oct 12, 2016
@@ -130,8 +130,14 @@ public function emitResponse(ServerRequestInterface $request, ResponseInterface
$response = $response->withHeader("Content-type", "text/xml; charset=UTF-8");
}
}
+ if($response === false){
+ return;
+ }
- if($response !== false && ($response->getBody()->getSize() || $response instanceof \Zend\Diactoros\Response\EmptyResponse) || $response->getStatusCode() != 200) {
+ if( $response->getBody()->getSize() === null
+ || $response->getBody()->getSize() > 0
+ || $response instanceof \Zend\Diactoros\Response\EmptyResponse
+ || $response->getStatusCode() != 200) {
$emitter = new SapiEmitter();
ShutdownScheduler::setCloseHeaders($response);
$emitter->emit($response);
@@ -100,7 +100,7 @@ public function detach()
public function getSize()
{
// Return a non-null size if there's a pending callback.
- return (isSet($this->callback) && !$this->callbackExecuted ? 1 : null);
+ return null;//(isSet($this->callback) && !$this->callbackExecuted ? 1 : null);
}
/**

0 comments on commit 000c469

Please sign in to comment.