ID:               32906
 Updated by:       [EMAIL PROTECTED]
 Reported By:      papasha_papovich at mail dot ru
-Status:           Open
+Status:           Bogus
 Bug Type:         cURL related
 Operating System: Windows XP SP1
 PHP Version:      4.3.10
 New Comment:

That's not curl's fault.  If the server you are connecting to doesn't
send a content-length response header, there is no way for curl to know
the content-length.  The headers from http://www.softmath.com are:

HTTP/1.1 200 OK
Date: Sun, 01 May 2005 16:55:48 GMT
Server: Apache/1.3.33 (Unix) FrontPage/5.0.2.2635 mod_ssl/2.8.22
OpenSSL/0.9.7d
Connection: close
Content-Type: text/html

You will find that many servers won't send a content-length for
dynamically generated content.


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

[2005-05-01 18:23:57] papasha_papovich at mail dot ru

Description:
------------
I use CURL to get only the length of the document, I use CURLOPT_NOBODY
option, it returns the response header ok, but with content-length field
set to zero.

Reproduce code:
---------------
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.softmath.com";);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_exec($ch);
print_r(curl_getinfo($ch));
curl_close($ch);

Expected result:
----------------
Array
(
    [url] => http://www.softmath.com
    [content_type] => text/html
    [http_code] => 200
    [header_size] => 162
    [request_size] => 74
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.297
    [namelookup_time] => 0
    [connect_time] => 0.14
    [pretransfer_time] => 0.14
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => [the size of index page]
    [upload_content_length] => 0
    [starttransfer_time] => 0.297
    [redirect_time] => 0
)

Actual result:
--------------
Array
(
    [url] => http://www.softmath.com
    [content_type] => text/html
    [http_code] => 200
    [header_size] => 162
    [request_size] => 74
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.297
    [namelookup_time] => 0
    [connect_time] => 0.14
    [pretransfer_time] => 0.14
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 0
    [upload_content_length] => 0
    [starttransfer_time] => 0.297
    [redirect_time] => 0
)


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


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

Reply via email to