php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39086 curl response garbage when using CURLOPT_NOBODY
Submitted: 2006-10-09 03:05 UTC Modified: 2006-10-09 16:03 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: gmblar at gmail dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.1.6 OS: Windows 2000
Private report: No CVE-ID: None
 [2006-10-09 03:05 UTC] gmblar at gmail dot com
Description:
------------
toggle curl option CURLOPT_NOBODY between curl requests create garbage in response on some (not all!) servers

Reproduce code:
---------------
<?php

$h = curl_init();

curl_setopt_array($h, array(
    CURLOPT_RETURNTRANSFER    => true,
    CURLOPT_URL        => 'http://webdesignblog.de/?p=612',
    CURLOPT_CUSTOMREQUEST    => 'GET',
    CURLOPT_HEADER        => true,
    CURLOPT_NOBODY        => true
));

curl_exec($h);

curl_setopt_array($h, array(
    CURLOPT_CUSTOMREQUEST    => 'GET',
    CURLOPT_HEADER        => false,
    CURLOPT_NOBODY        => false
));

echo curl_exec($h);

?>

Expected result:
----------------
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head profile="http://gmpg.org/xfn/11">
 

<title>  Webdesign - Unbezahlbar &raquo; Webdesignblog</title>

<meta name="description" content="Webdesignblog spricht ueber Themen fuer Webdesigner und Webmaster. Alles was den Erfolg der eigenen Website oder des eigenen Blogs erhoeht und wie man sich als Webdesigner verbessert." />
<meta name="keywords" content="Webdesign, Website, Adsense, Grafikdesign, Design, Blog, bloggen, Affiliate, Suchmaschinen, Optimierung" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
...

Actual result:
--------------
<title>
19 
  Webdesign - Unbezahlbar
9  
 &raquo; 
d  
Webdesignblog
8  
</title>
1  


193

<meta name="description" content="Webdesignblog spricht ueber Themen fuer Webdesigner und Webmaster. Alles was den Erfolg der eigenen Website oder des eigenen Blogs erhoeht und wie man sich als Webdesigner verbessert." />
<meta name="keywords" content="Webdesign, Website, Adsense, Grafikdesign, Design, Blog, bloggen, Affiliate, Suchmaschinen, Optimierung" />
<meta http-equiv="Content-Type" content="
9  
text/html
a  
; charset=
5  
UTF-8
f0 
" />
...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-09 09:49 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Cannot reproduce,
 [2006-10-09 14:19 UTC] gmblar at gmail dot com
same problem with latest 5.2 snapshot.

webserver: lighttpd 1.4.11 with php over cgi
curl info (phpinfo): libcurl/7.14.0 OpenSSL/0.9.8d zlib/1.2.3
 [2006-10-09 16:03 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The site in question sends different content depending on the 
headers sent. The "weird" numbers you see are actually part of 
the Transfer-Encoding: chunked
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 18:01:32 2019 UTC