mirror of
https://github.com/moparisthebest/curl
synced 2024-12-25 09:38:54 -05:00
parent
4f3828d5a2
commit
0b0269341b
@ -885,6 +885,15 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
|
|||||||
else
|
else
|
||||||
Curl_safefree(data->state.aptr.accept_encoding);
|
Curl_safefree(data->state.aptr.accept_encoding);
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
|
/* we only consider transfer-encoding magic if libz support is built-in */
|
||||||
|
result = Curl_transferencode(data);
|
||||||
|
if(result)
|
||||||
|
return result;
|
||||||
|
if(Curl_hyper_header(data, headers, data->state.aptr.te))
|
||||||
|
goto error;
|
||||||
|
#endif
|
||||||
|
|
||||||
result = cookies(data, conn, headers);
|
result = cookies(data, conn, headers);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
63
lib/http.c
63
lib/http.c
@ -2956,6 +2956,39 @@ CURLcode Curl_http_firstwrite(struct Curl_easy *data,
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
|
CURLcode Curl_transferencode(struct Curl_easy *data)
|
||||||
|
{
|
||||||
|
if(!Curl_checkheaders(data, "TE") &&
|
||||||
|
data->set.http_transfer_encoding) {
|
||||||
|
/* When we are to insert a TE: header in the request, we must also insert
|
||||||
|
TE in a Connection: header, so we need to merge the custom provided
|
||||||
|
Connection: header and prevent the original to get sent. Note that if
|
||||||
|
the user has inserted his/her own TE: header we don't do this magic
|
||||||
|
but then assume that the user will handle it all! */
|
||||||
|
char *cptr = Curl_checkheaders(data, "Connection");
|
||||||
|
#define TE_HEADER "TE: gzip\r\n"
|
||||||
|
|
||||||
|
Curl_safefree(data->state.aptr.te);
|
||||||
|
|
||||||
|
if(cptr) {
|
||||||
|
cptr = Curl_copy_header_value(cptr);
|
||||||
|
if(!cptr)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create the (updated) Connection: header */
|
||||||
|
data->state.aptr.te = aprintf("Connection: %s%sTE\r\n" TE_HEADER,
|
||||||
|
cptr ? cptr : "", (cptr && *cptr) ? ", ":"");
|
||||||
|
|
||||||
|
free(cptr);
|
||||||
|
if(!data->state.aptr.te)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef USE_HYPER
|
#ifndef USE_HYPER
|
||||||
/*
|
/*
|
||||||
* Curl_http() gets called from the generic multi_do() function when a HTTP
|
* Curl_http() gets called from the generic multi_do() function when a HTTP
|
||||||
@ -3072,33 +3105,9 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
|
|||||||
|
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
/* we only consider transfer-encoding magic if libz support is built-in */
|
/* we only consider transfer-encoding magic if libz support is built-in */
|
||||||
|
result = Curl_transferencode(data);
|
||||||
if(!Curl_checkheaders(data, "TE") &&
|
if(result)
|
||||||
data->set.http_transfer_encoding) {
|
return result;
|
||||||
/* When we are to insert a TE: header in the request, we must also insert
|
|
||||||
TE in a Connection: header, so we need to merge the custom provided
|
|
||||||
Connection: header and prevent the original to get sent. Note that if
|
|
||||||
the user has inserted his/her own TE: header we don't do this magic
|
|
||||||
but then assume that the user will handle it all! */
|
|
||||||
char *cptr = Curl_checkheaders(data, "Connection");
|
|
||||||
#define TE_HEADER "TE: gzip\r\n"
|
|
||||||
|
|
||||||
Curl_safefree(data->state.aptr.te);
|
|
||||||
|
|
||||||
if(cptr) {
|
|
||||||
cptr = Curl_copy_header_value(cptr);
|
|
||||||
if(!cptr)
|
|
||||||
return CURLE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create the (updated) Connection: header */
|
|
||||||
data->state.aptr.te = aprintf("Connection: %s%sTE\r\n" TE_HEADER,
|
|
||||||
cptr ? cptr : "", (cptr && *cptr) ? ", ":"");
|
|
||||||
|
|
||||||
free(cptr);
|
|
||||||
if(!data->state.aptr.te)
|
|
||||||
return CURLE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result = Curl_http_body(data, conn, httpreq, &te);
|
result = Curl_http_body(data, conn, httpreq, &te);
|
||||||
|
@ -93,6 +93,7 @@ CURLcode Curl_http_statusline(struct Curl_easy *data,
|
|||||||
struct connectdata *conn);
|
struct connectdata *conn);
|
||||||
CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
|
CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
|
||||||
char *headp);
|
char *headp);
|
||||||
|
CURLcode Curl_transferencode(struct Curl_easy *data);
|
||||||
CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
|
CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
|
||||||
Curl_HttpReq httpreq,
|
Curl_HttpReq httpreq,
|
||||||
const char **teep);
|
const char **teep);
|
||||||
|
Loading…
Reference in New Issue
Block a user