• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/curl/curl-7.36.0/lib/

Lines Matching refs:form

55 static size_t readfromfile(struct Form *form, char *buffer, size_t size);
309 FormInfo *first_form, *current_form, *form = NULL;
461 form = AddFormInfo(fname, NULL, current_form);
462 if(!form) {
467 form->value_alloc = TRUE;
468 current_form = form;
469 form = NULL;
532 accepted as a fine form part */
550 form = AddFormInfo(NULL, type, current_form);
551 if(!form) {
556 form->contenttype_alloc = TRUE;
557 current_form = form;
558 form = NULL;
647 for(form = first_form;
648 form != NULL;
649 form = form->more) {
650 if(((!form->name || !form->value) && !post) ||
651 ( (form->contentslength) &&
652 (form->flags & HTTPPOST_FILENAME) ) ||
653 ( (form->flags & HTTPPOST_FILENAME) &&
654 (form->flags & HTTPPOST_PTRCONTENTS) ) ||
656 ( (!form->buffer) &&
657 (form->flags & HTTPPOST_BUFFER) &&
658 (form->flags & HTTPPOST_PTRBUFFER) ) ||
660 ( (form->flags & HTTPPOST_READFILE) &&
661 (form->flags & HTTPPOST_PTRCONTENTS) )
667 if(((form->flags & HTTPPOST_FILENAME) ||
668 (form->flags & HTTPPOST_BUFFER)) &&
669 !form->contenttype ) {
670 char *f = form->flags & HTTPPOST_BUFFER?
671 form->showfilename : form->value;
674 form->contenttype = strdup(ContentTypeForFilename(f, prevtype));
675 if(!form->contenttype) {
679 form->contenttype_alloc = TRUE;
681 if(!(form->flags & HTTPPOST_PTRNAME) &&
682 (form == first_form) ) {
683 /* Note that there's small risk that form->name is NULL here if the
685 if(form->name)
687 form->name = memdup(form->name, form->namelength);
688 if(!form->name) {
692 form->name_alloc = TRUE;
694 if(!(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
698 form->value = memdup(form->value, form->contentslength);
699 if(!form->value) {
703 form->value_alloc = TRUE;
705 post = AddHttpPost(form->name, form->namelength,
706 form->value, form->contentslength,
707 form->buffer, form->bufferlength,
708 form->contenttype, form->flags,
709 form->contentheader, form->showfilename,
710 form->userp,
719 if(form->contenttype)
720 prevtype = form->contenttype;
728 for(ptr = form; ptr != NULL; ptr = ptr->more) {
930 struct FormData *next, *form;
932 form = *form_ptr;
933 if(!form)
937 next=form->next; /* the following form line */
938 if(form->type <= FORM_CONTENT)
939 free(form->line); /* free the line */
940 free(form); /* free the struct */
942 } while((form = next) != NULL); /* continue */
954 int curl_formget(struct curl_httppost *form, void *arg,
961 rc = Curl_getformdata(NULL, &data, form, NULL, &size);
997 * curl_formfree() is an external function to free up a whole form post
1000 void curl_formfree(struct curl_httppost *form)
1004 if(!form)
1005 /* no form to free, just get out of this */
1009 next=form->next; /* the following form line */
1012 if(form->more)
1013 curl_formfree(form->more);
1015 if(!(form->flags & HTTPPOST_PTRNAME) && form->name)
1016 free(form->name); /* free the name */
1017 if(!(form->flags &
1019 form->contents)
1020 free(form->contents); /* free the contents */
1021 if(form->contenttype)
1022 free(form->contenttype); /* free the content type */
1023 if(form->showfilename)
1024 free(form->showfilename); /* free the faked file name */
1025 free(form); /* free the struct */
1027 } while((form = next) != NULL); /* continue */
1093 struct FormData **form,
1127 result = AddFormDataf(form, size,
1154 struct FormData *form = NULL;
1164 *finalform = NULL; /* default form is empty */
1174 result = AddFormDataf(&form, NULL,
1177 "Content-Type: multipart/form-data",
1187 firstform = form;
1192 result = AddFormDataf(&form, &size, "\r\n");
1198 result = AddFormDataf(&form, &size, "--%s\r\n", boundary);
1206 result = AddFormDataf(&form, &size,
1207 "Content-Disposition: form-data; name=\"");
1211 result = AddFormData(&form, FORM_DATA, post->name, post->namelength,
1216 result = AddFormDataf(&form, &size, "\"");
1231 result = AddFormDataf(&form, &size,
1249 result = AddFormDataf(&form, &size,
1255 result = formdata_add_filename(file, &form, &size);
1265 result = formdata_add_filename(post, &form, &size);
1274 result = AddFormDataf(&form, &size,
1283 /* Process the additional headers specified for this form */
1284 result = AddFormDataf( &form, &size, "\r\n%s", curList->data );
1292 result = AddFormDataf(&form, &size, "\r\n\r\n");
1315 result = AddFormData(&form, FORM_FILE, file->contents, 0, &size);
1326 result = AddFormData(&form, FORM_CONTENT, buffer, nread, &size);
1341 result = AddFormData(&form, FORM_CONTENT, post->buffer,
1346 result = AddFormData(&form, FORM_CALLBACK, post->userp,
1350 result = AddFormData(&form, FORM_CONTENT, post->contents,
1362 result = AddFormDataf(&form, &size,
1373 result = AddFormDataf(&form, &size,
1395 * Curl_FormInit() inits the struct 'form' points to with the 'formdata'
1398 int Curl_FormInit(struct Form *form, struct FormData *formdata )
1403 form->data = formdata;
1404 form->sent = 0;
1405 form->fp = NULL;
1406 form->fread_func = ZERO_NULL;
1448 static size_t readfromfile(struct Form *form, char *buffer,
1452 bool callback = (form->data->type == FORM_CALLBACK)?TRUE:FALSE;
1455 if(form->fread_func == ZERO_NULL)
1458 nread = form->fread_func(buffer, 1, size, form->data->line);
1461 if(!form->fp) {
1463 form->fp = fopen_read(form->data->line, "rb"); /* b is for binary */
1464 if(!form->fp)
1467 nread = fread(buffer, 1, size, form->fp);
1471 if(form->fp) {
1472 fclose(form->fp);
1473 form->fp = NULL;
1475 form->data = form->data->next;
1490 struct Form *form;
1494 form=(struct Form *)mydata;
1498 if(!form->data)
1501 if((form->data->type == FORM_FILE) ||
1502 (form->data->type == FORM_CALLBACK)) {
1503 gotsize = readfromfile(form, buffer, wantedsize);
1511 if((form->data->length - form->sent ) > wantedsize - gotsize) {
1513 memcpy(buffer + gotsize , form->data->line + form->sent,
1516 form->sent += wantedsize-gotsize;
1522 form->data->line + form->sent,
1523 (form->data->length - form->sent) );
1524 gotsize += form->data->length - form->sent;
1526 form->sent = 0;
1528 form->data = form->data->next; /* advance */
1530 } while(form->data && (form->data->type < FORM_CALLBACK));
1545 struct Form *form=(struct Form *)formp;
1547 if(!form->data)
1550 header = form->data->line;
1551 *len = form->data->length;
1553 form->data = form->data->next; /* advance */
1580 int curl_formget(struct curl_httppost *form, void *arg,
1583 (void) form;
1589 void curl_formfree(struct curl_httppost *form)
1591 (void)form;