Skip to content

Commit

Permalink
Http service add cleanHandleOutput options
Browse files Browse the repository at this point in the history
  • Loading branch information
breath-co2 committed Jun 15, 2018
1 parent ebbdea6 commit 68e1d55
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Hprose/Http/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Service extends \Hprose\Service {
public $crossDomain = false;
public $p3p = false;
public $get = true;
private $origins = array();
protected $origins = array();
protected $cleanHandleOutput = true;

public function header($name, $value, $context) {
header("$name: $value");
Expand Down Expand Up @@ -137,10 +138,15 @@ public function handle($request = null, $response = null) {
}
}
elseif ($this->isPost($context)) {
ob_start();
ob_implicit_flush(0);
$result = $this->defaultHandle($this->readRequest($context), $context);
@ob_end_clean();
if (true === $this->cleanHandleOutput) {
ob_start();
ob_implicit_flush(0);
$result = $this->defaultHandle($this->readRequest($context), $context);
@ob_end_clean();
}
else {
$result = $this->defaultHandle($this->readRequest($context), $context);
}
}
else {
$result = $this->doFunctionList();
Expand Down

0 comments on commit 68e1d55

Please sign in to comment.