From d585a910fed006aeef184730ccd7b8f2837175de Mon Sep 17 00:00:00 2001 From: Alexander Pervakov Date: Sat, 10 Sep 2016 01:43:55 +0300 Subject: [PATCH] Set OS specific \r\n and \n --- http/http_client.php | 8 ++++---- http/http_request.php | 2 +- jaxlctl | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/http/http_client.php b/http/http_client.php index 5a376bdb..33aacb25 100644 --- a/http/http_client.php +++ b/http/http_client.php @@ -103,10 +103,10 @@ public function on_response($raw) protected function send_request() { - $this->client->send($this->line()."\r\n"); - $this->client->send($this->ua()."\r\n"); - $this->client->send($this->host()."\r\n"); - $this->client->send("\r\n"); + $this->client->send($this->line().HTTPServer::HTTP_CRLF); + $this->client->send($this->ua().HTTPServer::HTTP_CRLF); + $this->client->send($this->host().HTTPServer::HTTP_CRLF); + $this->client->send(HTTPServer::HTTP_CRLF); } // diff --git a/http/http_request.php b/http/http_request.php index e54d0d53..4d0e5a4a 100644 --- a/http/http_request.php +++ b/http/http_request.php @@ -225,7 +225,7 @@ public function wait_for_body($event, $args) if ($this->multipart) { // boundary start, content_disposition, form data, boundary start, ....., boundary end // these define various states of a multipart/form-data - $form_data = explode("\r\n", $rcvd); + $form_data = explode(HTTPServer::HTTP_CRLF, $rcvd); foreach ($form_data as $data) { //_debug("passing $data to multipart fsm"); if (!$this->multipart->process($data)) { diff --git a/jaxlctl b/jaxlctl index 52691219..890aacad 100755 --- a/jaxlctl +++ b/jaxlctl @@ -112,12 +112,12 @@ class JAXLCtl public static function printHelp() { global $exe; - _colorize("Usage: $exe command [options...]\n", JAXLLogger::INFO); + _colorize("Usage: $exe command [options...]".PHP_EOL, JAXLLogger::INFO); _colorize("Commands:", JAXLLogger::NOTICE); _colorize(" help This help text", JAXLLogger::DEBUG); _colorize(" debug Attach a debug console to a running JAXL daemon", JAXLLogger::DEBUG); _colorize(" shell Open up Jaxl shell emulator", JAXLLogger::DEBUG); - echo "\n"; + echo PHP_EOL; } protected function help() @@ -174,7 +174,7 @@ class JAXLCtl { $ret = unserialize($raw); print_r($ret); - echo "\n"; + echo PHP_EOL; JAXLCli::prompt(); } @@ -197,4 +197,4 @@ if ($argc < 2) { } $ctl = new JAXLCtl($command, $params); -echo "done\n"; +echo "done".PHP_EOL;