Bug #53556 [Com]: cURL returns wrong Content-Length after a redirect to a page without CL-header

2013-03-04 Thread michael dot moench at marktjagd dot de
Edit report at https://bugs.php.net/bug.php?id=53556&edit=1

 ID: 53556
 Comment by: michael dot moench at marktjagd dot de
 Reported by:michael dot moench at marktjagd dot de
 Summary:cURL returns wrong Content-Length after a redirect
 to a page without CL-header
 Status: No Feedback
 Type:   Bug
 Package:HTTP related
 Operating System:   Ubuntu 10.04
 PHP Version:5.3SVN-2010-12-16 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

To reproduce this error you can use the following three scripts. index.php and 
hello.php are placed on an Apache-Webserver. If you call test.php it will load 
index.php, which returns a content-length of 3 and redirects to hello.php, 
which uses output-buffering and thus causes Apache to omit the content-length 
header. The result is that "download_content_length" returned by cURL is 3 
instead of NULL or -1.
This might be a bug in libCurl though.

test.php
http://php.local.site/index.php";);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
echo "\ndownload_content_length => ".$info['download_content_length']."\n";
?>

index.php
http://php.local.site/hello.php');
echo "...";
?>

hello.php



Previous Comments:

[2013-02-18 00:34:37] php-bugs at lists dot php dot net

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 "Open". Thank you.


[2010-12-21 23:02:39] il...@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 ,
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.




[2010-12-16 18:24:03] cataphr...@php.net

This looks like a problem upstream.

------------------------
[2010-12-16 13:27:22] michael dot moench at marktjagd dot de

Description:

I have an URL which will redirect me to a second, final URL. The first response 
contains a Content-Length-Header, the second does not. If I set the 
CURLOPT_FOLLOWLOCATION option, I would expect that the 
"download_content_length"-field from curl_getinfo contains the Content-Length 
of the final URL, in this case 0, but it contains the Content-Length of the 
first Response.

The first Response:

HTTP/1.1 302 Found
Date: Thu, 16 Dec 2010 11:39:31 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: http://productdata.download.affili.net/xxx
Set-Cookie: ASP.NET_SessionId=xxx; path=/; HttpOnly
Cache-Control: private
Content-Type: text/html; charset=Windows-1252
Content-Length: 214

The Second Response:

HTTP/1.1 200 OK
Date: Thu, 16 Dec 2010 11:39:32 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Content-Disposition: attachment; filename=xxx.gz
Transfer-Encoding: chunked
Cache-Control: private
Content-Type: application/gzip








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


[PHP-BUG] Bug #53556 [NEW]: cURL returns wrong Content-Length after a redirect to a page without CL-header

2010-12-16 Thread michael dot moench at marktjagd dot de
From: 
Operating system: Ubuntu 10.04
PHP version:  5.3SVN-2010-12-16 (SVN)
Package:  HTTP related
Bug Type: Bug
Bug description:cURL returns wrong Content-Length after a redirect to a page 
without CL-header

Description:

I have an URL which will redirect me to a second, final URL. The first
response contains a Content-Length-Header, the second does not. If I set
the CURLOPT_FOLLOWLOCATION option, I would expect that the
"download_content_length"-field from curl_getinfo contains the
Content-Length of the final URL, in this case 0, but it contains the
Content-Length of the first Response.



The first Response:



HTTP/1.1 302 Found

Date: Thu, 16 Dec 2010 11:39:31 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727

Location: http://productdata.download.affili.net/xxx

Set-Cookie: ASP.NET_SessionId=xxx; path=/; HttpOnly

Cache-Control: private

Content-Type: text/html; charset=Windows-1252

Content-Length: 214



The Second Response:



HTTP/1.1 200 OK

Date: Thu, 16 Dec 2010 11:39:32 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727

Content-Disposition: attachment; filename=xxx.gz

Transfer-Encoding: chunked

Cache-Control: private

Content-Type: application/gzip




-- 
Edit bug report at http://bugs.php.net/bug.php?id=53556&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53556&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53556&r=trysnapshot53
Try a snapshot (trunk):  
http://bugs.php.net/fix.php?id=53556&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53556&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53556&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53556&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=53556&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=53556&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=53556&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=53556&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=53556&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=53556&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=53556&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53556&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=53556&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=53556&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=53556&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=53556&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=53556&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=53556&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=53556&r=mysqlcfg