~ubuntu-branches/ubuntu/dapper/curl/dapper-security

« back to all changes in this revision

Viewing changes to tests/libtest/lib513.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-03-23 18:41:29 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050323184129-le70d05a0hk5w62j
Tags: 7.12.3-2ubuntu3
Fix the version numbers internal to debian/rules.  Closes; #8088

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "test.h"
 
2
 
 
3
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
 
4
{
 
5
  (void)ptr;
 
6
  (void)size;
 
7
  (void)nmemb;
 
8
  (void)userp;
 
9
  return CURL_READFUNC_ABORT;
 
10
}
 
11
 
 
12
int test(char *URL)
 
13
{
 
14
  CURL *curl;
 
15
  CURLcode res=CURLE_OK;
 
16
 
 
17
  curl = curl_easy_init();
 
18
  if(curl) {
 
19
    /* First set the URL that is about to receive our POST. */
 
20
    curl_easy_setopt(curl, CURLOPT_URL, URL);
 
21
 
 
22
    /* Now specify we want to POST data */
 
23
    curl_easy_setopt(curl, CURLOPT_POST, TRUE);
 
24
 
 
25
    /* Set the expected POST size */
 
26
    curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 1);
 
27
 
 
28
    /* we want to use our own read function */
 
29
    curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
 
30
 
 
31
    /* pointer to pass to our read function */
 
32
    curl_easy_setopt(curl, CURLOPT_INFILE, NULL);
 
33
 
 
34
    /* get verbose debug output please */
 
35
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
 
36
 
 
37
    /* include headers in the output */
 
38
    curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
 
39
 
 
40
    /* Perform the request, res will get the return code */
 
41
    res = curl_easy_perform(curl);
 
42
 
 
43
    /* always cleanup */
 
44
    curl_easy_cleanup(curl);
 
45
  }
 
46
  return (int)res;
 
47
}