1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

http encoding: Moved the accept_encoding_header to the http.c.

This commit is contained in:
Witold Filipczyk 2008-02-29 15:32:10 +01:00 committed by Witold Filipczyk
parent 8bb0f20471
commit d8a062cffc
3 changed files with 27 additions and 30 deletions

View File

@ -344,30 +344,3 @@ read_encoded_file(struct string *filename, struct string *page)
close(fd);
return state;
}
void
accept_encoding_header(struct string *header)
{
#if defined(CONFIG_GZIP) || defined(CONFIG_BZIP2) || defined(CONFIG_LZMA)
int comma = 0;
add_to_string(header, "Accept-Encoding: ");
#ifdef CONFIG_BZIP2
add_to_string(header, "bzip2");
comma = 1;
#endif
#ifdef CONFIG_GZIP
if (comma) add_to_string(header, ", ");
add_to_string(header, "deflate, gzip");
comma = 1;
#endif
#ifdef CONFIG_LZMA
if (comma) add_to_string(header, ", ");
add_to_string(header, "lzma");
#endif
add_crlf_to_string(header);
#endif
}

View File

@ -45,6 +45,4 @@ read_file(struct stream_encoded *stream, int readsize, struct string *page);
/* Reads the file with the given @filename into the string @source. */
enum connection_state read_encoded_file(struct string *filename, struct string *source);
void accept_encoding_header(struct string *header);
#endif

View File

@ -23,7 +23,6 @@
#include "cache/cache.h"
#include "config/options.h"
#include "cookies/cookies.h"
#include "encoding/encoding.h"
#include "intl/charsets.h"
#include "intl/gettext/libintl.h"
#include "main/module.h"
@ -546,6 +545,33 @@ init_http_connection_info(struct connection *conn, int major, int minor, int clo
return http;
}
static void
accept_encoding_header(struct string *header)
{
#if defined(CONFIG_GZIP) || defined(CONFIG_BZIP2) || defined(CONFIG_LZMA)
int comma = 0;
add_to_string(header, "Accept-Encoding: ");
#ifdef CONFIG_BZIP2
add_to_string(header, "bzip2");
comma = 1;
#endif
#ifdef CONFIG_GZIP
if (comma) add_to_string(header, ", ");
add_to_string(header, "deflate, gzip");
comma = 1;
#endif
#ifdef CONFIG_LZMA
if (comma) add_to_string(header, ", ");
add_to_string(header, "lzma");
#endif
add_crlf_to_string(header);
#endif
}
static void
http_send_header(struct socket *socket)
{