D:/opendownloadmanager/ODM-1.x/InetFile/cURL_lib/formdata.c File Reference

#include "setup.h"
#include <curl/curl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>
#include "urldata.h"
#include "easyif.h"
#include "formdata.h"
#include "strequal.h"
#include "memory.h"
#include <curl/mprintf.h>
#include "memdebug.h"

Go to the source code of this file.

Defines

#define BOUNDARY_LENGTH   40
#define _MPRINTF_REPLACE
#define HTTPPOST_CONTENTTYPE_DEFAULT   "application/octet-stream"
#define FORM_FILE_SEPARATOR   ','
#define FORM_TYPE_SEPARATOR   ';'

Functions

static size_t readfromfile (struct Form *form, char *buffer, size_t size)
static struct curl_httppostAddHttpPost (char *name, size_t namelength, char *value, size_t contentslength, char *buffer, size_t bufferlength, char *contenttype, long flags, struct curl_slist *contentHeader, char *showfilename, struct curl_httppost *parent_post, struct curl_httppost **httppost, struct curl_httppost **last_post)
static FormInfoAddFormInfo (char *value, char *contenttype, FormInfo *parent_form_info)
static const char * ContentTypeForFilename (const char *filename, const char *prevtype)
static char * memdup (const char *src, size_t buffer_length)
static CURLFORMcode FormAdd (struct curl_httppost **httppost, struct curl_httppost **last_post, va_list params)
CURLFORMcode curl_formadd (struct curl_httppost **httppost, struct curl_httppost **last_post,...)
static CURLcode AddFormData (struct FormData **formp, enum formtype type, const void *line, size_t length, curl_off_t *size)
static CURLcode AddFormDataf (struct FormData **formp, curl_off_t *size, const char *fmt,...)
void Curl_formclean (struct FormData **form_ptr)
int curl_formget (struct curl_httppost *form, void *arg, curl_formget_callback append)
void curl_formfree (struct curl_httppost *form)
static char * basename (char *path)
static char * strippath (char *fullfile)
CURLcode Curl_getFormData (struct FormData **finalform, struct curl_httppost *post, const char *custom_content_type, curl_off_t *sizep)
int Curl_FormInit (struct Form *form, struct FormData *formdata)
size_t Curl_FormReader (char *buffer, size_t size, size_t nitems, FILE *mydata)
char * Curl_formpostheader (void *formp, size_t *len)
char * Curl_FormBoundary (void)


Define Documentation

#define _MPRINTF_REPLACE

Definition at line 124 of file formdata.c.

#define BOUNDARY_LENGTH   40

Definition at line 106 of file formdata.c.

Referenced by Curl_FormBoundary().

#define FORM_FILE_SEPARATOR   ','

Definition at line 145 of file formdata.c.

#define FORM_TYPE_SEPARATOR   ';'

Definition at line 146 of file formdata.c.

#define HTTPPOST_CONTENTTYPE_DEFAULT   "application/octet-stream"

Definition at line 143 of file formdata.c.

Referenced by ContentTypeForFilename().


Function Documentation

static CURLcode AddFormData ( struct FormData **  formp,
enum formtype  type,
const void *  line,
size_t  length,
curl_off_t size 
) [static]

static CURLcode AddFormDataf ( struct FormData **  formp,
curl_off_t size,
const char *  fmt,
  ... 
) [static]

Definition at line 868 of file formdata.c.

References AddFormData(), FORM_DATA, and simple_client::s.

Referenced by Curl_getFormData().

static FormInfo* AddFormInfo ( char *  value,
char *  contenttype,
FormInfo parent_form_info 
) [static]

Definition at line 216 of file formdata.c.

References FormInfo::contenttype, FormInfo::flags, HTTPPOST_FILENAME, malloc, FormInfo::more, NULL, and FormInfo::value.

Referenced by FormAdd().

static struct curl_httppost* AddHttpPost ( char *  name,
size_t  namelength,
char *  value,
size_t  contentslength,
char *  buffer,
size_t  bufferlength,
char *  contenttype,
long  flags,
struct curl_slist contentHeader,
char *  showfilename,
struct curl_httppost parent_post,
struct curl_httppost **  httppost,
struct curl_httppost **  last_post 
) [static, read]

static char* basename ( char *  path  )  [static]

Definition at line 1035 of file formdata.c.

Referenced by strippath().

static const char* ContentTypeForFilename ( const char *  filename,
const char *  prevtype 
) [static]

Definition at line 256 of file formdata.c.

References curl_httppost::contenttype, HTTPPOST_CONTENTTYPE_DEFAULT, NULL, and strequal.

Referenced by FormAdd().

CURLFORMcode curl_formadd ( struct curl_httppost **  httppost,
struct curl_httppost **  last_post,
  ... 
)

Definition at line 797 of file formdata.c.

References FormAdd().

char* Curl_FormBoundary ( void   ) 

Definition at line 1669 of file formdata.c.

References BOUNDARY_LENGTH, malloc, and NULL.

Referenced by Curl_getFormData().

void Curl_formclean ( struct FormData **  form_ptr  ) 

Definition at line 885 of file formdata.c.

References free, FormData::line, FormData::next, and NULL.

Referenced by curl_formget(), Curl_getFormData(), Curl_http(), and Curl_http_done().

void curl_formfree ( struct curl_httppost form  ) 

int curl_formget ( struct curl_httppost form,
void *  arg,
curl_formget_callback  append 
)

int Curl_FormInit ( struct Form form,
struct FormData formdata 
)

Definition at line 1370 of file formdata.c.

References Form::data, Form::fp, NULL, and Form::sent.

Referenced by curl_formget(), and Curl_http().

char* Curl_formpostheader ( void *  formp,
size_t *  len 
)

Definition at line 1464 of file formdata.c.

References Form::data, FormData::length, FormData::line, and FormData::next.

Referenced by Curl_http().

size_t Curl_FormReader ( char *  buffer,
size_t  size,
size_t  nitems,
FILE *  mydata 
)

CURLcode Curl_getFormData ( struct FormData **  finalform,
struct curl_httppost post,
const char *  custom_content_type,
curl_off_t sizep 
)

static CURLFORMcode FormAdd ( struct curl_httppost **  httppost,
struct curl_httppost **  last_post,
va_list  params 
) [static]

static char* memdup ( const char *  src,
size_t  buffer_length 
) [static]

Definition at line 312 of file formdata.c.

References asio::buffer(), FALSE, malloc, NULL, strdup, and TRUE.

Referenced by FormAdd().

static size_t readfromfile ( struct Form form,
char *  buffer,
size_t  size 
) [static]

Definition at line 1382 of file formdata.c.

References Form::data, Form::fp, fread(), FormData::line, FormData::next, and NULL.

Referenced by curl_formget(), and Curl_FormReader().

static char* strippath ( char *  fullfile  )  [static]

Definition at line 1057 of file formdata.c.

References basename(), free, NULL, and strdup.

Referenced by Curl_getFormData().


Generated on Sun May 25 00:20:05 2008 by  doxygen 1.5.6