1 /*****************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: lib544.c,v 1.1.1.1 2008-09-23 16:32:06 hoffman Exp $
14 static char teststring
[] =
15 "This\0 is test binary data with an embedded NUL byte\n";
21 CURLcode res
=CURLE_OK
;
23 if (curl_global_init(CURL_GLOBAL_ALL
) != CURLE_OK
) {
24 fprintf(stderr
, "curl_global_init() failed\n");
25 return TEST_ERR_MAJOR_BAD
;
28 if ((curl
= curl_easy_init()) == NULL
) {
29 fprintf(stderr
, "curl_easy_init() failed\n");
30 curl_global_cleanup();
31 return TEST_ERR_MAJOR_BAD
;
34 /* First set the URL that is about to receive our POST. */
35 curl_easy_setopt(curl
, CURLOPT_URL
, URL
);
38 curl_easy_setopt(curl
, CURLOPT_POSTFIELDSIZE
, (long) sizeof teststring
- 1);
41 curl_easy_setopt(curl
, CURLOPT_COPYPOSTFIELDS
, teststring
);
43 curl_easy_setopt(curl
, CURLOPT_VERBOSE
, 1L); /* show verbose for debug */
44 curl_easy_setopt(curl
, CURLOPT_HEADER
, 1L); /* include header */
46 /* Update the original data to detect non-copy. */
47 strcpy(teststring
, "FAIL");
49 /* Now, this is a POST request with binary 0 embedded in POST data. */
50 res
= curl_easy_perform(curl
);
53 curl_easy_cleanup(curl
);
54 curl_global_cleanup();