2 * @brief OAuth.net implementation in POSIX-C.
4 * @author Robin Gareus <robin@gareus.org>
6 * Copyright 2007-2014 Robin Gareus <robin@gareus.org>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30 #ifndef DOXYGEN_IGNORE
32 #define LIBOAUTH_VERSION "1.0.3"
33 #define LIBOAUTH_VERSION_MAJOR 1
34 #define LIBOAUTH_VERSION_MINOR 0
35 #define LIBOAUTH_VERSION_MICRO 3
37 //interface revision number
38 //http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
39 #define LIBOAUTH_CUR 8
40 #define LIBOAUTH_REV 7
41 #define LIBOAUTH_AGE 8
44 # define OA_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
46 # define OA_GCC_VERSION_AT_LEAST(x,y) 0
49 #ifndef attribute_deprecated
50 #if OA_GCC_VERSION_AT_LEAST(3,1)
51 # define attribute_deprecated __attribute__((deprecated))
53 # define attribute_deprecated
57 #endif /* doxygen ignore */
64 * signature method to used for signing the request.
67 OA_HMAC=0, ///< use HMAC-SHA1 request signing method
68 OA_RSA, ///< use RSA signature
69 OA_PLAINTEXT ///< use plain text signature (for testing only)
73 * Base64 encode and return size data in 'src'. The caller must free the
76 * @param size The size of the data in src
77 * @param src The data to be base64 encode
78 * @return encoded string otherwise NULL
80 char *oauth_encode_base64(int size, const unsigned char *src);
83 * Decode the base64 encoded string 'src' into the memory pointed to by
86 * @param dest Pointer to memory for holding the decoded string.
87 * Must be large enough to receive the decoded string.
88 * @param src A base64 encoded string.
89 * @return the length of the decoded string if decode
90 * succeeded otherwise 0.
92 int oauth_decode_base64(unsigned char *dest, const char *src);
95 * Escape 'string' according to RFC3986 and
96 * http://oauth.net/core/1.0/#encoding_parameters.
98 * @param string The data to be encoded
99 * @return encoded string otherwise NULL
100 * The caller must free the returned string.
102 char *oauth_url_escape(const char *string);
105 * Parse RFC3986 encoded 'string' back to unescaped version.
107 * @param string The data to be unescaped
108 * @param olen unless NULL the length of the returned string is stored there.
109 * @return decoded string or NULL
110 * The caller must free the returned string.
112 char *oauth_url_unescape(const char *string, size_t *olen);
116 * returns base64 encoded HMAC-SHA1 signature for
117 * given message and key.
118 * both data and key need to be urlencoded.
120 * the returned string needs to be freed by the caller
122 * @param m message to be signed
123 * @param k key used for signing
124 * @return signature string.
126 char *oauth_sign_hmac_sha1 (const char *m, const char *k);
129 * same as \ref oauth_sign_hmac_sha1 but allows one
130 * to specify length of message and key (in case they contain null chars).
132 * @param m message to be signed
133 * @param ml length of message
134 * @param k key used for signing
135 * @param kl length of key
136 * @return signature string.
138 char *oauth_sign_hmac_sha1_raw (const char *m, const size_t ml, const char *k, const size_t kl);
141 * returns plaintext signature for the given key.
143 * the returned string needs to be freed by the caller
145 * @param m message to be signed
146 * @param k key used for signing
147 * @return signature string
149 char *oauth_sign_plaintext (const char *m, const char *k);
152 * returns RSA-SHA1 signature for given data.
153 * the returned signature needs to be freed by the caller.
155 * @param m message to be signed
156 * @param k private-key PKCS and Base64-encoded
157 * @return base64 encoded signature string.
159 char *oauth_sign_rsa_sha1 (const char *m, const char *k);
162 * verify RSA-SHA1 signature.
164 * returns the output of EVP_VerifyFinal() for a given message,
165 * cert/pubkey and signature.
167 * @param m message to be verified
168 * @param c public-key or x509 certificate
169 * @param s base64 encoded signature
170 * @return 1 for a correct signature, 0 for failure and -1 if some other error occurred
172 int oauth_verify_rsa_sha1 (const char *m, const char *c, const char *s);
175 * url-escape strings and concatenate with '&' separator.
176 * The number of strings to be concatenated must be
177 * given as first argument.
178 * all arguments thereafter must be of type (char *)
180 * @param len the number of arguments to follow this parameter
182 * @return pointer to memory holding the concatenated
183 * strings - needs to be xfree(d) by the caller. or NULL
184 * in case we ran out of memory.
186 char *oauth_catenc(int len, ...);
189 * splits the given url into a parameter array.
190 * (see \ref oauth_serialize_url and \ref oauth_serialize_url_parameters for the reverse)
191 * (see \ref oauth_split_post_paramters for a more generic version)
193 * @param url the url or query-string to parse; may be NULL
194 * @param argv pointer to a (char *) array where the results are stored.
195 * The array is re-allocated to match the number of parameters and each
196 * parameter-string is allocated with strdup. - The memory needs to be freed
199 * @return number of parameter(s) in array.
201 int oauth_split_url_parameters(const char *url, char ***argv);
204 * splits the given url into a parameter array.
205 * (see \ref oauth_serialize_url and \ref oauth_serialize_url_parameters for the reverse)
207 * @param url the url or query-string to parse.
208 * @param argv pointer to a (char *) array where the results are stored.
209 * The array is re-allocated to match the number of parameters and each
210 * parameter-string is allocated with strdup. - The memory needs to be freed
212 * @param qesc use query parameter escape (vs post-param-escape) - if set
213 * to 1 all '+' are treated as spaces ' '
215 * @return number of parameter(s) in array.
217 int oauth_split_post_paramters(const char *url, char ***argv, short qesc);
220 * build a url query string from an array.
222 * @param argc the total number of elements in the array
223 * @param start element in the array at which to start concatenating.
224 * @param argv parameter-array to concatenate.
225 * @return url string needs to be freed by the caller.
228 char *oauth_serialize_url (int argc, int start, char **argv);
231 * encode query parameters from an array.
233 * @param argc the total number of elements in the array
234 * @param start element in the array at which to start concatenating.
235 * @param argv parameter-array to concatenate.
236 * @param sep separator for parameters (usually "&")
237 * @param mod - bitwise modifiers:
238 * 1: skip all values that start with "oauth_"
239 * 2: skip all values that don't start with "oauth_"
240 * 4: double quotation marks are added around values (use with sep ", " for HTTP Authorization header).
241 * @return url string needs to be freed by the caller.
243 char *oauth_serialize_url_sep (int argc, int start, char **argv, char *sep, int mod);
246 * build a query parameter string from an array.
248 * This function is a shortcut for \ref oauth_serialize_url (argc, 1, argv).
249 * It strips the leading host/path, which is usually the first
250 * element when using oauth_split_url_parameters on an URL.
252 * @param argc the total number of elements in the array
253 * @param argv parameter-array to concatenate.
254 * @return url string needs to be freed by the caller.
256 char *oauth_serialize_url_parameters (int argc, char **argv);
259 * generate a random string between 15 and 32 chars length
260 * and return a pointer to it. The value needs to be freed by the
263 * @return zero terminated random string.
265 char *oauth_gen_nonce();
268 * string compare function for oauth parameters.
270 * used with qsort. needed to normalize request parameters.
271 * see http://oauth.net/core/1.0/#anchor14
273 int oauth_cmpstringp(const void *p1, const void *p2);
277 * search array for parameter key.
278 * @param argv length of array to search
279 * @param argc parameter array to search
280 * @param key key of parameter to check.
282 * @return FALSE (0) if array does not contain a parameter with given key, TRUE (1) otherwise.
284 int oauth_param_exists(char **argv, int argc, char *key);
287 * add query parameter to array
289 * @param argcp pointer to array length int
290 * @param argvp pointer to array values
291 * @param addparam parameter to add (eg. "foo=bar")
293 void oauth_add_param_to_array(int *argcp, char ***argvp, const char *addparam);
298 * @param argcp pointer to array length int
299 * @param argvp pointer to array values to be xfree()d
301 void oauth_free_array(int *argcp, char ***argvp);
304 * compare two strings in constant-time (as to not let an
305 * attacker guess how many leading chars are correct:
306 * http://rdist.root.org/2010/01/07/timing-independent-array-comparison/ )
308 * @param a string to compare
309 * @param b string to compare
310 * @param len_a length of string a
311 * @param len_b length of string b
313 * returns 0 (false) if strings are not equal, and 1 (true) if strings are equal.
315 int oauth_time_independent_equals_n(const char* a, const char* b, size_t len_a, size_t len_b);
318 * @deprecated Use oauth_time_independent_equals_n() instead.
320 int oauth_time_indepenent_equals_n(const char* a, const char* b, size_t len_a, size_t len_b) attribute_deprecated;
323 * compare two strings in constant-time.
324 * wrapper to \ref oauth_time_independent_equals_n
325 * which calls strlen() for each argument.
327 * @param a string to compare
328 * @param b string to compare
330 * returns 0 (false) if strings are not equal, and 1 (true) if strings are equal.
332 int oauth_time_independent_equals(const char* a, const char* b);
335 * @deprecated Use oauth_time_independent_equals() instead.
337 int oauth_time_indepenent_equals(const char* a, const char* b) attribute_deprecated;
340 * calculate OAuth-signature for a given HTTP request URL, parameters and oauth-tokens.
342 * if 'postargs' is NULL a "GET" request is signed and the
343 * signed URL is returned. Else this fn will modify 'postargs'
344 * to point to memory that contains the signed POST-variables
345 * and returns the base URL.
347 * both, the return value and (if given) 'postargs' need to be freed
350 * @param url The request URL to be signed. append all GET or POST
351 * query-parameters separated by either '?' or '&' to this parameter.
353 * @param postargs This parameter points to an area where the return value
354 * is stored. If 'postargs' is NULL, no value is stored.
356 * @param method specify the signature method to use. It is of type
357 * \ref OAuthMethod and most likely \ref OA_HMAC.
359 * @param http_method The HTTP request method to use (ie "GET", "PUT",..)
360 * If NULL is given as 'http_method' this defaults to "GET" when
361 * 'postargs' is also NULL and when postargs is not NULL "POST" is used.
363 * @param c_key consumer key
364 * @param c_secret consumer secret
365 * @param t_key token key
366 * @param t_secret token secret
368 * @return the signed url or NULL if an error occurred.
371 char *oauth_sign_url2 (const char *url, char **postargs,
373 const char *http_method, //< HTTP request method
374 const char *c_key, //< consumer key - posted plain text
375 const char *c_secret, //< consumer secret - used as 1st part of secret-key
376 const char *t_key, //< token key - posted plain text in URL
377 const char *t_secret //< token secret - used as 2st part of secret-key
381 * @deprecated Use oauth_sign_url2() instead.
383 char *oauth_sign_url (const char *url, char **postargs,
385 const char *c_key, //< consumer key - posted plain text
386 const char *c_secret, //< consumer secret - used as 1st part of secret-key
387 const char *t_key, //< token key - posted plain text in URL
388 const char *t_secret //< token secret - used as 2st part of secret-key
389 ) attribute_deprecated;
393 * the back-end behind by /ref oauth_sign_array2.
394 * however it does not serialize the signed URL again.
395 * The user needs to call /ref oauth_serialize_url (oA)
396 * and /ref oauth_free_array to do so.
398 * This allows one to split parts of the URL to be used for
399 * OAuth HTTP Authorization header:
400 * see http://oauth.net/core/1.0a/#consumer_req_param
401 * the oauthtest2 example code does so.
404 * @param argcp pointer to array length int
405 * @param argvp pointer to array values
406 * (argv[0]="http://example.org:80/" argv[1]="first=QueryParamater" ..
407 * the array is modified: fi. oauth_ parameters are added)
408 * These arrays can be generated with /ref oauth_split_url_parameters
409 * or /ref oauth_split_post_paramters.
411 * @param postargs This parameter points to an area where the return value
412 * is stored. If 'postargs' is NULL, no value is stored.
414 * @param method specify the signature method to use. It is of type
415 * \ref OAuthMethod and most likely \ref OA_HMAC.
417 * @param http_method The HTTP request method to use (ie "GET", "PUT",..)
418 * If NULL is given as 'http_method' this defaults to "GET" when
419 * 'postargs' is also NULL and when postargs is not NULL "POST" is used.
421 * @param c_key consumer key
422 * @param c_secret consumer secret
423 * @param t_key token key
424 * @param t_secret token secret
429 void oauth_sign_array2_process (int *argcp, char***argvp,
432 const char *http_method, //< HTTP request method
433 const char *c_key, //< consumer key - posted plain text
434 const char *c_secret, //< consumer secret - used as 1st part of secret-key
435 const char *t_key, //< token key - posted plain text in URL
436 const char *t_secret //< token secret - used as 2st part of secret-key
440 * same as /ref oauth_sign_url
441 * with the url already split into parameter array
443 * @param argcp pointer to array length int
444 * @param argvp pointer to array values
445 * (argv[0]="http://example.org:80/" argv[1]="first=QueryParamater" ..
446 * the array is modified: fi. oauth_ parameters are added)
447 * These arrays can be generated with /ref oauth_split_url_parameters
448 * or /ref oauth_split_post_paramters.
450 * @param postargs This parameter points to an area where the return value
451 * is stored. If 'postargs' is NULL, no value is stored.
453 * @param method specify the signature method to use. It is of type
454 * \ref OAuthMethod and most likely \ref OA_HMAC.
456 * @param http_method The HTTP request method to use (ie "GET", "PUT",..)
457 * If NULL is given as 'http_method' this defaults to "GET" when
458 * 'postargs' is also NULL and when postargs is not NULL "POST" is used.
460 * @param c_key consumer key
461 * @param c_secret consumer secret
462 * @param t_key token key
463 * @param t_secret token secret
465 * @return the signed url or NULL if an error occurred.
467 char *oauth_sign_array2 (int *argcp, char***argvp,
470 const char *http_method, //< HTTP request method
471 const char *c_key, //< consumer key - posted plain text
472 const char *c_secret, //< consumer secret - used as 1st part of secret-key
473 const char *t_key, //< token key - posted plain text in URL
474 const char *t_secret //< token secret - used as 2st part of secret-key
478 * @deprecated Use oauth_sign_array2() instead.
480 char *oauth_sign_array (int *argcp, char***argvp,
483 const char *c_key, //< consumer key - posted plain text
484 const char *c_secret, //< consumer secret - used as 1st part of secret-key
485 const char *t_key, //< token key - posted plain text in URL
486 const char *t_secret //< token secret - used as 2st part of secret-key
487 ) attribute_deprecated;
491 * calculate body hash (sha1sum) of given file and return
492 * a oauth_body_hash=xxxx parameter to be added to the request.
493 * The returned string needs to be freed by the calling function.
496 * http://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html
498 * @param filename the filename to calculate the hash for
500 * @return URL oauth_body_hash parameter string
502 char *oauth_body_hash_file(char *filename);
505 * calculate body hash (sha1sum) of given data and return
506 * a oauth_body_hash=xxxx parameter to be added to the request.
507 * The returned string needs to be freed by the calling function.
508 * The returned string is not yet url-escaped and suitable to be
509 * passed as argument to \ref oauth_catenc.
512 * http://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html
514 * @param length length of the data parameter in bytes
515 * @param data to calculate the hash for
517 * @return URL oauth_body_hash parameter string
519 char *oauth_body_hash_data(size_t length, const char *data);
522 * base64 encode digest, free it and return a URL parameter
523 * with the oauth_body_hash. The returned hash needs to be freed by the
524 * calling function. The returned string is not yet url-escaped and
525 * thus suitable to be passed to \ref oauth_catenc.
527 * @param len length of the digest to encode
528 * @param digest hash value to encode
530 * @return URL oauth_body_hash parameter string
532 char *oauth_body_hash_encode(size_t len, unsigned char *digest);
537 char *oauth_sign_xmpp (const char *xml,
539 const char *c_secret, //< consumer secret - used as 1st part of secret-key
540 const char *t_secret //< token secret - used as 2st part of secret-key
544 * do a HTTP GET request, wait for it to finish
545 * and return the content of the reply.
546 * (requires libcurl or a command-line HTTP client)
548 * If compiled <b>without</b> libcurl this function calls
549 * a command-line executable defined in the environment variable
550 * OAUTH_HTTP_GET_CMD - it defaults to
551 * <tt>curl -sA 'liboauth-agent/0.1' '%%u'</tt>
552 * where %%u is replaced with the URL and query parameters.
554 * bash & wget example:
555 * <tt>export OAUTH_HTTP_CMD="wget -q -U 'liboauth-agent/0.1' '%u' "</tt>
557 * WARNING: this is a tentative function. it's convenient and handy for testing
558 * or developing OAuth code. But don't rely on this function
559 * to become a stable part of this API. It does not do
560 * much error checking or handling for one thing..
562 * NOTE: \a u and \a q are just concatenated with a '?' in between,
563 * unless \a q is NULL. in which case only \a u will be used.
565 * @param u base url to get
566 * @param q query string to send along with the HTTP request or NULL.
567 * @return In case of an error NULL is returned; otherwise a pointer to the
568 * replied content from HTTP server. latter needs to be freed by caller.
570 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
572 char *oauth_http_get (const char *u, const char *q) attribute_deprecated;
575 * do a HTTP GET request, wait for it to finish
576 * and return the content of the reply.
580 * This is equivalent to /ref oauth_http_get but allows one
581 * to specifiy a custom HTTP header andhas no support for commandline-curl.
583 * If liboauth is compiled <b>without</b> libcurl this function
584 * always returns NULL.
586 * @param u base url to get
587 * @param q query string to send along with the HTTP request or NULL.
588 * @param customheader specify custom HTTP header (or NULL for none)
589 * Multiple header elements can be passed separating them with "\r\n"
590 * @return In case of an error NULL is returned; otherwise a pointer to the
591 * replied content from HTTP server. latter needs to be freed by caller.
593 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
595 char *oauth_http_get2 (const char *u, const char *q, const char *customheader) attribute_deprecated;
599 * do a HTTP POST request, wait for it to finish
600 * and return the content of the reply.
601 * (requires libcurl or a command-line HTTP client)
603 * If compiled <b>without</b> libcurl this function calls
604 * a command-line executable defined in the environment variable
605 * OAUTH_HTTP_CMD - it defaults to
606 * <tt>curl -sA 'liboauth-agent/0.1' -d '%%p' '%%u'</tt>
607 * where %%p is replaced with the postargs and %%u is replaced with
610 * bash & wget example:
611 * <tt>export OAUTH_HTTP_CMD="wget -q -U 'liboauth-agent/0.1' --post-data='%p' '%u' "</tt>
613 * NOTE: This function uses the curl's default HTTP-POST Content-Type:
614 * application/x-www-form-urlencoded which is the only option allowed
615 * by oauth core 1.0 spec. Experimental code can use the Environment variable
616 * to transmit custom HTTP headers or parameters.
618 * WARNING: this is a tentative function. it's convenient and handy for testing
619 * or developing OAuth code. But don't rely on this function
620 * to become a stable part of this API. It does not do
621 * much error checking for one thing..
623 * @param u url to query
624 * @param p postargs to send along with the HTTP request.
625 * @return replied content from HTTP server. needs to be freed by caller.
627 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
629 char *oauth_http_post (const char *u, const char *p) attribute_deprecated;
632 * do a HTTP POST request, wait for it to finish
633 * and return the content of the reply.
636 * It's equivalent to /ref oauth_http_post, but offers
637 * the possibility to specify a custom HTTP header and
638 * has no support for commandline-curl.
640 * If liboauth is compiled <b>without</b> libcurl this function
641 * always returns NULL.
643 * @param u url to query
644 * @param p postargs to send along with the HTTP request.
645 * @param customheader specify custom HTTP header (or NULL for none)
646 * Multiple header elements can be passed separating them with "\r\n"
647 * @return replied content from HTTP server. needs to be freed by caller.
649 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
651 char *oauth_http_post2 (const char *u, const char *p, const char *customheader) attribute_deprecated;
655 * http post raw data from file.
656 * the returned string needs to be freed by the caller
659 * see dislaimer: /ref oauth_http_post
661 * @param u url to retrieve
662 * @param fn filename of the file to post along
663 * @param len length of the file in bytes. set to '0' for autodetection
664 * @param customheader specify custom HTTP header (or NULL for default).
665 * Multiple header elements can be passed separating them with "\r\n"
666 * @return returned HTTP reply or NULL on error
668 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
670 char *oauth_post_file (const char *u, const char *fn, const size_t len, const char *customheader) attribute_deprecated;
674 * the returned string needs to be freed by the caller
677 * see dislaimer: /ref oauth_http_post
679 * @param u url to retrieve
680 * @param data data to post
681 * @param len length of the data in bytes.
682 * @param customheader specify custom HTTP header (or NULL for default)
683 * Multiple header elements can be passed separating them with "\r\n"
684 * @return returned HTTP reply or NULL on error
686 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
688 char *oauth_post_data (const char *u, const char *data, size_t len, const char *customheader) attribute_deprecated;
691 * http post raw data, with callback.
692 * the returned string needs to be freed by the caller
695 * Invokes the callback - in no particular order - when HTTP-request status updates occur.
696 * The callback is called with:
697 * void * callback_data: supplied on function call.
698 * int type: 0=data received, 1=data sent.
699 * size_t size: amount of data received or amount of data sent so far
700 * size_t totalsize: original amount of data to send, or amount of data received
702 * @param u url to retrieve
703 * @param data data to post along
704 * @param len length of the file in bytes. set to '0' for autodetection
705 * @param customheader specify custom HTTP header (or NULL for default)
706 * Multiple header elements can be passed separating them with "\r\n"
707 * @param callback specify the callback function
708 * @param callback_data specify data to pass to the callback function
709 * @return returned HTTP reply or NULL on error
711 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
713 char *oauth_post_data_with_callback (const char *u,
716 const char *customheader,
717 void (*callback)(void*,int,size_t,size_t),
718 void *callback_data) attribute_deprecated;
721 * http send raw data. similar to /ref oauth_http_post but provides
722 * for specifying the HTTP request method.
724 * the returned string needs to be freed by the caller
727 * see dislaimer: /ref oauth_http_post
729 * @param u url to retrieve
730 * @param data data to post
731 * @param len length of the data in bytes.
732 * @param customheader specify custom HTTP header (or NULL for default)
733 * Multiple header elements can be passed separating them with "\r\n"
734 * @param httpMethod specify http verb ("GET"/"POST"/"PUT"/"DELETE") to be used. if httpMethod is NULL, a POST is executed.
735 * @return returned HTTP reply or NULL on error
737 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
739 char *oauth_send_data (const char *u,
742 const char *customheader,
743 const char *httpMethod) attribute_deprecated;
746 * http post raw data, with callback.
747 * the returned string needs to be freed by the caller
750 * Invokes the callback - in no particular order - when HTTP-request status updates occur.
751 * The callback is called with:
752 * void * callback_data: supplied on function call.
753 * int type: 0=data received, 1=data sent.
754 * size_t size: amount of data received or amount of data sent so far
755 * size_t totalsize: original amount of data to send, or amount of data received
757 * @param u url to retrieve
758 * @param data data to post along
759 * @param len length of the file in bytes. set to '0' for autodetection
760 * @param customheader specify custom HTTP header (or NULL for default)
761 * Multiple header elements can be passed separating them with "\r\n"
762 * @param callback specify the callback function
763 * @param callback_data specify data to pass to the callback function
764 * @param httpMethod specify http verb ("GET"/"POST"/"PUT"/"DELETE") to be used.
765 * @return returned HTTP reply or NULL on error
767 * @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
769 char *oauth_send_data_with_callback (const char *u,
772 const char *customheader,
773 void (*callback)(void*,int,size_t,size_t),
775 const char *httpMethod) attribute_deprecated;
779 #endif /* __cplusplus */
782 /* vi:set ts=8 sts=2 sw=2: */