mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Introduce protocol.http.compression knob
When disabled, no Accept-Encoding header is sent.
This commit is contained in:
parent
f5c3ba2e99
commit
d4cec950ec
@ -178,6 +178,21 @@ static struct option_info http_options[] = {
|
|||||||
"security risk because it tells web-masters and the FBI sniffers about\n"
|
"security risk because it tells web-masters and the FBI sniffers about\n"
|
||||||
"your language preference.")),
|
"your language preference.")),
|
||||||
|
|
||||||
|
#if !(defined(CONFIG_GZIP) || defined(CONFIG_BZIP2))
|
||||||
|
#define COMP_NOTE "\nNote that this ELinks version has been compiled without compression\n" \
|
||||||
|
"support anyway. This option will have no effect.\n"
|
||||||
|
#else
|
||||||
|
#define COMP_NOTE
|
||||||
|
#endif
|
||||||
|
INIT_OPT_BOOL("protocol.http", N_("Enable on-the-fly compression (experimental)"),
|
||||||
|
"compression", 0, 1,
|
||||||
|
N_("If enabled, the capability to receive compressed content (gzip and/or\n"
|
||||||
|
"bzip2) is announced to the server, which usually sends the reply\n"
|
||||||
|
"compressed, thus saving some bandwidth at slight CPU expense.\n"
|
||||||
|
"HOWEVER, please note that the ELinks implementation is unfortunately very\n"
|
||||||
|
"buggy and you may see incomplete pages, pages with garbage instead of\n"
|
||||||
|
"content, etc.!" COMP_NOTE)),
|
||||||
|
|
||||||
INIT_OPT_BOOL("protocol.http", N_("Activate HTTP TRACE debugging"),
|
INIT_OPT_BOOL("protocol.http", N_("Activate HTTP TRACE debugging"),
|
||||||
"trace", 0, 0,
|
"trace", 0, 0,
|
||||||
N_("If active, all HTTP requests are sent with TRACE as their method\n"
|
N_("If active, all HTTP requests are sent with TRACE as their method\n"
|
||||||
@ -747,21 +762,23 @@ http_send_header(struct socket *socket)
|
|||||||
|
|
||||||
/* TODO: Make this encoding.c function. */
|
/* TODO: Make this encoding.c function. */
|
||||||
#if defined(CONFIG_GZIP) || defined(CONFIG_BZIP2)
|
#if defined(CONFIG_GZIP) || defined(CONFIG_BZIP2)
|
||||||
add_to_string(&header, "Accept-Encoding: ");
|
if (get_opt_bool("protocol.http.compression", NULL)) {
|
||||||
|
add_to_string(&header, "Accept-Encoding: ");
|
||||||
|
|
||||||
#ifdef CONFIG_BZIP2
|
#ifdef CONFIG_BZIP2
|
||||||
add_to_string(&header, "bzip2");
|
add_to_string(&header, "bzip2");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_GZIP
|
#ifdef CONFIG_GZIP
|
||||||
|
|
||||||
#ifdef CONFIG_BZIP2
|
#ifdef CONFIG_BZIP2
|
||||||
add_to_string(&header, ", ");
|
add_to_string(&header, ", ");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
add_to_string(&header, "gzip");
|
add_to_string(&header, "gzip");
|
||||||
#endif
|
#endif
|
||||||
add_crlf_to_string(&header);
|
add_crlf_to_string(&header);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!accept_charset) {
|
if (!accept_charset) {
|
||||||
|
Loading…
Reference in New Issue
Block a user