• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/curl-7.23.1/source/lib/

Lines Matching defs:form

58 static size_t readfromfile(struct Form *form, char *buffer, size_t size);
313 FormInfo *first_form, *current_form, *form = NULL;
524 accepted as a fine form part */
604 for(form = first_form;
605 form != NULL;
606 form = form->more) {
607 if(((!form->name || !form->value) && !post) ||
608 ( (form->contentslength) &&
609 (form->flags & HTTPPOST_FILENAME) ) ||
610 ( (form->flags & HTTPPOST_FILENAME) &&
611 (form->flags & HTTPPOST_PTRCONTENTS) ) ||
613 ( (!form->buffer) &&
614 (form->flags & HTTPPOST_BUFFER) &&
615 (form->flags & HTTPPOST_PTRBUFFER) ) ||
617 ( (form->flags & HTTPPOST_READFILE) &&
618 (form->flags & HTTPPOST_PTRCONTENTS) )
624 if(((form->flags & HTTPPOST_FILENAME) ||
625 (form->flags & HTTPPOST_BUFFER)) &&
626 !form->contenttype ) {
628 form->contenttype
629 = strdup(ContentTypeForFilename(form->value, prevtype));
630 if(!form->contenttype) {
634 form->contenttype_alloc = TRUE;
636 if(!(form->flags & HTTPPOST_PTRNAME) &&
637 (form == first_form) ) {
638 /* Note that there's small risk that form->name is NULL here if the
640 if(form->name)
642 form->name = memdup(form->name, form->namelength);
643 if(!form->name) {
647 form->name_alloc = TRUE;
649 if(!(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
653 form->value = memdup(form->value, form->contentslength);
654 if(!form->value) {
658 form->value_alloc = TRUE;
660 post = AddHttpPost(form->name, form->namelength,
661 form->value, form->contentslength,
662 form->buffer, form->bufferlength,
663 form->contenttype, form->flags,
664 form->contentheader, form->showfilename,
665 form->userp,
674 if(form->contenttype)
675 prevtype = form->contenttype;
682 if(!form)
683 form = current_form;
684 if(form) {
685 if(form->name_alloc)
686 free(form->name);
687 if(form->value_alloc)
688 free(form->value);
689 if(form->contenttype_alloc)
690 free(form->contenttype);
691 if(form->showfilename_alloc)
692 free(form->showfilename);
697 form = first_form;
698 while(form != NULL) {
701 delete_form = form;
702 form = form->more;
813 struct FormData *next, *form;
815 form = *form_ptr;
816 if(!form)
820 next=form->next; /* the following form line */
821 if(form->type <= FORM_CONTENT)
822 free(form->line); /* free the line */
823 free(form); /* free the struct */
825 } while((form = next) != NULL); /* continue */
837 int curl_formget(struct curl_httppost *form, void *arg,
844 rc = Curl_getformdata(NULL, &data, form, NULL, &size);
880 * curl_formfree() is an external function to free up a whole form post
883 void curl_formfree(struct curl_httppost *form)
887 if(!form)
888 /* no form to free, just get out of this */
892 next=form->next; /* the following form line */
895 if(form->more)
896 curl_formfree(form->more);
898 if(!(form->flags & HTTPPOST_PTRNAME) && form->name)
899 free(form->name); /* free the name */
900 if(!(form->flags &
902 form->contents)
903 free(form->contents); /* free the contents */
904 if(form->contenttype)
905 free(form->contenttype); /* free the content type */
906 if(form->showfilename)
907 free(form->showfilename); /* free the faked file name */
908 free(form); /* free the struct */
910 } while((form = next) != NULL); /* continue */
994 struct FormData *form = NULL;
1004 *finalform=NULL; /* default form is empty */
1014 result = AddFormDataf(&form, NULL,
1017 "Content-Type: multipart/form-data",
1027 firstform = form;
1032 result = AddFormDataf(&form, &size, "\r\n");
1038 result = AddFormDataf(&form, &size, "--%s\r\n", boundary);
1046 result = AddFormDataf(&form, &size,
1047 "Content-Disposition: form-data; name=\"");
1051 result = AddFormData(&form, FORM_DATA, post->name, post->namelength,
1056 result = AddFormDataf(&form, &size, "\"");
1066 result = AddFormDataf(&form, &size,
1094 result = AddFormDataf(&form, &size,
1114 result = AddFormDataf(&form, &size,
1128 result = AddFormDataf(&form, &size,
1137 /* Process the additional headers specified for this form */
1138 result = AddFormDataf( &form, &size, "\r\n%s", curList->data );
1149 result = AddFormDataf(&form, &size, "\r\n\r\n");
1172 result = AddFormData(&form, FORM_FILE, file->contents, 0, &size);
1183 result = AddFormData(&form, FORM_CONTENT, buffer, nread, &size);
1198 result = AddFormData(&form, FORM_CONTENT, post->buffer,
1203 result = AddFormData(&form, FORM_CALLBACK, post->userp,
1207 result = AddFormData(&form, FORM_CONTENT, post->contents,
1222 result = AddFormDataf(&form, &size,
1238 result = AddFormDataf(&form, &size,
1257 * Curl_FormInit() inits the struct 'form' points to with the 'formdata'
1260 int Curl_FormInit(struct Form *form, struct FormData *formdata )
1265 form->data = formdata;
1266 form->sent = 0;
1267 form->fp = NULL;
1268 form->fread_func = ZERO_NULL;
1280 static size_t readfromfile(struct Form *form, char *buffer,
1284 bool callback = (form->data->type == FORM_CALLBACK)?TRUE:FALSE;
1287 if(form->fread_func == ZERO_NULL)
1290 nread = form->fread_func(buffer, 1, size, form->data->line);
1293 if(!form->fp) {
1295 form->fp = fopen(form->data->line, "rb"); /* b is for binary */
1296 if(!form->fp)
1299 nread = fread(buffer, 1, size, form->fp);
1303 if(form->fp) {
1304 fclose(form->fp);
1305 form->fp = NULL;
1307 form->data = form->data->next;
1322 struct Form *form;
1326 form=(struct Form *)mydata;
1330 if(!form->data)
1333 if((form->data->type == FORM_FILE) ||
1334 (form->data->type == FORM_CALLBACK)) {
1335 gotsize = readfromfile(form, buffer, wantedsize);
1343 if((form->data->length - form->sent ) > wantedsize - gotsize) {
1345 memcpy(buffer + gotsize , form->data->line + form->sent,
1348 form->sent += wantedsize-gotsize;
1354 form->data->line + form->sent,
1355 (form->data->length - form->sent) );
1356 gotsize += form->data->length - form->sent;
1358 form->sent = 0;
1360 form->data = form->data->next; /* advance */
1362 } while(form->data && (form->data->type < FORM_CALLBACK));
1377 struct Form *form=(struct Form *)formp;
1379 if(!form->data)
1382 header = form->data->line;
1383 *len = form->data->length;
1385 form->data = form->data->next; /* advance */
1400 int curl_formget(struct curl_httppost *form, void *arg,
1403 (void) form;
1409 void curl_formfree(struct curl_httppost *form)
1411 (void)form;