hi,

sorry if i'm sending this to the wrong place, but
here's a patch (of the PHP_5_2 branch) that adds an extra option to curl
(CURLOPT_LITERAL_POSTFIELDS).
it is the exact same thing as CURLOPT_POSTFIELDS, except it skips the
check for leading '@' in the postdata, so you can post without fear or
accidentally uploading a file.

hope you like it and include it soon.
bye,
        mihaly
-- 
huf (Berenyi Mihaly) - h...@keszen.hu - http://parawag.net
...........it's life jim, but not as we know it...........
Index: ext/curl/interface.c
===================================================================
--- ext/curl/interface.c	(revision 288614)
+++ ext/curl/interface.c	(working copy)
@@ -410,6 +410,7 @@
 	REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT_MS);
 #endif
 	REGISTER_CURL_CONSTANT(CURLOPT_POSTFIELDS);
+	REGISTER_CURL_CONSTANT(CURLOPT_LITERAL_POSTFIELDS);
 	REGISTER_CURL_CONSTANT(CURLOPT_REFERER);
 	REGISTER_CURL_CONSTANT(CURLOPT_USERAGENT);
 	REGISTER_CURL_CONSTANT(CURLOPT_FTPPORT);
@@ -1559,6 +1560,7 @@
 			error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA,     (void *) ch);
 			break;
 #endif
+		case CURLOPT_LITERAL_POSTFIELDS:
 		case CURLOPT_POSTFIELDS:
 			if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
 				zval            **current;
@@ -1592,7 +1594,7 @@
 					/* The arguments after _NAMELENGTH and _CONTENTSLENGTH
 					 * must be explicitly cast to long in curl_formadd
 					 * use since curl needs a long not an int. */
-					if (*postval == '@') {
+					if (option == CURLOPT_POSTFIELDS && *postval == '@') {
 						char *type, *filename;
 						++postval;
 
Index: ext/curl/php_curl.h
===================================================================
--- ext/curl/php_curl.h	(revision 288614)
+++ ext/curl/php_curl.h	(working copy)
@@ -42,6 +42,7 @@
 
 #define CURLOPT_RETURNTRANSFER 19913
 #define CURLOPT_BINARYTRANSFER 19914
+#define CURLOPT_LITERAL_POSTFIELDS 19915
 #define PHP_CURL_STDOUT 0
 #define PHP_CURL_FILE   1
 #define PHP_CURL_USER   2

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to