ID: 43922 Comment by: daniel at haxx dot se Reported By: dragos dot matachescu at dna dot ro Status: Open Bug Type: cURL related Operating System: Windows XP SP2 PHP Version: 5.2.5 New Comment:
Correct, this is the expected and designed behaviour as you're doing a GET request but changes the method keyword to "HEAD" which doesn't make libcurl act differently. It will still act like it does a GET. You get what you ask for. The NOBODY option is for changing a GET to HEAD and make libcurl treat it as such. So: thisisnotabug Previous Comments: ------------------------------------------------------------------------ [2008-01-23 17:59:44] dragos dot matachescu at dna dot ro 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 this bug report at http://bugs.php.net/?id=43922&edit=1