|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-03-30 14:55 UTC] rooneg at electricjellyfish dot net
[2001-04-02 15:26 UTC] rooneg at electricjellyfish dot net
[2001-04-24 18:13 UTC] sterling@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 15:00:01 2025 UTC |
The CURLOPT_HTTPHEADER option for curl_setopt does not currently work correctly. in the 4.0.4pl1 release, it didn't work at all because the constant CURLOPT_HTTPHEADER was mistakenly defined to CURLOPT_HEADER instead of the correct value. That appears to have been corrected in cvs. The fix is not complete however. In lines 486 and 487 of curl.c you are mallocing memory for a curl_slist and zeroing it out, then using curl_slist_append later to add things to the list. This is incorrect. curl_slist_append should initially be called with a null pointer as its list, and it will correctly allocate the memory itself. If you allocate and zero the memory, that adds an item at the beginning of the list which is empty. Later, when you try to execute with curl_exec, it will crash because it trys to do a strncmp against a null pointer inside your list object. simply removing lines 486 and 487 will make everything work properly. a patch versus the latest cvs is attached below. appologies for any trouble applying this, as i had to cut and paste it into the web form. Index: curl.c =================================================================== RCS file: /repository/php4/ext/curl/curl.c,v retrieving revision 1.41 diff -u -r1.41 curl.c --- curl.c 2001/03/20 21:30:42 1.41 +++ curl.c 2001/03/30 19:37:40 @@ -483,9 +483,6 @@ RETURN_FALSE; } - header = emalloc(sizeof(struct curl_slist)); - memset(header, 0, sizeof(struct curl_slist)); - for (zend_hash_internal_pointer_reset(headers); zend_hash_get_current_data(headers, (void * *)¤t) == SUCCESS; zend_hash_move_forward(headers)) {