lib515.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*****************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * $Id$
  9. */
  10. #include "test.h"
  11. int test(char *URL)
  12. {
  13. CURL *curl;
  14. CURLcode res=CURLE_OK;
  15. if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
  16. fprintf(stderr, "curl_global_init() failed\n");
  17. return TEST_ERR_MAJOR_BAD;
  18. }
  19. if ((curl = curl_easy_init()) == NULL) {
  20. fprintf(stderr, "curl_easy_init() failed\n");
  21. curl_global_cleanup();
  22. return TEST_ERR_MAJOR_BAD;
  23. }
  24. /* First set the URL that is about to receive our POST. */
  25. curl_easy_setopt(curl, CURLOPT_URL, URL);
  26. curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL);
  27. curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0L);
  28. curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */
  29. curl_easy_setopt(curl, CURLOPT_HEADER, 1L); /* include header */
  30. /* Now, we should be making a zero byte POST request */
  31. res = curl_easy_perform(curl);
  32. /* always cleanup */
  33. curl_easy_cleanup(curl);
  34. curl_global_cleanup();
  35. return (int)res;
  36. }