From: dragos dot matachescu at dna dot ro
Operating system: Windows XP SP2
PHP version: 5.2.5
PHP Bug Type: cURL related
Bug description: CURL HEAD command problem
Description:
------------
This bug is not solved:
Bug #27341 CURLOPT_CUSTOMREQUEST 'HEAD' misbehaves?
I checked with latest CVS version
I dont know what you have solved, but the real issus is this: when calling
using CURL IIS servers, those servers will return (correctly) in the HEAD
method reply the Content-Length field. This is OK because the HTTP protocol
says HEAD should be identical with GET, only the body of the response
should not be sent in case of HEAD. Apache in case of a HEAD command will
NOT return Content-Length in response, so dont test against Apache and say
it works. So, if Content-Length is present in a HEAD response, CURL will
block waiting to receive o response body of the given length, and this will
never come. See below script to reproduce the problem (is the script you
proposed at Bug #27341 resolution, only URL is modified to call an IIS
server)
Reproduce code:
---------------
<?php
$ch = curl_init('http://www.robertoswinds.com/store/p.asp?c=126'); //MAKE
SURE URL HERE IS FROM A IIS SERVER. THIS IS, I KNOW IT BECAUSE IS MY
SERVER.
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
var_dump(curl_exec($ch));
?>
Expected result:
----------------
return the page content
Actual result:
--------------
HTTP/1.1 200 OK
Date: Wed, 23 Jan 2008 17:49:20 GMT
Server: Microsoft-IIS/6.0
Content-Length: 16914
Content-Type: text/html
Set-Cookie: ASPSESSIONIDSSCDDQSS=NFLPAACDIBKLHIGINKELONCJ; path=/
Cache-control: private
<br />
<b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in
<b>C:\wamp\www\hub\p.php</b> on line <b>5</b><br />
--
Edit bug report at http://bugs.php.net/?id=43922&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43922&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43922&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43922&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43922&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43922&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43922&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43922&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43922&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43922&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43922&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43922&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43922&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43922&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43922&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43922&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43922&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43922&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43922&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43922&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43922&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43922&r=mysqlcfg