From:             [EMAIL PROTECTED]
Operating system: FreeBSD 4.3
PHP version:      4.0 Latest CVS (30/03/2001)
PHP Bug Type:     
Bug description:  curl_setopt with CURLOPT_HTTPHEADER option is broken

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

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 @@

-                               header =
emalloc(sizeof(struct curl_slist));
-                               memset(header, 0,
sizeof(struct curl_slist));
zend_hash_get_current_data(headers, (void *
*)&current) == SUCCESS;
zend_hash_move_forward(headers)) {

Edit Bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to