From ae1912cb0d494b48d514d937826c9fe83ec96c4d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 29 Dec 1999 14:20:26 +0000 Subject: Initial revision --- lib/formdata.h | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 lib/formdata.h (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h new file mode 100644 index 000000000..6b08a05b4 --- /dev/null +++ b/lib/formdata.h @@ -0,0 +1,103 @@ +#ifndef __FORMDATA_H +#define __FORMDATA_H + +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Curl. + * + * The Initial Developer of the Original Code is Daniel Stenberg. + * + * Portions created by the Initial Developer are Copyright (C) 1998. + * All Rights Reserved. + * + * Contributor(s): + * Rafael Sagula + * Sampo Kellomaki + * Linas Vepstas + * Bjorn Reese + * Johan Anderson + * Kjell Ericson + * Troy Engel + * Ryan Nelson + * Bjorn Stenberg + * Angus Mackay + * + * ------------------------------------------------------------ + * Main author: + * - Daniel Stenberg + * + * http://curl.haxx.nu + * + * $Source$ + * $Revision$ + * $Date$ + * $Author$ + * $State$ + * $Locker$ + * + * ------------------------------------------------------------ + * $Log$ + * Revision 1.1 1999-12-29 14:21:22 bagder + * Initial revision + * + * Revision 1.4 1999/09/06 06:59:40 dast + * Changed email info + * + * Revision 1.3 1999/08/13 07:34:47 dast + * Changed the URL in the header + * + * Revision 1.2 1999/07/30 12:59:47 dast + * FormFree() was added to properly cleanup after a form was posted. + * + * Revision 1.1.1.1 1999/03/11 22:23:34 dast + * Imported sources + * + ****************************************************************************/ +/* plain and simple linked list with lines to send */ +struct FormData { + struct FormData *next; + char *line; + long length; +}; + +struct Form { + struct FormData *data; /* current form line to send */ + int sent; /* number of bytes of the current line that has already + been sent in a previous invoke */ +}; + +int FormParse(char *string, + struct HttpPost **httppost, + struct HttpPost **last_post); + +int FormInit(struct Form *form, struct FormData *formdata ); + +struct FormData *getFormData(struct HttpPost *post, + int *size); + +/* fread() emulation */ +int FormReader(char *buffer, + size_t size, + size_t nitems, + FILE *mydata); + +char *MakeFormBoundary(void); + +void FormFree(struct FormData *); + +#endif -- cgit v1.2.1 From 26e8ccc63151a1c12db709cef4051803afd21189 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 10 Jan 2000 23:36:14 +0000 Subject: syncing with local edit --- lib/formdata.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 6b08a05b4..9dcde397e 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -52,8 +52,8 @@ * * ------------------------------------------------------------ * $Log$ - * Revision 1.1 1999-12-29 14:21:22 bagder - * Initial revision + * Revision 1.2 2000-01-10 23:36:14 bagder + * syncing with local edit * * Revision 1.4 1999/09/06 06:59:40 dast * Changed email info -- cgit v1.2.1 From 1ef3600a0731fef8f59563a1e49981f1b64b9746 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 20 Jun 2000 15:31:26 +0000 Subject: haxx.nu => haxx.se --- lib/formdata.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 9dcde397e..9c6c61863 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -31,17 +31,17 @@ * Linas Vepstas * Bjorn Reese * Johan Anderson - * Kjell Ericson + * Kjell Ericson * Troy Engel * Ryan Nelson - * Bjorn Stenberg + * Bjorn Stenberg * Angus Mackay * * ------------------------------------------------------------ * Main author: - * - Daniel Stenberg + * - Daniel Stenberg * - * http://curl.haxx.nu + * http://curl.haxx.se * * $Source$ * $Revision$ @@ -52,7 +52,10 @@ * * ------------------------------------------------------------ * $Log$ - * Revision 1.2 2000-01-10 23:36:14 bagder + * Revision 1.3 2000-06-20 15:31:26 bagder + * haxx.nu => haxx.se + * + * Revision 1.2 2000/01/10 23:36:14 bagder * syncing with local edit * * Revision 1.4 1999/09/06 06:59:40 dast -- cgit v1.2.1 From 24dee483e9e925c2ab79dd582f70c9a55ab9ba4d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 3 Jan 2001 09:29:33 +0000 Subject: dual-license fix --- lib/formdata.h | 70 +++++++++------------------------------------------------- 1 file changed, 11 insertions(+), 59 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 9c6c61863..dd5e0a4ad 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -8,69 +8,21 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Copyright (C) 2000, Daniel Stenberg, , et al. * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. * - * The Original Code is Curl. + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. * - * The Initial Developer of the Original Code is Daniel Stenberg. + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. * - * Portions created by the Initial Developer are Copyright (C) 1998. - * All Rights Reserved. - * - * Contributor(s): - * Rafael Sagula - * Sampo Kellomaki - * Linas Vepstas - * Bjorn Reese - * Johan Anderson - * Kjell Ericson - * Troy Engel - * Ryan Nelson - * Bjorn Stenberg - * Angus Mackay - * - * ------------------------------------------------------------ - * Main author: - * - Daniel Stenberg - * - * http://curl.haxx.se - * - * $Source$ - * $Revision$ - * $Date$ - * $Author$ - * $State$ - * $Locker$ - * - * ------------------------------------------------------------ - * $Log$ - * Revision 1.3 2000-06-20 15:31:26 bagder - * haxx.nu => haxx.se - * - * Revision 1.2 2000/01/10 23:36:14 bagder - * syncing with local edit - * - * Revision 1.4 1999/09/06 06:59:40 dast - * Changed email info - * - * Revision 1.3 1999/08/13 07:34:47 dast - * Changed the URL in the header - * - * Revision 1.2 1999/07/30 12:59:47 dast - * FormFree() was added to properly cleanup after a form was posted. - * - * Revision 1.1.1.1 1999/03/11 22:23:34 dast - * Imported sources - * - ****************************************************************************/ + * $Id$ + *****************************************************************************/ /* plain and simple linked list with lines to send */ struct FormData { struct FormData *next; -- cgit v1.2.1 From 4031104404c6ceed5e57134125dcdb6cac51c564 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 5 Jan 2001 10:11:41 +0000 Subject: Internal symbols that aren't static are now prefixed with 'Curl_' --- lib/formdata.h | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index dd5e0a4ad..4a0d8509d 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -36,23 +36,19 @@ struct Form { been sent in a previous invoke */ }; -int FormParse(char *string, - struct HttpPost **httppost, - struct HttpPost **last_post); +int Curl_FormInit(struct Form *form, struct FormData *formdata ); -int FormInit(struct Form *form, struct FormData *formdata ); - -struct FormData *getFormData(struct HttpPost *post, - int *size); +struct FormData *Curl_getFormData(struct HttpPost *post, + int *size); /* fread() emulation */ -int FormReader(char *buffer, - size_t size, - size_t nitems, - FILE *mydata); +int Curl_FormReader(char *buffer, + size_t size, + size_t nitems, + FILE *mydata); -char *MakeFormBoundary(void); +char *Curl_FormBoundary(void); -void FormFree(struct FormData *); +void Curl_FormFree(struct FormData *); #endif -- cgit v1.2.1 From 2cf45f68b095f478a8a80a2acb5e0ea54e49db70 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 6 Aug 2001 12:36:18 +0000 Subject: Curl_FormFree renamed to Curl_formclean, as it turns out VMS for example requires all global symbols to be *case insentively* unique! curl_formfree is a global function we shouldn't touch. --- lib/formdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 4a0d8509d..35a5ca7a8 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -49,6 +49,6 @@ int Curl_FormReader(char *buffer, char *Curl_FormBoundary(void); -void Curl_FormFree(struct FormData *); +void Curl_formclean(struct FormData *); #endif -- cgit v1.2.1 From 08655d8d5d0ea980227096366c231693198e61d6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 21 Aug 2001 13:18:07 +0000 Subject: Georg Huettenegger's patch curl-7.8.1-pre5-patch-20010819 --- lib/formdata.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 35a5ca7a8..8623c89e5 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -47,8 +47,15 @@ int Curl_FormReader(char *buffer, size_t nitems, FILE *mydata); +/* possible (old) fread() emulation that copies at most one line */ +int Curl_FormReadOneLine(char *buffer, + size_t size, + size_t nitems, + FILE *mydata); + char *Curl_FormBoundary(void); void Curl_formclean(struct FormData *); #endif + -- cgit v1.2.1 From 725bd1dddf24d4775ebcbe6414f19517b2cd2a6c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 28 Aug 2001 08:54:33 +0000 Subject: Georg Huettenegger's fixes and improvements to curl_formadd() --- lib/formdata.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 8623c89e5..bca1f9fcc 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -36,6 +36,17 @@ struct Form { been sent in a previous invoke */ }; +/* used by FormAdd for temporary storage */ +typedef struct FormInfo { + char *name; + long namelength; + char *value; + long contentslength; + char *contenttype; + long flags; + struct FormInfo *more; +} FormInfo; + int Curl_FormInit(struct Form *form, struct FormData *formdata ); struct FormData *Curl_getFormData(struct HttpPost *post, -- cgit v1.2.1 From 2eb355733ff3b9a6cde53f7c114f9ae77368a25f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 14 Dec 2001 12:59:16 +0000 Subject: Marcus Webster's newly added CURLFORM_CONTENTHEADER --- lib/formdata.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index bca1f9fcc..40f8c9472 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -44,6 +44,7 @@ typedef struct FormInfo { long contentslength; char *contenttype; long flags; + struct curl_slist* contentheader; struct FormInfo *more; } FormInfo; -- cgit v1.2.1 From 9f374c20507940862601c3dbad3250a44541a85e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 11 Mar 2002 15:18:59 +0000 Subject: Added support for CURLFORM_FILENAME to set the filename field of a file part. --- lib/formdata.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 40f8c9472..7ab210064 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2000, Daniel Stenberg, , et al. + * Copyright (C) 2002, Daniel Stenberg, , et al. * * In order to be useful for every potential user, curl and libcurl are * dual-licensed under the MPL and the MIT/X-derivate licenses. @@ -44,6 +44,9 @@ typedef struct FormInfo { long contentslength; char *contenttype; long flags; + + char *showfilename; /* The file name to show. If not set, the actual + file name will be used */ struct curl_slist* contentheader; struct FormInfo *more; } FormInfo; -- cgit v1.2.1 From 974f314f5785156af6983675aeb28313cc8ba2ea Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 19 Mar 2002 07:54:55 +0000 Subject: copyright string (year) update --- lib/formdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 7ab210064..3dad243a3 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2002, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. * * In order to be useful for every potential user, curl and libcurl are * dual-licensed under the MPL and the MIT/X-derivate licenses. -- cgit v1.2.1 From 95f78080abd4a07f95e1aa06737e1faa854614c7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 15 Apr 2002 11:19:03 +0000 Subject: This makes formposting with a specified file missing fail. curl_easy_perform will then return CURLE_READ_ERROR. --- lib/formdata.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 3dad243a3..1657f4122 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -53,8 +53,10 @@ typedef struct FormInfo { int Curl_FormInit(struct Form *form, struct FormData *formdata ); -struct FormData *Curl_getFormData(struct HttpPost *post, - int *size); +CURLcode +Curl_getFormData(struct FormData **, + struct HttpPost *post, + int *size); /* fread() emulation */ int Curl_FormReader(char *buffer, -- cgit v1.2.1 From 131645dc310a70d8d8ca1df00ec7329bc80c940e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 12 Jun 2002 21:40:59 +0000 Subject: Chris Combes added CURLFORM_BUFFER, CURLFORM_BUFFERPTR, CURLFORM_BUFFERLENGTH --- lib/formdata.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 1657f4122..e56f85822 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -45,6 +45,10 @@ typedef struct FormInfo { char *contenttype; long flags; + /* CMC: Added support for buffer uploads */ + char *buffer; /* pointer to existing buffer used for file upload */ + long bufferlength; + char *showfilename; /* The file name to show. If not set, the actual file name will be used */ struct curl_slist* contentheader; -- cgit v1.2.1 From ba4e69bebc8f7f32f3bc7faa1e13e7580754075b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 3 Sep 2002 11:52:59 +0000 Subject: updated source code boilerplate/header --- lib/formdata.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index e56f85822..85e86f305 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -1,7 +1,7 @@ #ifndef __FORMDATA_H #define __FORMDATA_H -/***************************************************************************** +/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | @@ -10,19 +10,19 @@ * * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. * - * In order to be useful for every potential user, curl and libcurl are - * dual-licensed under the MPL and the MIT/X-derivate licenses. - * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the MPL or the MIT/X-derivate - * licenses. You may pick one of these licenses. + * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * * $Id$ - *****************************************************************************/ + ***************************************************************************/ /* plain and simple linked list with lines to send */ struct FormData { struct FormData *next; -- cgit v1.2.1 From f26a338a54e04d0a6907f5d2479d8b0fa9daf297 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 16 Jan 2003 21:08:12 +0000 Subject: copyright year update in the source header --- lib/formdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 85e86f305..2a529a83e 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2003, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From 053f6c85efd0bf698f73343989474d672d0563a8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 7 Jan 2004 09:19:33 +0000 Subject: updated year in the copyright string --- lib/formdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 2a529a83e..38aef434c 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2003, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From e5cd0cc402c32e98a5180e66d6635da87bc55262 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 22 Jan 2004 11:54:00 +0000 Subject: use the proper type for formposts, not the deprecated one --- lib/formdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 38aef434c..4da6bc6ae 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -59,7 +59,7 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ); CURLcode Curl_getFormData(struct FormData **, - struct HttpPost *post, + struct curl_httppost *post, int *size); /* fread() emulation */ -- cgit v1.2.1 From d571064b65195aa7c71200af549a95404a2f0ce1 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 26 Feb 2004 13:40:43 +0000 Subject: Clear up int/long/size_t/ssize_t usage a bit --- lib/formdata.h | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 4da6bc6ae..6fdec9f13 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -27,28 +27,25 @@ struct FormData { struct FormData *next; char *line; - long length; + size_t length; }; struct Form { struct FormData *data; /* current form line to send */ - int sent; /* number of bytes of the current line that has already - been sent in a previous invoke */ + unsigned int sent; /* number of bytes of the current line that has already + been sent in a previous invoke */ }; /* used by FormAdd for temporary storage */ typedef struct FormInfo { char *name; - long namelength; + size_t namelength; char *value; - long contentslength; + size_t contentslength; char *contenttype; long flags; - - /* CMC: Added support for buffer uploads */ char *buffer; /* pointer to existing buffer used for file upload */ - long bufferlength; - + size_t bufferlength; char *showfilename; /* The file name to show. If not set, the actual file name will be used */ struct curl_slist* contentheader; @@ -60,19 +57,19 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ); CURLcode Curl_getFormData(struct FormData **, struct curl_httppost *post, - int *size); + size_t *size); /* fread() emulation */ -int Curl_FormReader(char *buffer, - size_t size, - size_t nitems, - FILE *mydata); +size_t Curl_FormReader(char *buffer, + size_t size, + size_t nitems, + FILE *mydata); /* possible (old) fread() emulation that copies at most one line */ -int Curl_FormReadOneLine(char *buffer, - size_t size, - size_t nitems, - FILE *mydata); +size_t Curl_FormReadOneLine(char *buffer, + size_t size, + size_t nitems, + FILE *mydata); char *Curl_FormBoundary(void); -- cgit v1.2.1 From 94a1d09ac7500afdd6f3cef3fbfefa16072f2704 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 12 Mar 2004 14:22:16 +0000 Subject: more variable type fixing for the huge posts --- lib/formdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 6fdec9f13..df6ae3ac0 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -57,7 +57,7 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ); CURLcode Curl_getFormData(struct FormData **, struct curl_httppost *post, - size_t *size); + curl_off_t *size); /* fread() emulation */ size_t Curl_FormReader(char *buffer, -- cgit v1.2.1 From 70e2aadc18fce9f6e3b9c06612c8314bf4f710b1 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 23 Apr 2004 10:37:52 +0000 Subject: Replaced Curl_FormReadOneLine with Curl_formpostheader as that is the only use for it. It saves one extra copy of the header. I also added comments for several functions in formdata.c --- lib/formdata.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index df6ae3ac0..d087fa7ca 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -65,11 +65,12 @@ size_t Curl_FormReader(char *buffer, size_t nitems, FILE *mydata); -/* possible (old) fread() emulation that copies at most one line */ -size_t Curl_FormReadOneLine(char *buffer, - size_t size, - size_t nitems, - FILE *mydata); +/* + * Curl_formpostheader() returns the first line of the formpost, the + * request-header part (which is not part of the request-body like the rest of + * the post). + */ +char *Curl_formpostheader(void *formp, size_t *len); char *Curl_FormBoundary(void); -- cgit v1.2.1 From d3999e06d199a2538db69536bd9266666180ed68 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 11 May 2004 14:48:53 +0000 Subject: clear up memory on failure a little better --- lib/formdata.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index d087fa7ca..af62156d6 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -39,8 +39,10 @@ struct Form { /* used by FormAdd for temporary storage */ typedef struct FormInfo { char *name; + bool name_alloc; size_t namelength; char *value; + bool value_alloc; size_t contentslength; char *contenttype; long flags; -- cgit v1.2.1 From 005042e973cb6e42b8bf76ae15a72f1482c43e6b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 12 May 2004 09:02:23 +0000 Subject: improved cleaning up in case of memory allocation failures --- lib/formdata.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index af62156d6..eb5284caa 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -45,11 +45,13 @@ typedef struct FormInfo { bool value_alloc; size_t contentslength; char *contenttype; + bool contenttype_alloc; long flags; char *buffer; /* pointer to existing buffer used for file upload */ size_t bufferlength; char *showfilename; /* The file name to show. If not set, the actual file name will be used */ + bool showfilename_alloc; struct curl_slist* contentheader; struct FormInfo *more; } FormInfo; -- cgit v1.2.1 From 24572dacccd331bcdfe5baca20c56d85d5d77359 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 14 Jun 2004 08:51:43 +0000 Subject: Allow formposting of files larger than what fits in memory by not reading the file until it is actually being uploaded. Make sure we build and still work with HTTP disabled - the SSL code might use the boundary string for some random seeding. --- lib/formdata.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index eb5284caa..c6a78cdee 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -2,10 +2,10 @@ #define __FORMDATA_H /*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. @@ -13,7 +13,7 @@ * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. - * + * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. @@ -23,17 +23,25 @@ * * $Id$ ***************************************************************************/ + +enum formtype { + FORM_DATA, /* regular data */ + FORM_FILE /* 'line' points to a file name we should read from */ +}; + /* plain and simple linked list with lines to send */ struct FormData { struct FormData *next; + enum formtype type; char *line; size_t length; }; struct Form { struct FormData *data; /* current form line to send */ - unsigned int sent; /* number of bytes of the current line that has already - been sent in a previous invoke */ + size_t sent; /* number of bytes of the current line that has + already been sent in a previous invoke */ + FILE *fp; /* file to read from */ }; /* used by FormAdd for temporary storage */ -- cgit v1.2.1 From a88deadd6f85a6ac3b7f9d574bbb7eaab3115700 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 27 Jul 2006 22:35:09 +0000 Subject: Yves Lejeune fixed so that replacing Content-Type: when doing multipart formposts work exactly the way you want it (and the way you'd assume it works) --- lib/formdata.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index c6a78cdee..304d009ed 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -69,6 +69,7 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ); CURLcode Curl_getFormData(struct FormData **, struct curl_httppost *post, + const char *custom_contenttype, curl_off_t *size); /* fread() emulation */ -- cgit v1.2.1 From 0fb5a65a58130da7882f0a8d396e24b95c25064f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 14 Jan 2007 14:57:51 +0000 Subject: - David McCreedy provided libcurl changes for doing HTTP communication on non-ASCII platforms. It does add some complexity, most notably with more #ifdefs, but I want to see this supported added and I can't see how we can add it without the extra stuff added. --- lib/formdata.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 304d009ed..0cac4ac27 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -25,8 +25,10 @@ ***************************************************************************/ enum formtype { - FORM_DATA, /* regular data */ - FORM_FILE /* 'line' points to a file name we should read from */ + FORM_DATA, /* form metadata (convert to network encoding if necessary) */ + FORM_CONTENT, /* form content (never convert) */ + FORM_FILE /* 'line' points to a file name we should read from + to create the form data (never convert) */ }; /* plain and simple linked list with lines to send */ @@ -87,7 +89,9 @@ char *Curl_formpostheader(void *formp, size_t *len); char *Curl_FormBoundary(void); -void Curl_formclean(struct FormData *); +void Curl_formclean(struct FormData **); + +CURLcode Curl_formconvert(struct SessionHandle *, struct FormData *); #endif -- cgit v1.2.1 From b6f889085ddaecd2f13ce287615a9e1527a21d59 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 27 Jan 2007 03:43:05 +0000 Subject: update copyright year notice --- lib/formdata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 0cac4ac27..4ca0f3c5c 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From a2314225e02ea2f3bd49dc8557f2452846e49b19 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 31 Mar 2008 10:02:23 +0000 Subject: - Added CURLFORM_STREAM as a supported option to curl_formadd() to allow an application to provide data for a multipart with the read callback. Note that the size needs to be provided with CURLFORM_CONTENTSLENGTH when the stream option is used. This feature is verified by the new test case 554. This feature was sponsored by Xponaut. --- lib/formdata.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 4ca0f3c5c..04f139322 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -27,8 +27,10 @@ enum formtype { FORM_DATA, /* form metadata (convert to network encoding if necessary) */ FORM_CONTENT, /* form content (never convert) */ - FORM_FILE /* 'line' points to a file name we should read from - to create the form data (never convert) */ + FORM_CALLBACK, /* 'line' points to the custom pointer we pass to the callback + */ + FORM_FILE /* 'line' points to a file name we should read from + to create the form data (never convert) */ }; /* plain and simple linked list with lines to send */ @@ -44,6 +46,7 @@ struct Form { size_t sent; /* number of bytes of the current line that has already been sent in a previous invoke */ FILE *fp; /* file to read from */ + curl_read_callback fread_func; /* fread callback pointer */ }; /* used by FormAdd for temporary storage */ @@ -62,6 +65,7 @@ typedef struct FormInfo { char *showfilename; /* The file name to show. If not set, the actual file name will be used */ bool showfilename_alloc; + char *userp; /* pointer for the read callback */ struct curl_slist* contentheader; struct FormInfo *more; } FormInfo; -- cgit v1.2.1 From c32cf33a16d31eeff9a66a1e73ce58b6791dd54d Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Mon, 15 Jun 2009 10:15:28 +0000 Subject: Replaced use of standard C library rand()/srand() by our own pseudo-random number generator. --- lib/formdata.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 04f139322..0d9400a15 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -97,5 +97,8 @@ void Curl_formclean(struct FormData **); CURLcode Curl_formconvert(struct SessionHandle *, struct FormData *); +void Curl_srand(void); +unsigned int Curl_rand(void); + #endif -- cgit v1.2.1 From f2f45339dc378ed4d15b19ebf8d16e9f58d776e8 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 17 Sep 2009 14:23:27 +0000 Subject: Moved Curl_rand() and Curl_srand() code from formdata.c and formdata.h into curl_rand.c and curl_rand.h --- lib/formdata.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 0d9400a15..1ca0eef8b 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -1,6 +1,5 @@ -#ifndef __FORMDATA_H -#define __FORMDATA_H - +#ifndef HEADER_CURL_FORMDATA_H +#define HEADER_CURL_FORMDATA_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -8,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -97,8 +96,4 @@ void Curl_formclean(struct FormData **); CURLcode Curl_formconvert(struct SessionHandle *, struct FormData *); -void Curl_srand(void); -unsigned int Curl_rand(void); - -#endif - +#endif /* HEADER_CURL_FORMDATA_H */ -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/formdata.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 1ca0eef8b..0c9db4423 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -20,7 +20,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ enum formtype { -- cgit v1.2.1 From e8c442952d53d493e347a784d53d602359b4331c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 20 Oct 2010 14:57:43 +0200 Subject: formdata: provide error message When failing to build form post due to an error, the code now does a proper failf(). Previously libcurl would report an error like "failed creating formpost data" when a file wasn't possible to open which was not easy for users to figure out. I also lower cased a function name to be named more curl-style and removed some unnecessary code. --- lib/formdata.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/formdata.h') diff --git a/lib/formdata.h b/lib/formdata.h index 0c9db4423..22f504bb3 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -70,11 +70,11 @@ typedef struct FormInfo { int Curl_FormInit(struct Form *form, struct FormData *formdata ); -CURLcode -Curl_getFormData(struct FormData **, - struct curl_httppost *post, - const char *custom_contenttype, - curl_off_t *size); +CURLcode Curl_getformdata(struct SessionHandle *data, + struct FormData **, + struct curl_httppost *post, + const char *custom_contenttype, + curl_off_t *size); /* fread() emulation */ size_t Curl_FormReader(char *buffer, -- cgit v1.2.1