|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2009-01-23 23:39 UTC] avb@php.net
[2009-06-22 16:04 UTC] felix-php at 7val dot com
[2009-09-20 08:47 UTC] avb@php.net
[2009-09-20 17:31 UTC] jani@php.net
[2009-09-24 19:26 UTC] srinatar@php.net
[2009-11-11 20:09 UTC] svn@php.net
[2009-11-14 15:39 UTC] avb@php.net
[2009-11-14 16:02 UTC] avb@php.net
[2009-11-15 10:53 UTC] svn@php.net
[2010-12-09 04:47 UTC] srinatar@php.net
-Package: Feature/Change Request
+Package: *General Issues
-Assigned To: srinatar
+Assigned To:
[2021-09-11 12:02 UTC] theasialive at gmail dot com
[2022-07-15 18:03 UTC] rolexwp dot org at gmail dot com
[2022-07-15 18:22 UTC] rolexwp dot org at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 22:00:02 2025 UTC |
Description: ------------ PHP's cURL extension allows using a callback for reading the request body via CURLOPT_READFUNCTION, but it doesn't provide a way to set a CURLOPT_IOCTLFUNCTION callback for rewinding the request body. This rewinding may be needed when doing a POST or PUT HTTP request to resource protected by Digest authentication. Reproduce code: --------------- <?php $position = 0; $data = 'foo=' . str_repeat('bar', 10000); function read_callback($ch, $fd, $length) { global $position, $data; if ($position >= strlen($data)) { return ''; } $string = substr($data, $position, $length); $position += strlen($string); return $string; } $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, true); // This should be some URL protected by HTTP digest auth! curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/digest/'); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); curl_setopt($ch, CURLOPT_USERPWD, 'user:password'); curl_setopt($ch, CURLOPT_READFUNCTION, 'read_callback'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Length: ' . strlen($data))); if (!curl_exec($ch)) { echo 'Error #' . curl_errno($ch) . ': ' . curl_error($ch); } ?> Expected result: ---------------- Request should proceed. Actual result: -------------- Error #65: necessary data rewind wasn't possible