4 /***************************************************************************
6 * Project ___| | | | _ \| |
8 * | (__| |_| | _ <| |___
9 * \___|\___/|_| \_\_____|
11 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
13 * This software is licensed as described in the file COPYING, which
14 * you should have received as part of this distribution. The terms
15 * are also available at http://curl.haxx.se/docs/copyright.html.
17 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
18 * copies of the Software, and permit persons to whom the Software is
19 * furnished to do so, under the terms of the COPYING file.
21 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 * KIND, either express or implied.
24 * $Id: formdata.h,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
25 ***************************************************************************/
28 FORM_DATA
, /* form metadata (convert to network encoding if necessary) */
29 FORM_CONTENT
, /* form content (never convert) */
30 FORM_CALLBACK
, /* 'line' points to the custom pointer we pass to the callback
32 FORM_FILE
/* 'line' points to a file name we should read from
33 to create the form data (never convert) */
36 /* plain and simple linked list with lines to send */
38 struct FormData
*next
;
45 struct FormData
*data
; /* current form line to send */
46 size_t sent
; /* number of bytes of the current line that has
47 already been sent in a previous invoke */
48 FILE *fp
; /* file to read from */
49 curl_read_callback fread_func
; /* fread callback pointer */
52 /* used by FormAdd for temporary storage */
53 typedef struct FormInfo
{
59 size_t contentslength
;
61 bool contenttype_alloc
;
63 char *buffer
; /* pointer to existing buffer used for file upload */
65 char *showfilename
; /* The file name to show. If not set, the actual
66 file name will be used */
67 bool showfilename_alloc
;
68 char *userp
; /* pointer for the read callback */
69 struct curl_slist
* contentheader
;
70 struct FormInfo
*more
;
73 int Curl_FormInit(struct Form
*form
, struct FormData
*formdata
);
76 Curl_getFormData(struct FormData
**,
77 struct curl_httppost
*post
,
78 const char *custom_contenttype
,
81 /* fread() emulation */
82 size_t Curl_FormReader(char *buffer
,
88 * Curl_formpostheader() returns the first line of the formpost, the
89 * request-header part (which is not part of the request-body like the rest of
92 char *Curl_formpostheader(void *formp
, size_t *len
);
94 char *Curl_FormBoundary(void);
96 void Curl_formclean(struct FormData
**);
98 CURLcode
Curl_formconvert(struct SessionHandle
*, struct FormData
*);