1 /*****************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: lib553.c,v 1.1.1.1 2008-09-23 16:32:06 hoffman Exp $
10 * This test case and code is based on the bug recipe Joe Malicki provided for
11 * bug report #1871269, fixed on Jan 14 2008 before the 7.18.0 release.
18 static size_t myreadfunc(void *ptr
, size_t size
, size_t nmemb
, void *stream
)
20 static size_t total
=POSTLEN
;
21 static char buf
[1024];
24 memset(buf
, 'A', sizeof(buf
));
30 if(size
> sizeof(buf
))
33 memcpy(ptr
, buf
, size
);
39 #define SIZE_HEADERS 5000
41 static char buf
[SIZE_HEADERS
+ 100];
48 struct curl_slist
*headerlist
=NULL
, *hl
;
50 curl_global_init(CURL_GLOBAL_ALL
);
51 curl
= curl_easy_init();
54 for (i
= 0; i
< NUM_HEADERS
; i
++) {
55 int len
= sprintf(buf
, "Header%d: ", i
);
56 memset(&buf
[len
], 'A', SIZE_HEADERS
);
57 buf
[len
+ SIZE_HEADERS
]=0; /* zero terminate */
58 hl
= curl_slist_append(headerlist
, buf
);
63 hl
= curl_slist_append(headerlist
, "Expect: ");
68 curl_easy_setopt(curl
, CURLOPT_URL
, URL
);
69 curl_easy_setopt(curl
, CURLOPT_HTTPHEADER
, headerlist
);
70 curl_easy_setopt(curl
, CURLOPT_POST
, 1L);
71 curl_easy_setopt(curl
, CURLOPT_POSTFIELDSIZE
, (long)POSTLEN
);
72 curl_easy_setopt(curl
, CURLOPT_VERBOSE
, 1L);
73 curl_easy_setopt(curl
, CURLOPT_HEADER
, 1L);
74 curl_easy_setopt(curl
, CURLOPT_READFUNCTION
, myreadfunc
);
75 res
= curl_easy_perform(curl
);
78 curl_easy_cleanup(curl
);
80 curl_slist_free_all(headerlist
);
82 curl_global_cleanup();