From 138fe1b9349abfd43366e0fd15e0ec24febac99e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 5 Jun 2000 08:26:13 +0000 Subject: [PATCH] using the new formparse, the new getenv, using the new headers struct and clean up the headers better --- src/main.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/main.c b/src/main.c index 24df306..9a8de74 100644 --- a/src/main.c +++ b/src/main.c @@ -49,7 +49,6 @@ #include /* new for v7 */ #include /* new for v7 */ #include -#include "../lib/getdate.h" #include "urlglob.h" #define CURLseparator "--_curl_--" @@ -305,8 +304,7 @@ struct Configurable { TimeCond timecond; time_t condtime; - struct HttpHeader *headers; - struct HttpHeader *last_header; + struct curl_slist *headers; struct HttpPost *httppost; struct HttpPost *last_post; @@ -369,7 +367,6 @@ static int getparameter(char *flag, /* f or -long-flag */ char letter; char *parse=NULL; int res; - struct HttpHeader *head; int j; time_t now; int hit=-1; @@ -634,7 +631,7 @@ static int getparameter(char *flag, /* f or -long-flag */ case 'F': /* "form data" simulation, this is a little advanced so lets do our best to sort this out slowly and carefully */ - if(curl_FormParse(nextarg, + if(curl_formparse(nextarg, &config->httppost, &config->last_post)) return CURLE_FAILED_INIT; @@ -644,21 +641,8 @@ static int getparameter(char *flag, /* f or -long-flag */ help(); return CURLE_FAILED_INIT; case 'H': - head = (struct HttpHeader *)malloc(sizeof(struct HttpHeader)); - if(head) { - head->next = NULL; - head->header = NULL; /* first zero this */ - GetStr(&head->header, nextarg); /* now get the header line */ - - /* point on our new one */ - if(config->last_header) - config->last_header->next = head; - else { - config->headers = head; - } - - config->last_header = head; - } + /* A custom header to append to a list */ + config->headers = curl_slist_append(config->headers, nextarg); break; case 'i': config->conf ^= CONF_HEADER; /* include the HTTP header as well */ @@ -839,7 +823,7 @@ static int parseconfig(char *filename, #define CURLRC DOT_CHAR "curlrc" - home = curl_GetEnv("HOME"); /* portable environment reader */ + home = curl_getenv("HOME"); /* portable environment reader */ if(!home) return CURLE_OK; @@ -1359,6 +1343,8 @@ int main(int argc, char *argv[]) #endif curl_slist_free_all(config.quote); /* the checks for config.quote == NULL */ + curl_slist_free_all(config.postquote); /* */ + curl_slist_free_all(config.headers); /* */ return(res); } -- 2.7.4