ID: 47204
User updated by: avb@php.net
Reported By: avb@php.net
Status: Open
Bug Type: Feature/Change Request
Operating System: Irrelevant
PHP Version: 5.3
Assigned To: srinatar
New Comment:
While adding PHP-side support for CURLOPT_IOCTLFUNCTION is indeed a
feature request, complete inability for curl extension to handle
redirects / digest authentication when using CURLOPT_INFILE
(CURLOPT_READDATA) looks like a genuine bug to me.
The problem lies with Curl extension registering a custom callback
curl_read() as CURLOPT_READFUNCTION (it handles both reading from a
stream provided as CURLOPT_INFILE and calling PHP callback provided as
CURLOPT_READFUNCTION) but failing to implement custom callback for
rewinding the data, at least for the case when stream is used.
Previous Comments:
------------------------------------------------------------------------
[2009-11-11 20:09:43] svn@php.net
Automatic comment from SVN on behalf of avb
Revision: http://svn.php.net/viewvc/?view=revision&revision=290520
Log: Enabled redirect support in Curl adapter.
Doesn't work *at all* with POST due to PHP bug #47204, workaround
needed.
------------------------------------------------------------------------
[2009-09-24 19:26:54] srinatar@php.net
since, this is a feature, this will probably apply only for 5.3
onwards.
------------------------------------------------------------------------
[2009-09-20 17:31:31] jani@php.net
Recategorized, this is not a bug.
------------------------------------------------------------------------
[2009-09-20 08:47:21] avb@php.net
Marking this as "cURL related" to increase visibility.
------------------------------------------------------------------------
[2009-06-22 16:04:07] felix-php at 7val dot com
This problem not only occurs when negotiating HTTP Auth. It's much
easier to provoke by posting to a URL that answers with a redirect.
Any valid HTTP redirect (be it 302, 303 or 307) lets curl rewind its
request body before following the Location header. Thus
CURLOPT_READFUNCTION is pretty useless for accessing web servers in
the wild. Therefore I think it's rather a bug than a feature.
Reproduce:
Both examples above with an extra
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
and a URL answering with a redirect.
(Tested with PHP 5.2.9 and curl 7.19.5)
Proposal:
Instead of adding CURLOPT_IOCTLFUNCTION to the PHP extension, this bug
could be fixed by adding the CURLTOP_SEEKFUNCTION functionality. If
set, curl uses this to rewind the body, too (see Curl_readrewind() in
transfer.c). But the seek_func callback is also used for resuming
uploads which might be a nice side effect.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/47204--
Edit this bug report at http://bugs.php.net/?id=47204&edit=1