Skip to content

Commit

Permalink
fix response->end
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor committed Oct 12, 2015
1 parent 9fee96d commit b234e6d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Engine/Protocols/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,23 @@ public function end($data = null)
{
$this->write($data);
}

if(!$this->headersSent)
{
$head_buffer = $this->getHeadBuffer();
$this->_buffer = $head_buffer;
$this->headersSent = true;
}

if(!isset($this->_headers['Content-Length']))
{
$ret = $this->_connection->send($this->_buffer . "0\r\n\r\n", true);
$this->destroy();
return $ret;
}
$ret = $this->_connection->send($this->_buffer, true);
$this->destroy();
return true;
return $ret;
}

public function destroy()
Expand Down

0 comments on commit b234e6d

Please sign in to comment.