diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-11-11 08:40:37 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-11-11 08:40:37 +0000 |
commit | 03c22b4576e99abf6385f64f54e3fb85c782cf0f (patch) | |
tree | 67bbfddc9db864878812c8fd08be00b478a71678 /lib/http.c | |
parent | ef749fa9ce93830f9835c9951a223dea4f5782ff (diff) |
Now supports "Transfer-Encoding: chunked" for HTTP PUT operations where the
size of the uploaded file is unknown.
Diffstat (limited to 'lib/http.c')
-rw-r--r-- | lib/http.c | 15 |
1 files changed, 13 insertions, 2 deletions
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> <CRLF> */ + (data->change.referer && conn->allocptr.ref)?conn->allocptr.ref:"" /* Referer: <data> <CRLF> */, + te ); if(co) { |