From 03c22b4576e99abf6385f64f54e3fb85c782cf0f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 11 Nov 2002 08:40:37 +0000 Subject: Now supports "Transfer-Encoding: chunked" for HTTP PUT operations where the size of the uploaded file is unknown. --- lib/http.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/http.c') diff --git a/lib/http.c b/lib/http.c index 35cae48e8..460ce0a86 100644 --- a/lib/http.c +++ b/lib/http.c @@ -485,6 +485,7 @@ CURLcode Curl_http(struct connectdata *conn) struct Cookie *co=NULL; /* no cookies from start */ char *ppath = conn->ppath; /* three previous function arguments */ char *host = conn->name; + const char *te = ""; /* tranfer-encoding */ if(!conn->proto.http) { /* Only allocate this struct if we don't already have it! */ @@ -546,6 +547,14 @@ CURLcode Curl_http(struct connectdata *conn) conn->allocptr.cookie = aprintf("Cookie: %s\015\012", data->set.cookie); } + if(conn->upload_chunky) { + if(!checkheaders(data, "Transfer-Encoding:")) { + te = "Transfer-Encoding: chunked\r\n"; + } + /* else + our header was already added, what to do now? */ + } + if(data->cookies) { co = Curl_cookie_getlist(data->cookies, host, ppath, @@ -717,7 +726,8 @@ CURLcode Curl_http(struct connectdata *conn) "%s" /* pragma */ "%s" /* accept */ "%s" /* accept-encoding */ - "%s", /* referer */ + "%s" /* referer */ + "%s",/* transfer-encoding */ data->set.customrequest?data->set.customrequest: (data->set.no_body?"HEAD": @@ -739,7 +749,8 @@ CURLcode Curl_http(struct connectdata *conn) http->p_accept?http->p_accept:"", (data->set.encoding && *data->set.encoding && conn->allocptr.accept_encoding)? conn->allocptr.accept_encoding:"", /* 08/28/02 jhrg */ - (data->change.referer && conn->allocptr.ref)?conn->allocptr.ref:"" /* Referer: */ + (data->change.referer && conn->allocptr.ref)?conn->allocptr.ref:"" /* Referer: */, + te ); if(co) { -- cgit v1.2.3