|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-07-16 21:30 UTC] signe at cothlamadh dot net
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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
I'm not "finally back" - I was asked for a script that can produce this problem 100% of the time. ("When you can provide a script that reproduces this problem every time, give us feedback.") There is no such thing. It's sporadic - it will happen with one URL for a while, and then something about the test changes and it stops reproducing. There is no discernible pattern to reproduction. The servers are not in my control so I have no insight into what the original settings were or what changed when the issue disappears. I have reproduced it with every PHP up to 5.2.9, and libcurl versions: 7.16.4 (Ubuntu Gutsy) 7.18.2 (Ubuntu Jaunty) as well as several revisions on FreeBSD that I no longer have available.