Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / docs / examples / httpcustomheader.c
bloba8a2c0b24bd1584629f5c52097fb033082954de1
1 /*****************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: httpcustomheader.c,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
9 */
11 #include <stdio.h>
12 #include <curl/curl.h>
14 int main(void)
16 CURL *curl;
17 CURLcode res;
19 curl = curl_easy_init();
20 if(curl) {
21 struct curl_slist *chunk = NULL;
23 chunk = curl_slist_append(chunk, "Accept: moo");
25 /* request with the built-in Accept: */
26 curl_easy_setopt(curl, CURLOPT_URL, "localhost");
27 curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
28 res = curl_easy_perform(curl);
30 /* redo request with our own custom Accept: */
31 res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
32 res = curl_easy_perform(curl);
34 /* always cleanup */
35 curl_easy_cleanup(curl);
37 return 0;