aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib515.c
blob: ce075110dd8c89c1518c38a2b9fdfd893555f51a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "test.h"

int test(char *URL)
{
  CURL *curl;
  CURLcode res=CURLE_OK;

  curl = curl_easy_init();
  if(curl) {
    /* First set the URL that is about to receive our POST. */
    curl_easy_setopt(curl, CURLOPT_URL, URL);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0);
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); /* show verbose for debug */
    curl_easy_setopt(curl, CURLOPT_HEADER, 1); /* include header */

    /* Now, we should be making a zero byte POST request */
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return (int)res;
}