php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39611 Use of CURLOPT_NOBODY yields a 404 inexplicably
Submitted: 2006-11-24 05:15 UTC Modified: 2006-11-24 09:02 UTC
From: asbo at iserv dot net Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.2.0 OS: Windows XP Professional
Private report: No CVE-ID: None
 [2006-11-24 05:15 UTC] asbo at iserv dot net
Description:
------------
I'm running a default PHP 5.2.0 installation on Apache 2.0.55, XP Pro.

Using cURL, the introduction of the CURLOPT_NOBODY setting results in cURL receiving a 404 page instead of the actual web page.

In my understanding, the NOBODY setting shouldn't change the actual HTTP request at all, and therefore I should the same headers regardless of NOBODY being set or not.

It doesn't seem like I'm missing something important -- feel free to correct me.

Reproduce code:
---------------
<?php
$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'http://video.google.com/videoplay?docid=1384277706451157121');
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_NOBODY, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
  echo curl_exec($ch);
curl_close($ch);
?>

Expected result:
----------------
HTTP/1.1 200 OK
Set-Cookie: sloc=en
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Cache-control: private
Date: Fri, 24 Nov 2006 04:41:12 GMT
Server: GFE/1.3

                                                 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>

(... etc)

Actual result:
--------------
HTTP/1.1 404 Not Found
Set-Cookie: sloc=en
Content-Type: text/html; charset=UTF-8
Content-Length: 141
Cache-control: private
Date: Fri, 24 Nov 2006 04:49:49 GMT
Server: GFE/1.3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-24 07:31 UTC] asbo at iserv dot net
I thought I'd clarify a bit more; the following line:
  curl_setopt($ch, CURLOPT_HEADER, true);
is extraneous. If I remove this line and and the HTTP response code using curl_getinfo(), I'm still getting a 404.

Using NOBODY(true) in addition to RETURNTRANSFER(false) may seem redundant, but RETURNTRANSFER(false) [as well as nothing except the URL set] alone still has cURL dumping the remote page into the output buffer.
 [2006-11-24 09:02 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 17:01:30 2024 UTC