mirror of
https://github.com/curl/curl.git
synced 2026-08-25 18:33:42 +03:00
- Shmulik Regev fixed so that the final CRLF of HTTP response headers are sent
to the debug callback. - Shmulik Regev added CURLOPT_HTTP_CONTENT_DECODING and CURLOPT_HTTP_TRANSFER_DECODING that if set to zero will disable libcurl's internal decoding of content or transfer encoded content. This may be preferable in cases where you use libcurl for proxy purposes or similar. The command line tool got a --raw option to disable both at once.
This commit is contained in:
parent
a631741141
commit
28b932fb4e
10 changed files with 86 additions and 12 deletions
|
|
@ -116,6 +116,12 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
|||
|
||||
*wrote = 0; /* nothing's written yet */
|
||||
|
||||
/* the original data is written to the client, but we go on with the
|
||||
chunk read process, to properly calculate the content length*/
|
||||
if ( data->set.http_te_skip )
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, datap,datalen);
|
||||
|
||||
|
||||
while(length) {
|
||||
switch(ch->state) {
|
||||
case CHUNK_HEX:
|
||||
|
|
@ -206,12 +212,17 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
|||
|
||||
/* Write the data portion available */
|
||||
#ifdef HAVE_LIBZ
|
||||
switch (data->reqdata.keep.content_encoding) {
|
||||
switch (conn->data->set.http_ce_skip?
|
||||
IDENTITY : data->reqdata.keep.content_encoding) {
|
||||
case IDENTITY:
|
||||
#endif
|
||||
if(!k->ignorebody)
|
||||
result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,
|
||||
piece);
|
||||
if(!k->ignorebody) {
|
||||
if ( !data->set.http_te_skip )
|
||||
result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,
|
||||
piece);
|
||||
else
|
||||
result = CURLE_OK;
|
||||
}
|
||||
#ifdef HAVE_LIBZ
|
||||
break;
|
||||
|
||||
|
|
@ -334,6 +345,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
|||
return(CHUNKE_BAD_CHUNK);
|
||||
}
|
||||
#endif /* CURL_DOES_CONVERSIONS */
|
||||
if ( !data->set.http_te_skip )
|
||||
Curl_client_write(conn, CLIENTWRITE_HEADER,
|
||||
conn->trailer, conn->trlPos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -689,6 +689,9 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
|||
k->keepon &= ~KEEP_READ;
|
||||
}
|
||||
|
||||
if(data->set.verbose)
|
||||
Curl_debug(data, CURLINFO_HEADER_IN,
|
||||
k->str_start, headerlen, conn);
|
||||
break; /* exit header line loop */
|
||||
}
|
||||
|
||||
|
|
@ -1286,7 +1289,8 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
|||
Make sure that ALL_CONTENT_ENCODINGS contains all the
|
||||
encodings handled here. */
|
||||
#ifdef HAVE_LIBZ
|
||||
switch (k->content_encoding) {
|
||||
switch (conn->data->set.http_ce_skip ?
|
||||
IDENTITY : k->content_encoding) {
|
||||
case IDENTITY:
|
||||
#endif
|
||||
/* This is the default when the server sends no
|
||||
|
|
|
|||
13
lib/url.c
13
lib/url.c
|
|
@ -1725,6 +1725,19 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
|||
data->set.ssh_private_key = va_arg(param, char *);
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTP_TRANSFER_DECODING:
|
||||
/*
|
||||
* disable libcurl transfer encoding is used
|
||||
*/
|
||||
data->set.http_te_skip = (bool)(0 == va_arg(param, long));
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTP_CONTENT_DECODING:
|
||||
/*
|
||||
* raw data passed to the application when content encoding is used
|
||||
*/
|
||||
data->set.http_ce_skip = (bool)(0 == va_arg(param, long));
|
||||
break;
|
||||
default:
|
||||
/* unknown tag and its companion, just ignore: */
|
||||
result = CURLE_FAILED_INIT; /* correct this */
|
||||
|
|
|
|||
|
|
@ -1292,6 +1292,10 @@ struct UserDefined {
|
|||
authentication */
|
||||
char *ssh_private_key; /* the path to the private key file for
|
||||
authentication */
|
||||
bool http_te_skip; /* pass the raw body data to the user, even when
|
||||
transfer-encoded (chunked, compressed) */
|
||||
bool http_ce_skip; /* pass the raw body data to the user, even when
|
||||
content-encoded (chunked, compressed) */
|
||||
};
|
||||
|
||||
struct Names {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue