Dillo v3.1.1-98-g318d1f14
|
#include <zlib.h>
#include <iconv.h>
#include <errno.h>
#include <stdlib.h>
#include "decode.h"
#include "utf8.hh"
#include "msg.h"
Go to the source code of this file.
Functions | |
Dstr * | a_Decode_transfer_process (DecodeTransfer *dc, const char *instr, int inlen) |
Decode 'Transfer-Encoding: chunked' data. | |
bool_t | a_Decode_transfer_finished (DecodeTransfer *dc) |
void | a_Decode_transfer_free (DecodeTransfer *dc) |
static void | Decode_compression_free (Decode *dc) |
static Dstr * | Decode_gzip (Decode *dc, const char *instr, int inlen) |
Decode gzipped data. | |
static Dstr * | Decode_raw_deflate (Decode *dc, const char *instr, int inlen) |
Decode (raw) deflated data. | |
static Dstr * | Decode_deflate (Decode *dc, const char *instr, int inlen) |
Decode deflated data, initially presuming that the required zlib wrapper is there. | |
static Dstr * | Decode_charset (Decode *dc, const char *instr, int inlen) |
Translate to desired character set (UTF-8) | |
static void | Decode_charset_free (Decode *dc) |
DecodeTransfer * | a_Decode_transfer_init (const char *format) |
Initialize transfer decoder. | |
static Decode * | Decode_content_init_common (void) |
Decode * | a_Decode_content_init (const char *format) |
Initialize content decoder. | |
Decode * | a_Decode_charset_init (const char *format) |
Initialize decoder to translate from any character set known to iconv() to UTF-8. | |
Dstr * | a_Decode_process (Decode *dc, const char *instr, int inlen) |
Decode data. | |
void | a_Decode_free (Decode *dc) |
Variables | |
static const int | bufsize = 8*1024 |
Decode * a_Decode_charset_init | ( | const char * | format | ) |
Initialize decoder to translate from any character set known to iconv() to UTF-8.
GNU iconv(1) will provide a list of known character sets if invoked with the "--list" flag.
Definition at line 365 of file decode.c.
References Decode::buffer, bufsize, Decode::decode, Decode_charset(), Decode_charset_free(), dNew, dStr_new(), dStrAsciiCasecmp(), Decode::free, Decode::leftover, MSG_WARN, and Decode::state.
Referenced by a_Cache_set_content_type().
Decode * a_Decode_content_init | ( | const char * | format | ) |
Initialize content decoder.
Currently handles 'gzip' and 'deflate'.
Definition at line 327 of file decode.c.
References _MSG, Decode::decode, Decode_content_init_common(), Decode_deflate(), Decode_gzip(), dStrAsciiCasecmp(), MSG, and Decode::state.
Referenced by Cache_parse_header().
void a_Decode_free | ( | Decode * | dc | ) |
Definition at line 400 of file decode.c.
References dFree(), and Decode::free.
Referenced by a_Cache_set_content_type(), Cache_entry_free(), and Cache_finish_msg().
Decode data.
Definition at line 392 of file decode.c.
References Decode::decode.
Referenced by a_Cache_process_dbuf(), and Cache_ref_data().
bool_t a_Decode_transfer_finished | ( | DecodeTransfer * | dc | ) |
Definition at line 85 of file decode.c.
References DecodeTransfer::finished.
Referenced by a_Cache_process_dbuf().
void a_Decode_transfer_free | ( | DecodeTransfer * | dc | ) |
Definition at line 90 of file decode.c.
References dFree(), dStr_free(), DecodeTransfer::leftover, and DecodeTransfer::state.
Referenced by Cache_entry_free(), and Cache_finish_msg().
DecodeTransfer * a_Decode_transfer_init | ( | const char * | format | ) |
Initialize transfer decoder.
Currently handles "chunked".
Definition at line 291 of file decode.c.
References _MSG, dNew, dStr_new(), dStrAsciiCasecmp(), FALSE, DecodeTransfer::finished, DecodeTransfer::leftover, and DecodeTransfer::state.
Referenced by Cache_parse_header().
Dstr * a_Decode_transfer_process | ( | DecodeTransfer * | dc, |
const char * | instr, | ||
int | inlen | ||
) |
Decode 'Transfer-Encoding: chunked' data.
Definition at line 26 of file decode.c.
References dStr_append_l(), dStr_erase(), dStr_sized_new(), DecodeTransfer::finished, DecodeTransfer::leftover, Dstr::len, MIN, DecodeTransfer::state, Dstr::str, and TRUE.
Referenced by a_Cache_process_dbuf().
Translate to desired character set (UTF-8)
Definition at line 238 of file decode.c.
References Decode::buffer, bufsize, dStr_append_l(), dStr_erase(), dStr_new(), Decode::leftover, Dstr::len, Decode::state, Dstr::str, and utf8_replacement_char.
Referenced by a_Decode_charset_init().
|
static |
Definition at line 279 of file decode.c.
References Decode::buffer, dFree(), dStr_free(), Decode::leftover, and Decode::state.
Referenced by a_Decode_charset_init().
|
static |
Definition at line 97 of file decode.c.
References Decode::buffer, dFree(), and Decode::state.
Referenced by Decode_content_init_common().
|
static |
Definition at line 307 of file decode.c.
References Decode::buffer, bufsize, Decode_compression_free(), dNew, Decode::free, Decode::leftover, and Decode::state.
Referenced by a_Decode_content_init().
Decode deflated data, initially presuming that the required zlib wrapper is there.
On data error, switch to Decode_raw_deflate().
Definition at line 187 of file decode.c.
References Decode::buffer, bufsize, Decode::decode, Decode_raw_deflate(), dFree(), dNew, dStr_append_l(), dStr_free(), dStr_new(), MSG_WARN, and Decode::state.
Referenced by a_Decode_content_init().
Decode gzipped data.
Definition at line 114 of file decode.c.
References Decode::buffer, bufsize, dStr_append_l(), dStr_new(), MSG_ERR, and Decode::state.
Referenced by a_Decode_content_init().
Decode (raw) deflated data.
Definition at line 150 of file decode.c.
References Decode::buffer, bufsize, dStr_append_l(), dStr_new(), MSG_ERR, and Decode::state.
Referenced by Decode_deflate().
|
static |
Definition at line 21 of file decode.c.
Referenced by a_Decode_charset_init(), Decode_charset(), Decode_content_init_common(), Decode_deflate(), Decode_gzip(), Decode_raw_deflate(), Html_write_raw(), and DilloHtml::write().