From:             signe at cothlamadh dot net
Operating system: FreeBSD 7.0
PHP version:      5.2.6
PHP Bug Type:     cURL related
Bug description:  cURL output includes content from redirects when 
CURLOPT_FOLLOWLOCATION set

Description:
------------
When retrieving a url that utilizes a 302 redirect, along with viewable
error-document content, the error-document is prepended to any REAL content
that is retrieved after following the redirect.

This issue is compounded when CURLOPT_HEADER is enabled, because the
error-document content is not counted in any of the getinfo data.

Reproduce code:
---------------
http://www.cothlamadh.net/~signe/.outgoing/curl_location.phps

Tested with curl 7.18.0 on FreeBSD 7 and 7.16.4-2ubuntu1 on Ubuntu Gutsy.

Expected result:
----------------
Non-header data from redirects should not be included in the returned
content.

Actual result:
--------------
Without headers enabled, the content returned looks like this:


"""
RedirectErrorDocumentContent
ActualDocument
"""

There is no whitespace between the two documents.

With headers enabled, it's much much worse.

"""
RedirectHeader

RedirectErrorDocumentContent
ActualDocumentHeader

ActualDocument
"""

There is whitespace between each set of headers and its respective
content, but not between the first content and the second batch of
headers.

To make matters worse, curl_getinfo($cUrl, CURLINFO_HEADER_SIZE) returns
the combined length of both header sections, as is expected, and
curl_getinfo($cUrl, CURLINFO_CONTENT_LENGTH_DOWNLOAD) returns the length of
the ActualDocument, also as expected.  The result of this is that
RedirectErrorDocumentContent gets tossed in the middle invisibly.  This
makes it impossible to cleanly split the document into header and content
sections.

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

Reply via email to