ID:               28955
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mlemos at acm dot org
-Status:           Open
+Status:           Bogus
 Bug Type:         Sockets related
 Operating System: *
 PHP Version:      4.3.7
 New Comment:

I'd suggest you read the HTTP specification.  Pay particular attention
to the section on HTTP Chunking.  Absolutely no bug here.


Previous Comments:
------------------------------------------------------------------------

[2004-06-29 07:33:36] mlemos at acm dot org

Description:
------------
When making an HTTP 1.1 request using fsockopen, the response returns
some numbers at the beginning and the end of the response data returned
by fread that seem like it is debug data, probably the number of unread
bytes.

If the request line specifies HTTP 1.0, the problem does not occur.
This problem prevents making HTTP requests to servers that require
protocol 1.1.

Reproduce code:
---------------
<?php
  $host="www.php.net";
  $port=80;
  $socket=fsockopen($host,$port,$error);
  if(!$socket)
  {
    echo "socket opening error\n";
    exit;
  }
  echo "connection opened\n";
  $request="GET / HTTP/1.1\r\nHost: www.php.net\r\n\r\n";
  if(!fputs($socket,$request))
  {
    echo "socket writing error\n";
    exit;
  }
  while(!feof($socket))
  {
    $data=fread($socket,1000);
    if(!$data)
      break;
    var_dump($data);
  }
  fclose($socket);
?>

Expected result:
----------------
The actual page headers and content

Actual result:
--------------
Some numbers appear before and after the page content data.


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


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

Reply via email to