Bug #70815 [Fbk->NoF]: Linefeed not handled correctly in curl command output

From: Date: Sun, 08 Nov 2015 04:22:16 +0000
Subject: Bug #70815 [Fbk->NoF]: Linefeed not handled correctly in curl command output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197112@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70815&edit=1

 ID:               70815
 Updated by:       php-bugs@lists.php.net
 Reported by:      abhatnagar at blackberry dot com
 Summary:          Linefeed not handled correctly in curl command output
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          cURL related
 Operating System: Ubuntu 3.16.0-51-lowlatency
 PHP Version:      5.5Git-2015-10-29 (snap)
 Private report:   N

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2015-10-30 18:50:26] requinix@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

Specifically, what's the rest of get_web_page's code?

------------------------------------------------------------------------
[2015-10-30 13:20:11] abhatnagar at blackberry dot com

Here is the relevant output of page source
<br><br>es-thr-hdp-02.dbplat.altus.bblabs.rim.net 10.236.133.158 7 55 0.00 d m
es-thr-hdp-02 es-thr-hdp-01.dbplat.altus.bblabs.rim.net 10.236.133.157 4 56 0.00 d * es-thr-hdp-01 
<br>
</body>
</html>

------------------------------------------------------------------------
[2015-10-30 03:32:05] requinix@php.net

Do a View Source of the page.

------------------------------------------------------------------------
[2015-10-29 18:12:03] abhatnagar at blackberry dot com

Description:
------------
Command Line curl output with linefeeds. Displayed correctly in terminal.
curl -vvv 'localhost:9200/_cat/nodes/?v'
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 9200 (#0)
> GET /_cat/nodes/?v HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:9200
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 357
<
host                                      ip             heap.percent ram.percent load node.role
master name
es-thr-hdp-02.dbplat.altus.bblabs.rim.net 10.236.133.15            3          55 0.01 d         m   
  es-thr-hdp-02
es-thr-hdp-01.dbplat.altus.bblabs.rim.net 10.236.133.17            9          56 0.00 d         *   
  es-thr-hdp-01

Same output in php displayed out put in browser without linefeed as a single line:

HTTP/1.1 200 OK Content-Type: text/plain; charset=UTF-8 Content-Length: 357 host ip heap.percent
ram.percent load node.role master name es-thr-hdp-02.dbplat.altus.bblabs.rim.net 10.236.133.15 3 55
0.00 d m es-thr-hdp-02 es-thr-hdp-01.dbplat.altus.bblabs.rim.net 10.236.133.17 9 56 0.00 d *
es-thr-hdp-01 


Test script:
---------------
function get_web_page( $url )
{
    $options = array(
        CURLOPT_RETURNTRANSFER => true,     // return web page
        CURLOPT_HEADER         => true,    // don't return headers
        CURLOPT_VERBOSE        => true,    //
        CURLOPT_CRLF           => true,    //
        CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        CURLOPT_ENCODING       => "",       // handle all encodings
        CURLOPT_USERAGENT      => "spider", // who am i
        CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 5,      // timeout on connect
        CURLOPT_TIMEOUT        => 5,      // timeout on response
        CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
        CURLOPT_HTTPHEADER      => array('Content-Type: text/plain'),       //
    );
....
   $url = "http://$master_nodes:9200/_cat/nodes?v";
   echo "<br>";
   $curl_response = get_web_page( $url );
   echo $curl_response['content'];
   echo "<br>";




Expected result:
----------------
Output should be on different lines: as below


HTTP/1.1 200 OK 
Content-Type: text/plain; charset=UTF-8 
Content-Length: 357

host ip heap.percent ram.percent load node.role master name 
es-thr-hdp-02.dbplat.altus.bblabs.rim.net 10.236.133.158 3 55 0.00 d m es-thr-hdp-02 
es-thr-hdp-01.dbplat.altus.bblabs.rim.net 10.236.133.157 9 56 0.00 d * es-thr-hdp-01 

Actual result:
--------------
HTTP/1.1 200 OK Content-Type: text/plain; charset=UTF-8 Content-Length: 357 host ip heap.percent
ram.percent load node.role master name es-thr-hdp-02.dbplat.altus.bblabs.rim.net 10.236.133.158 3 55
0.00 d m es-thr-hdp-02 es-thr-hdp-01.dbplat.altus.bblabs.rim.net 10.236.133.157 9 56 0.00 d *
es-thr-hdp-01 

Note: Content Array returned has only 1 element for single line.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70815&edit=1


Thread (5 messages)

« previous php.bugs (#197112) next »