#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_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 FormInfo * | AddFormInfo (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 _MPRINTF_REPLACE |
Definition at line 124 of file formdata.c.
| #define BOUNDARY_LENGTH 40 |
| #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" |
| static CURLcode AddFormData | ( | struct FormData ** | formp, | |
| enum formtype | type, | |||
| const void * | line, | |||
| size_t | length, | |||
| curl_off_t * | size | |||
| ) | [static] |
Definition at line 814 of file formdata.c.
References CURLE_OK, CURLE_OUT_OF_MEMORY, FORM_CONTENT, FORM_DATA, free, FormData::length, FormData::line, malloc, FormData::next, NULL, stat(), strequal, struct_stat, and FormData::type.
Referenced by AddFormDataf(), and Curl_getFormData().
| 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] |
Definition at line 159 of file formdata.c.
References curl_httppost::buffer, curl_httppost::bufferlength, calloc, curl_httppost::contentheader, curl_httppost::contents, curl_httppost::contentslength, curl_httppost::contenttype, curl_httppost::flags, curl_httppost::more, curl_httppost::name, curl_httppost::namelength, curl_httppost::next, NULL, and curl_httppost::showfilename.
Referenced by FormAdd().
| static char* basename | ( | char * | path | ) | [static] |
| 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, | |||
| ... | ||||
| ) |
| 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 | ) |
Definition at line 982 of file formdata.c.
References curl_httppost::contents, curl_httppost::contenttype, curl_formfree(), curl_httppost::flags, free, HTTPPOST_PTRCONTENTS, HTTPPOST_PTRNAME, curl_httppost::more, curl_httppost::name, curl_httppost::next, NULL, and curl_httppost::showfilename.
Referenced by curl_formfree().
| int curl_formget | ( | struct curl_httppost * | form, | |
| void * | arg, | |||
| curl_formget_callback | append | |||
| ) |
Definition at line 938 of file formdata.c.
References asio::buffer(), Curl_formclean(), Curl_FormInit(), Curl_getFormData(), CURLE_OK, FORM_FILE, Form::fp, FormData::length, FormData::line, FormData::next, NULL, asio::read(), readfromfile(), and FormData::type.
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 | |||
| ) |
Definition at line 1407 of file formdata.c.
References Form::data, FORM_FILE, FormData::length, FormData::line, FormData::next, readfromfile(), Form::sent, and FormData::type.
Referenced by Curl_http().
| CURLcode Curl_getFormData | ( | struct FormData ** | finalform, | |
| struct curl_httppost * | post, | |||
| const char * | custom_content_type, | |||
| curl_off_t * | sizep | |||
| ) |
Definition at line 1081 of file formdata.c.
References AddFormData(), AddFormDataf(), curl_httppost::buffer, asio::buffer(), curl_httppost::bufferlength, checkprefix, curl_httppost::contentheader, curl_httppost::contents, curl_httppost::contentslength, curl_httppost::contenttype, Curl_FormBoundary(), Curl_formclean(), CURLE_OK, CURLE_OUT_OF_MEMORY, CURLE_READ_ERROR, curl_slist::data, curl_httppost::flags, FORM_CONTENT, FORM_DATA, FORM_FILE, fread(), free, HTTPPOST_BUFFER, HTTPPOST_FILENAME, HTTPPOST_READFILE, curl_httppost::more, curl_httppost::name, curl_httppost::namelength, curl_httppost::next, curl_slist::next, NULL, curl_httppost::showfilename, strequal, and strippath().
Referenced by curl_formget(), and Curl_http().
| static CURLFORMcode FormAdd | ( | struct curl_httppost ** | httppost, | |
| struct curl_httppost ** | last_post, | |||
| va_list | params | |||
| ) | [static] |
Definition at line 391 of file formdata.c.
References AddFormInfo(), AddHttpPost(), asio::buffer(), FormInfo::buffer, FormInfo::bufferlength, calloc, FormInfo::contentheader, FormInfo::contentslength, FormInfo::contenttype, FormInfo::contenttype_alloc, ContentTypeForFilename(), CURL_FORMADD_ILLEGAL_ARRAY, CURL_FORMADD_INCOMPLETE, CURL_FORMADD_MEMORY, CURL_FORMADD_NULL, CURL_FORMADD_OK, CURL_FORMADD_OPTION_TWICE, CURL_FORMADD_UNKNOWN_OPTION, FALSE, FormInfo::flags, free, HTTPPOST_BUFFER, HTTPPOST_FILENAME, HTTPPOST_PTRBUFFER, HTTPPOST_PTRCONTENTS, HTTPPOST_PTRNAME, HTTPPOST_READFILE, if(), memdup(), FormInfo::more, FormInfo::name, FormInfo::name_alloc, FormInfo::namelength, NULL, curl_forms::option, FormInfo::showfilename, FormInfo::showfilename_alloc, strdup, TRUE, FormInfo::value, curl_forms::value, and FormInfo::value_alloc.
Referenced by curl_formadd().
| 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().
1.5.6