~ubuntu-branches/ubuntu/warty/curl/warty-security

« back to all changes in this revision

Viewing changes to docs/examples/postit2.c

  • Committer: Bazaar Package Importer
  • Author(s): Domenico Andreoli
  • Date: 2004-06-04 19:09:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040604190925-wy048bp31320r2z6
Tags: 7.12.0.is.7.11.2-1
* Reverted to version 7.11.2 (closes: #252348).
* Disabled support for libidn (closes: #252367). This is to leave
  curl in unstable as much similar as possible to the one in testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___ 
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * $Id: postit2.c,v 1.1 2001/08/23 08:45:20 bagder Exp $
 
8
 * $Id: postit2.c,v 1.3 2004/03/28 21:41:10 bagder Exp $
9
9
 *
10
10
 * Example code that uploads a file name 'foo' to a remote script that accepts
11
11
 * "HTML form based" (as described in RFC1738) uploads using HTTP POST.
21
21
 * This exact source code has not been verified to work.
22
22
 */
23
23
 
24
 
/* to make this work under windows, use the win32-functions from the
25
 
   win32socket.c file as well */
26
 
 
27
24
#include <stdio.h>
28
25
#include <string.h>
29
26
 
31
28
#include <curl/types.h>
32
29
#include <curl/easy.h>
33
30
 
34
 
#if LIBCURL_VERSION_NUM < 0x070900
35
 
#error "curl_formadd() is not introduced until libcurl 7.9 and later"
36
 
#endif
37
 
 
38
31
int main(int argc, char *argv[])
39
32
{
40
33
  CURL *curl;
41
34
  CURLcode res;
42
35
 
43
 
  struct HttpPost *formpost=NULL;
44
 
  struct HttpPost *lastptr=NULL;
 
36
  struct curl_httppost *formpost=NULL;
 
37
  struct curl_httppost *lastptr=NULL;
45
38
  struct curl_slist *headerlist=NULL;
46
39
  char buf[] = "Expect:";
47
40
 
 
41
  curl_global_init(CURL_GLOBAL_ALL);
 
42
 
48
43
  /* Fill in the file upload field */
49
44
  curl_formadd(&formpost,
50
45
               &lastptr,