From a7f94dbbd130eaef6c24cf3a51f36393b64d30f1 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 1 Nov 2007 02:24:55 +0100 Subject: [PATCH] Introduce protocol.http.compression knob When disabled, no Accept-Encoding header is sent. (cherry picked from commit d4cec950ecadb0c19206f28b0bf9c6d8992bc1e7) Conflicts: src/protocol/http/http.c --- src/protocol/http/http.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c index 2141160e6..6dc8eb475 100644 --- a/src/protocol/http/http.c +++ b/src/protocol/http/http.c @@ -178,6 +178,21 @@ static struct option_info http_options[] = { "security risk because it tells web-masters and the FBI sniffers about\n" "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"), "trace", 0, 0, N_("If active, all HTTP requests are sent with TRACE as their method\n" @@ -772,7 +787,8 @@ http_send_header(struct socket *socket) add_to_string(&header, "Accept: */*"); add_crlf_to_string(&header); - accept_encoding_header(&header); + if (get_opt_bool("protocol.http.compression")) + accept_encoding_header(&header); if (!accept_charset) { init_accept_charset();